On 29 November 2010 16:38, Nathan Froyd <froy...@codesourcery.com> wrote: >> +static int float32_is_any_nan(float32 x) >> +{ >> + return ((float32_val(x) & ~(1 << 31)) > 0x7f800000UL); >> +} >> + >> +static int float64_is_any_nan(float64 x) >> +{ >> + return ((float64_val(x) & ~(1ULL << 63)) > 0x7ff0000000000000ULL); >> +} > > Why not just use: > > static int float32_is_any_nan(float32 x) > { > return float32_is_nan(x) || float32_is_signaling_nan(x); > } > > and likewise for the 64-bit case?
That was what my first-pass patches did, but I rewrote them this way because it seemed more straightforward to just test for "is this a NaN" rather than calling two other functions which each test for "is this some subset of NaN space". I suppose you could argue that softfloat ought to have _is_nan() [with the semantics you'd expect from the function name, not the ones it currently has!], _is_signalling_nan() and _is_quiet_nan() functions built in, but it doesn't... -- PMM