[gambit-list] ffi double constants

Bradley Lucier lucier at math.purdue.edu
Mon Feb 20 08:10:52 EST 2012


On Feb 20, 2012, at 6:42 AM, Álvaro Castro-Castilla wrote:

> 
> Hi,
> 
> I want to use the M_PI constant, which is defined in C as #define M_PI
> 3.14159265358979323846, with 21 decimals. For the Cairo bindings, the
> full precision is needed, because drawing a circle is done by drawing
> an arc 2*M_PI long, and the algorithm only considers it a circle when
> the 2*pi is passed with the proper precision.

(* 8 (atan 1)) should give you 2*M_PI to 64-bit double precision, so this should work unless you're working with 80-bit long doubles.

> What's the way to support this precision for the FFI bindings, so I
> can pass that value to the affected functions as it is done in C
> without a special wrapper function for each case?
> 
> Best regards,
> 
> Álvaro
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list