[Pyrex] [Fwd: [Bug 218377] [NEW] special floats generate incorrect C code when used as compile-time constants]

Chris Mellon arkanes at gmail.com
Fri Apr 25 17:06:00 CEST 2008


On Tue, Apr 22, 2008 at 6:13 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Stefan Behnel wrote:
>  >   DEF INFINITY = float('inf')
>  >   print INFINITY
>  >
>  > results in:
>  >
>  >   foo.c: In function 'init2foo':
>  >   foo.c:158: error: 'inf' undeclared (first use in this function)
>
>  I'm not sure whether to do anything about this for Pyrex.
>  As I understand it, Python doesn't promise anything about
>  representation of inf and nan, so it's platform dependent.
>  I'm inclined to think that using an appropriate constant
>  from your platform's math.h is the right thing to do.
>
>  --

As of 2.6, float('inf') and float('nan') will be guaranteed to work
(instead of punting to libcs atof which is what it does now), so
supporting it in Pyrex is forward-looking at least  ;)



More information about the Pyrex mailing list