Boost logo

Boost :

From: Andras Erdei (aerdei_at_[hidden])
Date: 2004-12-12 19:19:49


On Sun, 12 Dec 2004 17:53:08 +0000 (UTC), Mickey Moore <mgmoore_at_[hidden]> wrote:

>I will agree that it's much less obvious when you will get into trouble, since
>the numbers were of modest magnitude -- though still greater than sqrt(32768)
>which is a (very rough) indication of potential trouble.

this can be misleading: yes, you can add two rational<short>s
together if all their nums and dens are smaller than 181 (a
sufficient but not necessary condition); but to be able to
add the results of two additions, the limit goes down to 13,
then to 3, then to 1

>In this case the obvious solution is rational<long>

with long calculating the limits this way you get 46340, 215,
14, 3, 1 -- even in a very simple program containing a few
operators the arguments can only safely have the values zero
and one...

br,
andras


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