Re: precision problems in base conversion of rational numbers

2005-07-07 Thread [EMAIL PROTECTED]
Raymond Hettinger wrote: > > > For a simple example, convert both 10247448370872321 and > > > 10247448370872319 from base ten to 4 digits of hex. The calculations > > > need to be carried out to 15 places of hex (or 17 places of decimal) > > > just to determine whether the fourth hex digit is a

Re: precision problems in base conversion of rational numbers

2005-07-06 Thread Raymond Hettinger
> > For a simple example, convert both 10247448370872321 and > > 10247448370872319 from base ten to 4 digits of hex. The calculations > > need to be carried out to 15 places of hex (or 17 places of decimal) > > just to determine whether the fourth hex digit is a 7 or 8: > > > > >>> hex(1024744

Re: precision problems in base conversion of rational numbers

2005-07-06 Thread [EMAIL PROTECTED]
Raymond Hettinger wrote: > [Terry Hancock] > > > Needless to say, the conventional floating point numbers in Python > > > are actually stored as *binary*, which is why there is a "decimal" > > > module (which is new). > > > > > > If you're going to be converting between bases anyway, it probably

Re: precision problems in base conversion of rational numbers

2005-07-06 Thread Raymond Hettinger
[Terry Hancock] > > Needless to say, the conventional floating point numbers in Python > > are actually stored as *binary*, which is why there is a "decimal" > > module (which is new). > > > > If you're going to be converting between bases anyway, it probably > > makes little difference whether you

Re: precision problems in base conversion of rational numbers

2005-07-05 Thread Dan Bishop
Brian van den Broek wrote: > Hi all, > > I guess it is more of a maths question than a programming one, but it > involves use of the decimal module, so here goes: > > As a self-directed learning exercise I've been working on a script to > convert numbers to arbitrary bases. It aims to take any of w

Re: precision problems in base conversion of rational numbers

2005-07-05 Thread Brian van den Broek
Terry Hancock said unto the world upon 05/07/2005 11:49: > On Monday 04 July 2005 06:11 am, Brian van den Broek wrote: > >>As a self-directed learning exercise I've been working on a script to >>convert numbers to arbitrary bases. It aims to take any of whole >>numbers (python ints, longs, or De

Re: precision problems in base conversion of rational numbers

2005-07-05 Thread [EMAIL PROTECTED]
Brian van den Broek wrote: > Hi all, > > I guess it is more of a maths question than a programming one, but it > involves use of the decimal module, so here goes: > > As a self-directed learning exercise I've been working on a script to > convert numbers to arbitrary bases. It aims to take any of

Re: precision problems in base conversion of rational numbers

2005-07-05 Thread Terry Hancock
On Monday 04 July 2005 06:11 am, Brian van den Broek wrote: > As a self-directed learning exercise I've been working on a script to > convert numbers to arbitrary bases. It aims to take any of whole > numbers (python ints, longs, or Decimals), rational numbers (n / m n, > m whole) and floating p

precision problems in base conversion of rational numbers

2005-07-04 Thread Brian van den Broek
Hi all, I guess it is more of a maths question than a programming one, but it involves use of the decimal module, so here goes: As a self-directed learning exercise I've been working on a script to convert numbers to arbitrary bases. It aims to take any of whole numbers (python ints, longs, or