Skip to content

Commit

Permalink
Specifically, use float.is_nan() when comparing floats that may have …
Browse files Browse the repository at this point in the history
…NaN values.
  • Loading branch information
Fahad Zubair committed Oct 1, 2024
1 parent 275f997 commit 07d71c9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rust-runtime/aws-smithy-protocol-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,13 @@ fn cbor_values_equal(a: &ciborium::Value, b: &ciborium::Value) -> Result<bool, P
}
},

_ => a == b,
(ciborium::Value::Float(a_float), ciborium::Value::Float(b_float)) => {
a_float == b_float || a_float.is_nan() && b_float.is_nan()
}

_ => {
a == b
}
};

Ok(result)
Expand Down

0 comments on commit 07d71c9

Please sign in to comment.