[PATCH]: PR29335 use MPFR for builtins fma, fmin and fmax
Paolo Bonzini
paolo.bonzini@lu.unisi.ch
Fri Nov 10 10:56:00 GMT 2006
> 'If just one argument is NaN, the fmax functions return the other
> argument (if both
> arguments are NaNs, the functions return NaN).
>
> The body of the fmax function might be
> { return (isgreater (x, y) || isnan(y)) ? x : y; }
> "
>
> but I agree that the one-argument NaN thing is stupid and not what would be
> usually expected.
Yeah, NaN propagation would be the expected behavior in that case! And
Java got it right, actually: grep for min(float or max(float in
libjava/java/lang/Math.java.
> In a footnote it says
>
> "Ideally, fmax would be sensitive to the sign of zero, for example
> fmax (-0.0, 0.0)
> would return 0; however, implementation in software might be impractical."
<ironic>
They mean, as impractical as "a == b ? a & b : (a > b ? a : b)" (I
really mean & as bitwise AND)? Or likewise, "a == b ? a | b : (a < b ?
a : b)" for fmin?
</ironic>
Java BTW also got this right, though they have no &/| on float and they
resort to a special case for a == 0 && b == 0.
Paolo
More information about the Gcc-patches
mailing list