
Boost : 
From: Geoffrey Irving (irving_at_[hidden])
Date: 20060516 02:45:32
On Mon, May 15, 2006 at 11:18:08PM 0700, Robert Ramey wrote:
> Jeff Garland wrote:
>
> <snip
>
> >> A program which produces an undefined result is "broke"
> >
> > I guess all of 'math' is broken then too? The only way to deal with
> > singularities in math is to effectively 'bailout'  say, well don't
> > do that.
>
> That's how math works  I think C++ should work the same way.
Sorry for the short rant:
Saying that 1/0 means bail out is "how math works" is missing the point.
The real number line, plus infinities, plus NaN, is one of the simplest
extensions of the real numbers which is closed under the basic arithmetic
operators. The idea of adding positive and negative infinities to the
real line is hundreds of years old. Arguing that 1/0 should crash because
that's what happens in "math" is the same as arguing that 2*max_int should
crash because that's what happens in math...unless you have modulo
arithmetic.
As for the original topic, I very much like the proposal to have +inf
and NaN as the only special values.
Geoffrey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk