[racket-dev] Adding pi.t

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Apr 21 21:47:28 EDT 2014

The definition

 (define pi.t 3.1415926535897932385t0)

will work even on platforms where extflonums are not supported.

On those platforms, no operation other than printing will work on the
number, but reading and printing will work (and printing simply writes
the original representation).

At Mon, 21 Apr 2014 18:28:01 -0600, Neil Toronto wrote:
> While adding racket/extflonum's exports to Typed Racket's base type 
> environment, I realized that we don't have an 80-bit pi constant. I 
> considered exporting this definition from "racket/extflonum.rkt":
> 
>      (define pi.t (extfl* 4.0t0 (extflatan 1.0t0)))
> 
> (Multiplication by 4.0t0 is exact if it doesn't overflow, so this is 
> correctly rounded as long as `extflatan` is.) But what if the build 
> platform doesn't have extflonums? I've got this right now:
> 
>      (define pi.t 3.1415926535897932385t0)
> 
> Conversion between 80-bit flonums and decimals round-trips nicely, at 
> least on my computer.
> 
> But does decimal conversion (besides 0.0t0 and other easy cases) also 
> require extflonums to be available? If so, is there a way to export an 
> 80-bit pi approximation?
> 
> Neil ⊥
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev


Posted on the dev mailing list.