From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117065 invoked by alias); 7 Apr 2018 20:52:16 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 117055 invoked by uid 89); 7 Apr 2018 20:52:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=HX-Received:10.98.245.7, H*c:alternative, HX-HELO:sk:mail-pf X-HELO: mail-pf0-f172.google.com Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 07 Apr 2018 20:52:14 +0000 Received: by mail-pf0-f172.google.com with SMTP id c78so3167898pfj.6 for ; Sat, 07 Apr 2018 13:52:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to; bh=6ZYMki1YSKFJX+OMYC0HpQvwZceVYp1pnx8w3VP4KJo=; b=rNmAkFO5Uo7uzzOuR/k0YUzT1/Hm0CAlHhdjqI3Jp4HIsg1DpfSn+8tlA2gfk6R37D oECefTHkqMnCBpavtXk+kdTJf+BrrI5MlTkK/yEd+QxnT7wmiUssM1GdCMFIXT4JEIMG 3ytSKSbHhi5ns6iSls3ppqVG8qzHNo4V2giCTjqjKMuxA9hlsaD5TfpYMxSB+ahbv9NP 7Ossa8hZOZf+vOV5l3SVQ60vofoOMd9Xfkkj7Opn1/xzLHdn6B/+emT2GwK567ULMrio ZhqUluDM6dxF9Irf3rSlCm0nf6W5YwJuJZojitZQ0y5Vf/FooxiQ9o6lhlQL2THsvSMT dbHg== X-Gm-Message-State: AElRT7Fl1Arh2BJ14HnB0ZBSY9yi/muKjhEbRBCo+IdazyMrZuVtXt07 sB5fjLYGHsg6KWCXmFq3HVT0s5Laxnt8dmjuhXo= X-Google-Smtp-Source: AIpwx4/vP0eICx24A7bo1RLkv0Uv8wawieEFCWBPjJfY1JQGjSf3Bp83LDBPyWXUrol/qaKbL2VLZy833DgPYJ1Hx0g= X-Received: by 10.98.245.7 with SMTP id n7mr24189536pfh.164.1523134332612; Sat, 07 Apr 2018 13:52:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Reply-To: dank@kegel.com From: Dan Kegel Date: Sat, 07 Apr 2018 20:52:00 -0000 Message-ID: Subject: Re: Floating point exception in strtod() To: cygwin@cygwin.com Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-04/txt/msg00056.txt.bz2 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 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, &ptr); > > /* If there was an exception, the following will not get executed. */ > printf ("No exception.\n"); > } > > $ gcc strtod_test.c > > $ ./a > Floating point exception (core dumped) > > [The above was on x86. On x86_64 there's simply no output.] > > I have no idea what's special about the number 121645100408832000.0, but > the problem goes away if, for example, I replace the leading 1 by 2. > > Ken > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > > > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple