(Re:) (re;) Math.pow Question
From: Michael B. Williams (mbw4359_at_yahoo.com)
Date: 05/30/04
- Next message: Robert Mark Bram: "Open new command window for ANT task"
- Previous message: Tony Morris: "Re: Ant and OutOfMemoryError exceptions"
- Next in thread: Boudewijn Dijkstra: "Re: (Re:) (re;) Math.pow Question"
- Reply: Boudewijn Dijkstra: "Re: (Re:) (re;) Math.pow Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 May 2004 23:49:37 -0700
Michael B. Williams wrote:
>> Ooooopppps and sorry about the sniplet thanks again
>> N = 360, /* I had zero */
Sudsy <bitbucket44@hotmail.com> wrote:
>Why are you surprised at the infinity result? Using a value of 70 for
N
>provides a result of 2.3224057336909954E302, a HUGE number.
>Methinks your algorithm is incorrect as you appear to want to
calculate
>daily interest (based on some of the math and the variable names).
>I strongly suggest hitting the text books again or searching the 'net
>for the correct algorithm.
I think that you need to pull out your old calculator -.0174 of
course I rounded it up besides it's not my algorithm anyway I'm just
trying to understand why Math.pow is behaving in an abnormal way. This
is the code
import java.math.*;
public class post
{
public static void main(String[] args)
{
int
term = 30,
amount = 200000,
principal = amount;
double
interest = .0575,
monthly_payment = 0,
J = 0,
N = 0,
ftemp;
J = interest / (1200);
N = 30*12;
ftemp = ( 1-(1+J) );
N = N * (-1);
System.out.println( ftemp );
// ftemp = -4.791666666670302E-5
System.out.println( N );
// N = -360.0
System.out.println( Math.pow( ftemp , N ) );
// the output is Infinity I tried hardcoding it to -360
}
}
- Next message: Robert Mark Bram: "Open new command window for ANT task"
- Previous message: Tony Morris: "Re: Ant and OutOfMemoryError exceptions"
- Next in thread: Boudewijn Dijkstra: "Re: (Re:) (re;) Math.pow Question"
- Reply: Boudewijn Dijkstra: "Re: (Re:) (re;) Math.pow Question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]