floating point constants

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jul 29 05:41:41 AEST 1989


In article <660047 at hpclwjm.HP.COM> walter at hpclwjm.HP.COM (Walter Murray) writes:
>Under ANSI C, I think it's clear that the following program is
>valid, and prints the value 1.
>main() { printf("%d\n", 2.0||1.0/0.0); }

I think that's right.  (I remember the discussion but not the outcome!)
But if there is a division by zero in a context where a constant-expression
is required (e.g. array bound) then I think it's a compile-time violation.

Really, I hope people don't try to write applications that depend on
divide-by-zero behavior.  They're just asking for the trouble that
they'll undoubtedly eventually get.



More information about the Comp.lang.c mailing list