HUGE_VAL and friends

Wendy Thrash wendyt at pyrps5
Thu Mar 23 17:25:56 AEST 1989


Because I have to supply a math.h and float.h that work for three different
floating-point formats on otherwise compatible machines, I'd like very much
to make HUGE_VAL and its friends (DBL_MAX, FLT_EPSILON, etc.) expand as
function calls (to things like __huge_val(), __dbl_max(), etc.)

Questions:
1) Does this violate the letter of the standard?
2) Does this violate the spirit of the standard?
3) Has all this been discussed already, so I'm an idiot for not remembering?

The (Dec. 7 draft) standard allows these things to be general double
expressions, so it's hard to see a violation of the letter of the standard.
The rationale says that "the Committee decided to generalize HUGE_VAL to
a positive double expression, so that it could be expressed as an external
identifier naming a location initialized precisely with the proper bit
pattern."  This makes me wonder whether my calls violate the spirit
of the standard, at least with respect to HUGE_VAL.  It seems, BTW, that an
implementation of HUGE_VAL as an external identifier would allow the user
to redefine it on the fly, for instance
	HUGE_VAL = 42.;
Must I allow this?  (I certainly hope not.)



More information about the Comp.std.c mailing list