public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Soegtrop, Michael" <michael.soegtrop@intel.com>
To: "dank@kegel.com" <dank@kegel.com>,
	"cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: Floating point exception in strtod()
Date: Sun, 08 Apr 2018 12:57:00 -0000	[thread overview]
Message-ID: <0F7D3B1B3C4B894D824F5B822E3E5A177861A345@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <CAPF-yOboiR8Dg+QtrHCCR55vPGysMxQ=Wbpa4QGaJ=i5PoqtkQ@mail.gmail.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1175 bytes --]

> 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
\x03B‹KCB”\x1c›Ø›\x19[H\x1c™\^[ܝ\x1cΈ\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÜ\x1c›Ø›\x19[\Ëš\x1d^[[\x03B‘TNˆ\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÙ˜\KÃB‘^[ØÝ[Y[\x18]\x1a[ÛŽˆ\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÙ^[ØÜËš\x1d^[[\x03B•[œÝXœØÜšX™H\x1a[™›Îˆ\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÛ[\vÈÝ[œÝXœØÜšX™K\Ú[\^[\x19CBƒB

  reply	other threads:[~2018-04-08 12:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-07 17:40 Ken Brown
2018-04-07 20:52 ` Dan Kegel
2018-04-08 12:57   ` Soegtrop, Michael [this message]
2018-04-07 20:56 ` Eliot Moss
2018-04-08  3:12   ` Duncan Roe
2018-04-08 10:25     ` Hans-Bernhard Bröker
2018-04-09  9:47 ` Corinna Vinschen
2018-04-09 12:09   ` Ken Brown
2018-04-09 12:51     ` Corinna Vinschen
2018-04-09 14:46   ` Soegtrop, Michael
2018-04-09 15:33     ` Corinna Vinschen
2018-04-09 15:55       ` Soegtrop, Michael

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0F7D3B1B3C4B894D824F5B822E3E5A177861A345@IRSMSX102.ger.corp.intel.com \
    --to=michael.soegtrop@intel.com \
    --cc=cygwin@cygwin.com \
    --cc=dank@kegel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).