Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 73d8eecfaac0e7b173bef5f862ac80b04bc1aa83
Ticket: 3105247fffffffffffffffffffffffffffffffff
-NaN?
User & Date: kennykb on 2010-12-17 23:37:38
Changes

  1. icomment:
    Putting signalling-NaN detection into [binary scan] is starting to get awfully far afield of the original problem.
    
    Note that the standard that you quote mentions NaN (with an optional preceding sign) - so the original complaint about -NaN was complaining about standard-compliant behavior.
    
    In practice, what happens in the implementation is that the 'invalid' exception is signalled and masked. (You need to read the description of exception masking as well.) Masking some of the IEEE-754 exceptions is routine - in fact, I can hardly imagine what good could ever come of unmasking 'inexact'. It's pretty routine to mask exponent underflow and total-loss-of-significance, and not uncommon to mask the others.
    
    In any case, the case that I'm most worried about is the original reporter's use case, where the offending NaN came from Tcl_NewDoubleObj or Tcl_SetDoubleObj. Since those contexts don't have an interpreter in which to signal, we have to do *something* with them, and the choices appear to be to mutate the value, to crash the process, or to make Tcl's entire floating-point pipeline sNaN-tolerant. None of these is ideal. I've quoted Gene Golub in the past on his observation that these events are called 'exceptions' because, no matter what action is chosen, someone will take exception with it.
    
    
  2. login: "kennykb"
  3. mimetype: "text/plain"
  4. username: "kennykb"