public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: cygwin-apps@cygwin.com
Subject: Re: Dodgy functions (finitel, strold)
Date: Fri, 01 Apr 2016 19:04:00 -0000	[thread overview]
Message-ID: <87mvpdw3p1.fsf@Rainer.invalid> (raw)
In-Reply-To: <CAJ1FpuO8p2NNERWzXWuahiz91_27_TA3RUP=xJ=UzZZVY1YZVw@mail.gmail.com>	(Doug Henderson's message of "Fri, 25 Mar 2016 18:16:13 -0600")

Doug Henderson writes:
> I modified your program to display the actual hex value of the a, b,
> and c variables. The b and c variables have different bit patterns. It
> appears that the %a format conversion is (correctly) detecting ±inf
> and NaN according to IEEE 754, and ignoring the value of all other
> bits in the variables.

I wasn't concerned about the bit patterns, but the fact that +-Inf was
recognized as valid input, but then converted to NaN.

> It appears that strtold and the implicit conversion from double to
> long double are setting some of the bits which are not used to
> represent NaN or ±Inf to different values.
>
> It appears that some of the different functions that get used to
> detect finiteness and validity are sensitive to the setting of other
> bits in the values, or are expecting particular values for these bits.

That would be a bug.  The standard defines all the valid bit patterns
for each case, so if in doubt you could exhaustively test them.

> The standard supports two representations of NaN: a signalling NaN and
> a non-signalling NaN. From what I could see, the C language does not
> distinguish between the two NaN representations, but I did not look at
> the standards docs.

You can mostly ignore that distinction unless the runtime exposes it to
you.  In a nutshell, the difference is between silently producing and
then using the NaN in further computation or raising an exception.  In
the latter case, the runtime would need to give you a way to catch and
handle the exception.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

  parent reply	other threads:[~2016-04-01 19:04 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <announce.20160318203409.GA11113@calimero.vinschen.de>
     [not found] ` <56EC6BDA.7050505@cornell.edu>
2016-03-18 21:45   ` [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.5.0-0.8 Corinna Vinschen
2016-03-18 22:25     ` Ken Brown
2016-03-18 22:40       ` Ken Brown
2016-03-18 23:05       ` Yaakov Selkowitz
2016-03-18 23:29         ` Yaakov Selkowitz
2016-03-19  2:24           ` Ken Brown
2016-03-19 10:32             ` Corinna Vinschen
2016-03-19 12:34               ` Ken Brown
2016-03-19 18:03                 ` Ken Brown
2016-03-20 15:26                   ` Corinna Vinschen
2016-03-20 19:27                     ` Ken Brown
2016-03-20 19:40                       ` Ken Brown
2016-03-20 20:18                       ` Ken Brown
2016-03-20 20:47                       ` Yaakov Selkowitz
2016-03-21 14:13                         ` Ken Brown
2016-03-21 16:30                           ` Corinna Vinschen
2016-03-21 17:59                             ` Ken Brown
2016-03-22 11:15                               ` Corinna Vinschen
2016-03-22 14:59                                 ` Ken Brown
2016-03-30 21:17                                   ` Corinna Vinschen
2016-03-31 11:55                                     ` Ken Brown
2016-03-20  4:50               ` Yaakov Selkowitz
2016-03-20 15:18                 ` Corinna Vinschen
2016-03-20 10:59     ` Achim Gratz
2016-03-20 11:14       ` Marco Atzeri
2016-03-20 15:25       ` Corinna Vinschen
2016-03-20 19:27         ` Achim Gratz
2016-03-20 20:53           ` Corinna Vinschen
2016-03-20 21:30             ` Corinna Vinschen
2016-03-20 20:24         ` Achim Gratz
2016-03-20 20:45           ` Yaakov Selkowitz
2016-03-22  9:31             ` Achim Gratz
2016-03-25  9:00             ` Dodgy functions (was: [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.5.0-0.8) Achim Gratz
2016-03-26  0:16               ` Dodgy functions Achim Gratz
2016-03-26 19:41                 ` Dodgy functions (finitel, strold) Achim Gratz
2016-03-29 16:09                   ` Doug Henderson
2016-03-29 16:09                     ` Corinna Vinschen
2016-04-01 19:04                     ` Achim Gratz [this message]
2016-03-22 17:43     ` [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.5.0-0.8 Chris Sutcliffe
2016-03-22 18:02       ` Corinna Vinschen

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=87mvpdw3p1.fsf@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=cygwin-apps@cygwin.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).