don't NaN & infinities hide FP errors

kartik kartick_vaddadi at yahoo.com
Thu Nov 18 23:41:28 EST 2004


Grant Edwards <grante at visi.com> wrote in message news:<419bbb08$0$531$a1866201 at visi.com>...
> On 2004-11-18, Jeremy Bowers <jerf at jerf.org> wrote:
> Let's say you've got a bunch of process control modules. Each
> of them takes a set of input values and produces a set of
> outputs.
> 
> Now let's say one of the inputs fails (no valid value is
> available).  You can just shut down the whole refinery, you've
> got to try to keep going as best you can.  The easiest way to
> do that is to feed a NaN in on the invalid input, and let it
> propogate through the network of modules.  The outputs that
> don't depend on the invalid input remain valid.  The outputs
> that do depend on the invalid input are NaNs.  
> 
> At the output end of things you don't have to do all sorts of
> logic to figure out which outputs are valid and which ones
> aren't -- all you have to do is decide what to do when each
> output is a NaN.

I understand. But I wasn't saying NaN should be removed, only that
arithmetic operations shouldn't produce it; you will still be free to
explicitly set a variable to NaN if you don't have valid input.

Besides, Python seems to raise exceptions instead of generating NaNs
or infinities, at least on my machine (Linux, GCC 3.3.2, Python
2.3.3). Doesn't that support my view?



More information about the Python-list mailing list