Skip to content

Commit 754bbd6

Browse files
committed
Add test note about NaN values
1 parent 53aa590 commit 754bbd6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/float/add.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ mod test {
202202
use qc::{U32, U64};
203203
use float::Float;
204204

205+
// NOTE The tests below have special handing for NaN values.
206+
// Because NaN != NaN, the floating-point representations must be used
207+
// Because there are many diffferent values of NaN, and the implementation
208+
// doesn't care about calculating the 'correct' one, if both values are NaN
209+
// the values are considered equivalent.
210+
205211
// TODO: Add F32/F64 to qc so that they print the right values (at the very least)
206212
quickcheck! {
207213
fn addsf3(a: U32, b: U32) -> bool {
@@ -305,14 +311,12 @@ mod test {
305311
#[test]
306312
fn test_float_nan() {
307313
let r = super::__addsf3(f32::NAN, 1.23);
308-
// Need .repr() since NAN != NAN
309314
assert_eq!(r.repr(), f32::NAN.repr());
310315
}
311316

312317
#[test]
313318
fn test_double_nan() {
314319
let r = super::__adddf3(f64::NAN, 1.23);
315-
// Need .repr() since NAN != NAN
316320
assert_eq!(r.repr(), f64::NAN.repr());
317321
}
318322

0 commit comments

Comments
 (0)