BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-02-2010, 09:00 AM   #1 (permalink)
New Member
 
Join Date: Sep 2010
Location: Canada
Model: 8330
PIN: N/A
Carrier: Telus
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default MathUtilities

Please Login to Remove!

I've made an attempt to understand and to convert formulas from my Excel application to the BlackBerry application that I'm working on, but I need input from someone with expertise in this area, to show me what I'm doing wrong.

Your assistance would be greatly appreciated. Thanks!!


(1) Excel Formula: =ROUND((1+PMIF)^12-1,4);
BB Formula: = MathUtilities.Round(1+PMIF),MathUtilities.Pow(12-1,4);


(2) Excel Formula: =((1+(AIR/2))^2)^(1/12)-1;
BB Formula: = (1+(AIR/2)), MathUtilities.Pow( ????.........


(3) Excel Formula: =(P*PIFM)/(1-(1+PIFM)^(-AMMO))..
BB Formula: = (P*PIFM)/(1-(1+PIFM), MathUtilities.Pow(-AMMO));

(4) Excel Formula: =ROUND(PPM,2);
BB Formula: = MathUtilities.Round(PPM,2);
Offline  
Old 10-02-2010, 06:05 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Well, MathUtilities.round() only takes one argument; MathUtilities.pow() requires two arguments . . .

I would suggest:
(1) Excel Formula: =ROUND((1+PMIF)^12-1,4);
IIRC the second argument to ROUND is the number of decimal palces
Code:
(float)MathUtilities.round( (MathUtilities.pow(1+PMIF,12)-1) * 10000 ) / 10000;

(2) Excel Formula: =((1+(AIR/2))^2)^(1/12)-1;
Code:
MathUtilities.pow(MathUtilities.pow( (1+(AIR/2)), 2), 1/12) - 1;

(3) Excel Formula: =(P*PIFM)/(1-(1+PIFM)^(-AMMO))..
Code:
(P*PIFM)/MathUtilities.pow(1-(1+PIFM), -AMMO);
(4) Excel Formula: =ROUND(PPM,2);
Code:
(float)MathUtilities.pow(PPM * 100) / 100;
__________________
My other Blackberry is a PlayBook.
Offline  
Old 10-02-2010, 07:11 PM   #3 (permalink)
New Member
 
Join Date: Sep 2010
Location: Canada
Model: 8330
PIN: N/A
Carrier: Telus
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks very much for your assistance.....Will implement the changes and let you know how the application works out.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.