mpmath puzzle

Dick Moores rdm at rcblue.com
Wed Nov 14 00:55:48 EST 2007


For 1234 ** 10.9, why the wrong result from mpmath.power()?

========================================
#!/usr/bin/env python
#coding=utf-8
from mpmath import *

mpf.dps = 32

x = mpf(1234)
y = mpf(10.9)

print power(x,y)
print "4.9583278648155041477415234438717e+33" # from Windows calculator

"""
output:
4.9583278648155166864966558721921e+33
4.9583278648155041477415234438717e+33
"""
========================================
(Code is also at <http://python.pastebin.com/m72a277b8>)

Thanks,

Dick Moores




More information about the Python-list mailing list