• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help! Math question.

 
Joe Budden
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic