By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,799 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,799 IT Pros & Developers. It's quick & easy.

Python Fractions issue.

P: n/a
(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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.