What is permissable with HUGE_VAL

Doug Gwyn gwyn at smoke.BRL.MIL
Sun Jul 15 06:36:31 AEST 1990


In article <1990Jul14.194550.14850 at dinorah.wustl.edu> art at dinorah.wustl.edu (Arthur B. Smith) writes:
>  flag_val = HUGE_VAL;	    /* Question 1: Is this legal? */
>  odd_val = flag_val / 2.0; /* Question 4: Is this legal? */
>  if (odd_val < HUGE_VAL)
>    puts("Question 5a: Is this guaranteed to print?");
>My guesses are:
>5a) No

That could happen only if HUGE_VAL were defined as an "infinity".
A footnote in the standard claims that that is in fact allowed.
Unfortunately floating-point numbers are not required by the standard
to act sensibly, except in a few cases where they are constrained
very tightly.  This is inconsistent, but you can thank IEEE 754/854
for it.



More information about the Comp.std.c mailing list