Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!bu.edu!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.std.c Subject: Re: What is permissable with HUGE_VAL Keywords: assignment, comparison, arithmetic on HUGE_VAL Message-ID: <13352@smoke.BRL.MIL> Date: 14 Jul 90 20:36:31 GMT References: <1990Jul14.194550.14850@dinorah.wustl.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 14 In article <1990Jul14.194550.14850@dinorah.wustl.edu> art@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.