rational: check for NaN when approximating floats

We had a test for NaN already, but thanks to undefined casts (#119) it
was only passing by luck -- on armv7hl it failed:

     https://bugzilla.redhat.com/show_bug.cgi?id=1511187

Now we check for NaN explicitly.
This commit is contained in:
Josh Stone 2017-11-08 14:09:05 -08:00
parent a203e9f9fc
commit b67f1bd6d6
1 changed files with 1 additions and 1 deletions

View File

@ -774,7 +774,7 @@ fn approximate_float_unsigned<T, F>(val: F, max_error: F, max_iterations: usize)
// Continued fractions algorithm // Continued fractions algorithm
// http://mathforum.org/dr.math/faq/faq.fractions.html#decfrac // http://mathforum.org/dr.math/faq/faq.fractions.html#decfrac
if val < F::zero() { if val < F::zero() || val.is_nan() {
return None; return None;
} }