[gambit-list] How emulate #e using inexact->exact or something?

Marc Feeley feeley at iro.umontreal.ca
Tue Dec 24 14:17:38 EST 2013


On Dec 24, 2013, at 1:54 PM, Mikael <mikael.rcv at gmail.com> wrote:

> Ah - http://www.binaryconvert.com/result_double.html?decimal=048046051 clarifies that
> 
> 0.3 is represented internally as 2.99999999999999988897769753748E-1 , 
> 
> so this is what inexact->exact converts to 5404319552844595/18014398509481984 .
> 

Hmmm… that’s not the exact decimal representation of the floating point 0.3.  In Gambit, to know the exact decimal expansion of an inexact number you can use multiplication by a large power of 10:

> (* (expt 10 70) (inexact->exact 0.3))
2999999999999999888977697537484345957636833190917968750000000000000000

Marc




More information about the Gambit-list mailing list