Floating point exception in strtod()

Soegtrop, Michael michael.soegtrop@intel.com
Sun Apr 8 12:57:00 GMT 2018


> 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)	40.75545582601886

(%i3)	factor(221645100408832000);
(%o3)	2^16*5^3*31*41*1361*15641
(%i4)	float(log(5^3*31*41*1361*15641)/log(2));
(%o4)	41.62102908434535

So the first number has 41 bits and the second 42 after removing powers of 2. The significand size of a double is 53 bits (including the implicit 1).

Best regards,

Michael
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
B‹KCB”›Ø›[H™\ܝΈ‹ËØÞYÝÚ[‹˜ÛÛKܛ؛[\Ëš[B‘TNˆ‹ËØÞYÝÚ[‹˜ÛÛKÙ˜\KÃB‘ØÝ[Y[][ÛŽˆ‹ËØÞYÝÚ[‹˜ÛÛKÙØÜËš[B•[œÝXœØÜšX™H[™›Îˆ‹ËØÞYÝÚ[‹˜ÛÛKÛ[ÈÝ[œÝXœØÜšX™K\Ú[\CBƒB


More information about the Cygwin mailing list