More instantiation problems under hpux
Gabriel Dos Reis
gdr@codesourcery.com
Wed Jan 16 23:31:00 GMT 2002
Loren James Rittle <rittle@latour.rsch.comm.mot.com> writes:
| Dave thanks for the comments and confirmation of analysis.
|
| If a float, double, or long double (you will understand why
| I ask this last part when you get the patch) has the value
| Inf, will the expression (value > FLT_MAX, DBL_MAX, LDBL_MAX)
| (ignore that I will really use the C++ capture of those values
| since they have already taken pains to handle the problem
| of which C header has the right value, etc)
|
| compute as expected? Here is one concrete example:
|
| double __d = Inf; // Inf is a place holder for any way to create an Inf
|
| bool __b = (__d > DBL_MAX) || (__d < -DBL_MAX); // Must handle -Inf, which
| // is supported by IEEE
| // and others (?)
|
| Is __b true for all FP implementations that you know about?
That is true at least on SPARCs, and I guess on all machines
implementing IEEE since for finite numbers and infinities, comparaison
is the same as comparaison of integer types (when the bits are
interpreted adequately) in the format sign-magnitude.
However, in general, it is incorrect to use
d > DBL_MAX || d < DBL_MAX
to see whether d is an infinity: In case it is a NaN, that may cause
a trap or an exception, especially on IEEE-conforming machines.
| I think I trust ininf, finite, etc better than any one-liner I write.
True.
-- Gaby
More information about the Libstdc++
mailing list