Hi Alan

That's right, it is the Decimal module I'm trying to understand.  And, it is 
how to represent a decimal floating point number as a common/vulgar fraction eg 
1.234 = 1234/1000.  How do you do this using the Decimal module?  The 
motivation is to avoid floating point calculations and use integers only (don't 
ask why!).  Cheers!

Dinesh



--------------------------------------------------------------------------------
Date: Fri, 21 Nov 2008 01:03:05 -0000
From: "Alan Gauld" <[EMAIL PROTECTED]>
Subject: Re: [Tutor] Decimal fixed point representation
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
reply-type=original


"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote 

> I'm trying to get my head around the Decimal module to 
> understand how to represent a decimal floating point 
> number as an integer (or integers).  

I'm not sure what you mean by that.

Is it the use of the Decimal module you are querying?

Is it how to represent a ecimal fraction as an 
integer - ie how to lose the numbers after the point?

Is it how to represent it as a common/vulgar fraction
eg 1.234 = 1234/1000

Or something else?

> Am I barking mad or is this possible?

It is possible that you are barking mad I suppose. 

As to whether what you are asking about decimals 
is possible, that depends on what you are actually 
asking :-)

Alan G

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to