Hey Colin,

What you're running into here is the limited accuracy of floating point
values...
You'll likely find this happens a lot in python.. CPython, at least. (I
know, as I do)
I'm not sure, as I've never used it... but perhaps Numeric/Numpy handle
this kinda stuff better (for accuracy's sake)


Cheers,
--Brett

col speed wrote:
Hi there, just a quick one.
Is there a way to obtain cube roots in python?
I have been trying:
math.pow(n,1.0/3)
This works with some, but with 64, for example I get:
>>> pow(64,1.0/3)
3.9999999999999996
However:
>>> 4**3
64
Any ideas?
Thanks
Colin
------------------------------------------------------------------------

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to