Newsgroups: comp.std.c Path: utzoo!utgpu!watserv1!watmath!rbutterworth From: rbutterworth@watmath.waterloo.edu (Ray Butterworth) Subject: Re: What is permissable with HUGE_VAL Message-ID: <1990Jul19.204933.18891@watmath.waterloo.edu> Keywords: assignment, comparison, arithmetic on HUGE_VAL Organization: Math Faculty Computing Facility, University of Waterloo References: <1990Jul14.194550.14850@dinorah.wustl.edu> Date: Thu, 19 Jul 90 20:49:33 GMT Lines: 28 If I remember the discussion about this from a year or two ago, there was nothing in the standard indicating what HUGE_VAL needed to be, other than positive. i.e. there is no reason (other than the obvious sillyness) that an implementation can't define HUGE_VAL as 5.2. If you think no one would be silly, consider the BSD definition of HUGE in their : #define VALUE (4.15383748682786205e34 * 4096) /* from */ #define HUGE 1.701411733192644270e38 main() { auto double huge = HUGE; auto double value = VALUE; if (value > huge) printf("value is bigger than huge\n"); if (value < huge) printf("value is less than huge\n"); } Because of the nature of floating point it wouldn't be unreasonable for both conditions to evaluate true, but in this case only the first prints. And if you look at the bits in the two variables you'll see that value really is bigger than huge.