GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Help! Math question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Help! Math question." Watch "Help! Math question." New topic
Author

Help! Math question.

Joe Budden
Greenhorn

Joined: Mar 22, 2006
Posts: 2
I have a question, given the following code:



Why is the output the same of:
0.3989423
0.3989423

All help appreciated. Thank you.
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Math.exp((-1/2) * (.01 * .01))


Remember that when you divide an int by an int, the result is an int. The operations in parentheses are done seperately.

Since -1/2 is 0, the result will be e^0 = 1 regardless of what you multiply -1/2 by.
 
GeeCON Prague 2014
 
subject: Help! Math question.