mpmath puzzle

D

Dick Moores

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
 
M

mensanator

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

Check this out, better than Windows or mpmath:
(mpz(4958327864815504147741523443871702L), 0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,269
Latest member
vinaykumar_nevatia23

Latest Threads

Top