File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Help! Math question.

Joe Budden

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

Why is the output the same of:

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.
I agree. Here's the link:
subject: Help! Math question.
It's not a secret anymore!