From: jmfauth on
A quick question.

I understand how to get these numbers

34.52000000000000312638803734444081783294677734375

and

47 (from 2**47)

and the sign.

with the decimal module, but I fail to find this one

4858258098025923

Possible?



From: Mark Dickinson on
On Aug 13, 3:03 pm, jmfauth <wxjmfa...(a)gmail.com> wrote:
> A quick question.
>
> I understand how to get these numbers
>
> 34.52000000000000312638803734444081783294677734375
>
> and
>
> 47 (from 2**47)
>
> and the sign.
>
> with the decimal module, but I fail to find this one
>
> 4858258098025923
>
> Possible?

See the float.as_integer_ratio method.

--
Mark
From: jmfauth on
On 13 août, 17:43, Mark Dickinson <dicki...(a)gmail.com> wrote:
> On Aug 13, 3:03 pm, jmfauth <wxjmfa...(a)gmail.com> wrote:
>
>
>
> > A quick question.
>
> > I understand how to get these numbers
>
> > 34.52000000000000312638803734444081783294677734375
>
> > and
>
> > 47 (from 2**47)
>
> > and the sign.
>
> > with the decimal module, but I fail to find this one
>
> > 4858258098025923
>
> > Possible?
>
> See the float.as_integer_ratio method.
>
> --
> Mark


Thanks. I *stupidely* forget this.

jmf

From: Aahz on
In article <595969e7-354f-456d-82b5-6aeafbabe419(a)d8g2000yqf.googlegroups.com>,
Mark Dickinson <dickinsm(a)gmail.com> wrote:
>
> - If you *really* need a number that represents the *exact* value
>34.52, then use the decimal module, or perhaps consider using a simple
>home-brewed fixed-point representation.

Don't use a home-brew fixed-point, rely on Uncle Tim!

http://pythoncraft.com/FixedPoint.py
--
Aahz (aahz(a)pythoncraft.com) <*> http://www.pythoncraft.com/

"...if I were on life-support, I'd rather have it run by a Gameboy than a
Windows box." --Cliff Wells