This is purely out of curiosity, but why does this occur?
>>> a = float('Nan')
>>> a**2.0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: (33, 'Domain error')
I would have expected it to simply return NaN instead of generating an error.
From http://www.mail-archive.com/[email protected]/msg00337.html, it seems that this is only the case on the windows builds, due to how the compiler implements floating point stuff.
Example
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> float('NaN')
nan
>>> _**2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: (33, 'Domain error')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With