Re: float("nan") in set or as key



On 5/31/2011 7:45 PM, Carl Banks wrote:
Fine, it wasn't "unheard of". I'm pretty sure the existence of a few
high end compiler/hardware combinations that supported traps doesn't
invalidate my basic point. NaN was needed because few systems had a
separate path to deal with exceptional situations like producing or
operating on something that isn't a number. When they did exist few
programmers used them. If floating-point were standardized today it
might not even have NaN (and definitely wouldn't support the
ridiculous NaN != NaN), because all modern systems can be expected to
support exceptions, and modern programmers can be expected to use
them.

Actually, it's the older architectures that support exact floating
point exceptions. x86 does, even in the superscalar and 64 bit variants.
But almost none of the RISC machines have exact floating point exceptions. With all the parallelism inside FPUs today, it takes an
elaborate "retirement unit" to back out everything that happened
after the error and leave the CPU in a clean state. Most RISC
machines don't bother. ARM machines have both IEEE mode and
"run-fast mode"; the latter doesn't support FPU exceptions
but does support NaNs.

Many game machines and GPUs don't have full IEEE floating point.
Some don't have exceptions. Others don't have full INF/NaN semantics.

John Nagle
.



Relevant Pages

  • Re: float("nan") in set or as key
    ... where things like exceptions were unheard of, ... Fortrans didn't also have support for traps. ... calculation traps or returns a NAN. ...
    (comp.lang.python)
  • Re: float("nan") in set or as key
    ... production code has to handle NaN? ... libraries that have half-hearted support for IEEE-754, ... obstruction of people who don't understand the usefulness of NANs. ... shouldn't raise unless the caller specifies that he wants exceptions. ...
    (comp.lang.python)
  • Re: float("nan") in set or as key
    ... specifically talking about NAN == NAN raising an exception rather than ... But given that NaNs propagate in almost the same manner as exceptions, ... complex numbers when necessary probably be inappropriate for a language ... Haskell) have non-strict conditionals. ...
    (comp.lang.python)
  • Re: float("nan") in set or as key
    ... the FPU ever generates a NaN, Python should raise an exception at ... special-case implementation of exceptions, and turn it into a real ... wanted exception-on-NaN behaviour from Python, ... We're talking about floats. ...
    (comp.lang.python)
  • Re: float("nan") in set or as key
    ... when there wasn't even a consistent way to create special values like INF ... either an inf or a NaN value if not trapped. ... The guiding philosophy of Python ... I'm in a minority and that many people will prefer exceptions. ...
    (comp.lang.python)