Convert rational to fixed-point decimal number

Pisminskaya Alexandra Aleksandra.Pisminskaya at bercut.com
Tue Feb 16 14:51:04 CET 2010


Multiply the dividend by a suitable power of 10 - expensive operation.
I hope avoid it.


Pisminskaya Alexandra

-----Original Message-----
From: tg at gmplib.org [mailto:tg at gmplib.org] 
Sent: Tuesday, February 16, 2010 4:32 PM
To: Pisminskaya Alexandra
Cc: gmp-discuss at gmplib.org
Subject: Re: Convert rational to fixed-point decimal number

"Pisminskaya Alexandra" <Aleksandra.Pisminskaya at bercut.com> writes:

  Example, 0.3333333333333. Depend by my precision.
  
That looks like "precision loss" to me.

I still am not sure what you want to do, or what the target data type
is.

Perhaps you could multiply the dividend by a suitable power of 10, then
perform the division, then print the quotient?  (How to do that will
require some reading of the fine manual.)

-- 
Torbjörn


More information about the gmp-discuss mailing list