I think what is happening here is that the default (compiler rather than and therefore perl) FP exception handling mode is "No exceptions". So, any time a #SNaN value is loaded (or generated) in an XMM register, it is silently converted (SNaN | 0008000000000000H )to a #QNaN by the FPU.

But, do not take my word for it; this (FP exception handling) has to be one of the most confusing areas of modern computing. Part of the problem is that once you move away from the old x87/MMX registers to the SSE2/3/4/5/AVX et. al; where anything from 2 to 8 floating point computations are being carried out in parallel, compliance with the IEEE754 exception handling rules -- conceived long before SIMD instruction sets became the norm -- becomes very problematic.

Specifically, the requirement that user exception handlers be provided with the excepting value. Reasonably simple when each FP op produces in one result; much harder when you have 2, 4 or 8 operations being performed and none, some or all could results in an exceptional value. Basically, Intel's (and AMD's) manuals suggest that if compiler writers want to provide FP exception handling and full IEEE compliance, then they would need to provide floating point emulation in the exception handler in order to reproduce the excepting value(s):

E.4.1 Floating-Point Emulation

Every operating system must provide a kernel level floating-point exception handler (a template was presented in Section E.2, “Software Exception Handling” above). In the following discussion, assume that a user mode floating-point exception filter is supplied for SIMD floating-point exceptions (for example as part of a library of C functions), that a user program can invoke in order to handle unmasked exceptions. The user mode floating-point exception filter (not shown here) has to be able to emulate the subset of SSE/SSE2/SSE3 instructions that can generate numeric exceptions, and has to be able to invoke a user provided floating-point exception handler for floating-point exceptions. When a floating-point exception that is not masked is raised by an SSE/SSE2/SSE3 instruction, the low-level floating-point exception handler will be called. This low-level handler may in turn call the user mode floating-point exception filter. The filter function receives the original operands of the excepting instruction as no results are provided by the hardware, whether a pre-computation or a post-computation exception has occurred.

For the full skinny -- but be warned, it makes the 'What Every Computer Scientist Should Know About Floating-Point Arithmetic' paper look like a Donald Trump sound-bite; and about as useful -- see (pdf)Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1:Basic Architecture; Appendices: C & E

And I welcome your correction of my interpretation. :)


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.

In reply to Re: unintentional conversion of signaling NaN to quiet NaN by BrowserUk
in thread unintentional conversion of signaling NaN to quiet NaN by pryrt

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.