Boost logo

Boost :

From: Moore, Paul (paul.moore_at_[hidden])
Date: 2000-11-20 11:44:34


From: Jeff Paquette [mailto:paquette_at_[hidden]]
> PMFJI, but did anyone else notice the fix went from
> (stylistic arguments aside):
>
> if (den == 0)
>
> to
>
> if (r.num == 0)
> ?
>
> Shouldn't the correct fix be:
> if (r.den == 0) throw bad_rational()

The original fix calculated the new denominator (den) and then checked if it
was zero. My fix checked the numerator of the rational being divided BY, and
raise an error if it is zero. In other words, I am checking if I am going to
divide by zero, whereas the original check effectively did the divide and
then checked whether the result was invalid (zero denominator).

But thanks for asking!

Hope this helps,
Paul.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk