Skip to content

Commit e924310

Browse files
committed
Add test coverage for infinite inputs
1 parent 5902f08 commit e924310

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/float.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2434,7 +2434,7 @@ mod tests {
24342434
let deviation = recovered_input - input;
24352435

24362436
assert!(
2437-
deviation.abs() < $tolerance,
2437+
recovered_input == input || deviation.abs() < $tolerance,
24382438
"failed to recover input of `Float::integer_decode({0:e})`
24392439
\t expected: ~ {:e}
24402440
\t found: {:e}
@@ -2469,6 +2469,7 @@ mod tests {
24692469
check(sign_f * 5____f32, 0xa00000, -21, sign);
24702470
check(sign_f * 42___f32, 0xa80000, -18, sign);
24712471
check(sign_f * f32::MAX, 0xffffff, 104, sign);
2472+
check(sign_f * f32::INFINITY, 0x800000, 105, sign);
24722473
}
24732474
}
24742475

@@ -2492,6 +2493,7 @@ mod tests {
24922493
check(sign_f * 5____f64, 0x14000000000000, -50, sign);
24932494
check(sign_f * 42___f64, 0x15000000000000, -47, sign);
24942495
check(sign_f * f64::MAX, 0x1fffffffffffff, 971, sign);
2496+
check(sign_f * f64::INFINITY, 0x10000000000000, 972, sign);
24952497
}
24962498
}
24972499

0 commit comments

Comments
 (0)