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. 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
Afficher les réponses par date
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@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
I was using (* 2 (angle -inf.0)) But anyway, the problem is elsewhere, precision is double. Thanks! 2012/2/20 Bradley Lucier <lucier@math.purdue.edu>:
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@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
What is the problem, you get a broken circle? Den 20 februari 2012 17:56 skrev Álvaro Castro-Castilla < alvaro.castro.castilla@gmail.com>:
I was using (* 2 (angle -inf.0))
But anyway, the problem is elsewhere, precision is double.
Thanks!
2012/2/20 Bradley Lucier <lucier@math.purdue.edu>:
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@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Yeah, but I fixed it. I've had this error before and it was because of the precision, but this time wasn't. As I'm messing with Android, I thought it might be happening again. No worries :) On Mon, Feb 20, 2012 at 5:00 PM, Mikael <mikael.rcv@gmail.com> wrote:
What is the problem, you get a broken circle?
Den 20 februari 2012 17:56 skrev Álvaro Castro-Castilla <alvaro.castro.castilla@gmail.com>:
I was using (* 2 (angle -inf.0))
But anyway, the problem is elsewhere, precision is double.
Thanks!
2012/2/20 Bradley Lucier <lucier@math.purdue.edu>:
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@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
_______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
participants (3)
-
Bradley Lucier -
Mikael -
Álvaro Castro-Castilla