[racket-dev] Adding pi.t

From: Neil Toronto (neil.toronto at gmail.com)
Date: Mon Apr 21 20:28:01 EDT 2014

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 ⊥

Posted on the dev mailing list.