RE: Floating point exception in strtod()

2018-04-09 Thread Soegtrop, Michael
Dear Corinna, > ...which is what I described in the rest of my mail :) ah, yes, sorry. I stumbled on the "0x96c75d80 which appears to be perfectly valid for a 32 bit int", fell on my nose and looks like I forgot to walk on then. Best regards, Michael Intel Deutschland GmbH Registered

Re: Floating point exception in strtod()

2018-04-09 Thread Corinna Vinschen
On Apr 9 14:45, Soegtrop, Michael wrote: > Dear Corinna, > > > L is of type Long == int32_t, aadj is of type double. The value of > > aadj at this time is 2529648000.0 == 0x96c75d80 which appears to be > > perfectly valid for a 32 bit int. > > 2529648000 is a valid unsigned long, but not a

RE: Floating point exception in strtod()

2018-04-09 Thread Soegtrop, Michael
Dear Corinna, > L is of type Long == int32_t, aadj is of type double. The value of aadj at > this time is 2529648000.0 == 0x96c75d80 which appears to be perfectly valid > for a 32 bit int. 2529648000 is a valid unsigned long, but not a valid signed long. The largest 32 bit long is 2^31-1 =

Re: Floating point exception in strtod()

2018-04-09 Thread Corinna Vinschen
On Apr 9 08:09, Ken Brown wrote: > On 4/9/2018 5:47 AM, Corinna Vinschen wrote: > > On Apr 7 13:40, Ken Brown wrote: > > > $ cat strtod_test.c > > > #include > > > #include > > > #include > > > > > > int > > > main () > > > { > > >/* The following number comes from

Re: Floating point exception in strtod()

2018-04-09 Thread Ken Brown
On 4/9/2018 5:47 AM, Corinna Vinschen wrote: On Apr 7 13:40, Ken Brown wrote: $ cat strtod_test.c #include #include #include int main () { /* The following number comes from /usr/share/asymptote/ode.asy. */ const char *str = "121645100408832000.0"; char *ptr; feenableexcept

Re: Floating point exception in strtod()

2018-04-09 Thread Corinna Vinschen
On Apr 7 13:40, Ken Brown wrote: > $ cat strtod_test.c > #include > #include > #include > > int > main () > { > /* The following number comes from /usr/share/asymptote/ode.asy. */ > const char *str = "121645100408832000.0"; > char *ptr; > > feenableexcept (FE_INVALID); > strtod

RE: Floating point exception in strtod()

2018-04-08 Thread Soegtrop, Michael
> Probably doesn't fit precisely into a double. Does strtold behave > better? actually both numbers can be represented exactly as IEEE double. In Maxima: (%i1) factor(121645100408832000); (%o1) 2^16*3^8*5^3*7^2*11*13*17*19 (%i2) float(log(3^8*5^3*7^2*11*13*17*19)/log(2)); (%o2)

Re: Floating point exception in strtod()

2018-04-08 Thread Hans-Bernhard Bröker
Am 08.04.2018 um 05:11 schrieb Duncan Roe: I tried in 64-bit with the same result as Eliot: works fine w/out feenableexcept, no o/p with feenableexcept. Just in case this may have been overlooked: please note that "no output" actually means the program crashed because of an uncaught SIGFPE,

Re: Floating point exception in strtod()

2018-04-07 Thread Duncan Roe
On Sat, Apr 07, 2018 at 04:56:13PM -0400, Eliot Moss wrote: > On 4/7/2018 1:40 PM, Ken Brown wrote: > > $ cat strtod_test.c > > #include > > #include > > #include > > > > int > > main () > > { > >   /* The following number comes from /usr/share/asymptote/ode.asy.  */ > >   const char *str =

Re: Floating point exception in strtod()

2018-04-07 Thread Eliot Moss
On 4/7/2018 1:40 PM, Ken Brown wrote: $ cat strtod_test.c #include #include #include int main () {   /* The following number comes from /usr/share/asymptote/ode.asy.  */   const char *str = "121645100408832000.0";   char *ptr;   feenableexcept (FE_INVALID);   strtod (str, );   /* If

Re: Floating point exception in strtod()

2018-04-07 Thread Dan Kegel
Is that 19! ? Probably doesn't fit precisely into a double. Does strtold behave better? Some implementations throw on unrepresentable numbers, e.g. https://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrte/index.html Ken Brown schrieb am Sa., 7. Apr. 2018, 10:40: > $ cat