This might be dumb... but I'm having problems raising e to a negative number and I can't figure out what is going on.

``````>>> math.exp(((-23*(23-1))/730))
0.36787944117144233
>>> math.exp(-506/730)
0.36787944117144233
>>> math.exp(-.69)
0.5015760690660556
>>> math.exp(-(506/730))
1.0``````

For some reason I keep getting different answers when they should all be the same...
Does anyone know what's happening?

Thanks!

Maybe you are using Python 2, where integer division 506/730 makes 0, when you do not want that but actually 506.0/730 float division?

Better to get used to write in beginning of your programs:

``from __future__ import division``

So you get what you expect and must use // for integer division instead of single /

Another way is to add '.' behind the integer to make it a 'float'.

``506/730``

to

``506./730``

This might be dumb... but I'm having problems raising e to a negative number and I can't figure out what is going on.

``````>>> math.exp(((-23*(23-1))/730))
0.36787944117144233
>>> math.exp(-506/730)
0.36787944117144233
>>> math.exp(-.69)
0.5015760690660556
>>> math.exp(-(506/730))
1.0``````

For some reason I keep getting different answers when they should all be the same...