471,599 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

Python Fractions issue.

(From: http://paddy3118.blogspot.com/2008/0...ons-issue.html)

There seems to be a problem/difference in calculating with the new
fractions module when comparing Python 26rc2 and 30rc1

I was reading the paper "Interval Arithmetic: Python Implementation
and Applications" and thought to try the first example function
f(x,y), which needs more precision than Python floating point provides
(on my Windows PC), to calculate a sensible answer.

Ahah, I thought, lets try this with Fractions - so I first installed
Python 30rc1, typed in the Function - saw the rubbish result, then
used Fractions and got the 'right' result.
I then wondered if fractions had been back-ported to Python 2.6rc2,
found that it had, but got different results.

As you can see from the table, Python 2.6rc2 has a problem calculating
t3 = F(11,2) * y**8 + x/(2*y), where F is Fraction.

I wonder where the problem lies?

(For the Table, please see the blog entry).

- Paddy.
Sep 23 '08 #1
0 1143

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

699 posts views Thread by mike420 | last post: by
89 posts views Thread by Radioactive Man | last post: by
114 posts views Thread by Maurice LING | last post: by
10 posts views Thread by Andrew Dalke | last post: by
52 posts views Thread by Dick Moores | last post: by
33 posts views Thread by selowitch | last post: by
26 posts views Thread by Christoph Zwerschke | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.