[Proj] Change in +prog=eqc behavior from 4.5.0 to 4.6.1

Aaron Friesen aaron at cartopac.com
Thu Jul 16 19:15:20 EST 2009

> -----Original Message-----
> On 07/16/2009 02:29 PM, Orion Poplawski wrote:
> > Turns out that somewhere between glibc 2.9 and 2.10.1, atof/strtod
> for
> > "5.3049894774131808e-315" starting setting errno to ERANGE.  Having
> > errno set causes pj_init to abort.  I believe this is a bug in glibc
> > (file here: http://sourceware.org/bugzilla/show_bug.cgi?id=10404).
> Well, apparently the glibc maintainer doesn't agree with me (big
> surprise), so it seems that proj should be made so that it can handle
> errno getting set to ERANGE.  I'm not sure what the best way would be.
> I'd be tempted for now just to set errno to 0 after calling atof, but
> that is not very good form.

If I'm reading the IEEE spec correctly, the smallest normalized double
precision floating point value that can be stored has a hex pattern of
0x0020000000000000 (the right-most exponent bit set, all other bits
zero), which is approximately 4.4501477170144028e-308.  With denormalized
values, it is possible to represent smaller numbers, but the conversion
routines (atof/strtod) cannot (or at least should not) produce
denormalized values.

I would agree with the glibc maintainer, that ERANGE is a proper
response when attempting to convert "5.3049894774131808e-315".

By the way, the Visual Studio debugger shows 5.304989477413e-315 for the 
denormalized value with hex pattern 0x0000000040000000.


More information about the Proj mailing list