Re^2: Turbo C 2.0 vs MSC 5.1

Larry Jones scjones at sdrc.UUCP
Sun Aug 13 03:31:35 AEST 1989


In article <1631 at crdgw1.crd.ge.com>, davidsen at sungod.crd.ge.com (ody) writes:
> In article <1989Aug9.094742.20000 at gdt.bath.ac.uk> exspes at gdr.bath.ac.uk (P E Smee) writes:
> 
> | A bad move, I'd have said.  It is not difficult to think of cases where
> | 'a/b/c/d/e' would give a sensible answer, while 'a/(b*c*d*e)' will
> | overflow computing the denominator '(b*c*d*e)' and so give nonsense.
> 
>   Could you give us an example? Looking at the conditions it sure looks
> as though even by avoiding the overflow you would be doing the
> equivalent operations and would get an underflow on one of the divides.

For simplicity, lets consider just a/b/c vs. a/(b*c).  If a and b
are equal and very large (like DBL_MAX, for example) and c is
some small integral value (like 2.0), then a/b/c is a quite
reasonable, representable value (0.5), but a/(b*c) causes an
overflow (since 2.0 * DBL_MAX is not representable).
----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones at SDRC.UU.NET
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150-2789             AT&T: (513) 576-2070
"I have plenty of good sense.  I just choose to ignore it."
-Calvin



More information about the Comp.lang.c mailing list