Skip to content

Commit ca7e438

Browse files
committed
Merge #342
342: rational: check for NaN when approximating floats r=cuviper a=cuviper 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.
2 parents a203e9f + b67f1bd commit ca7e438

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rational/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ fn approximate_float_unsigned<T, F>(val: F, max_error: F, max_iterations: usize)
774774
// Continued fractions algorithm
775775
// http://mathforum.org/dr.math/faq/faq.fractions.html#decfrac
776776

777-
if val < F::zero() {
777+
if val < F::zero() || val.is_nan() {
778778
return None;
779779
}
780780

0 commit comments

Comments
 (0)