reem / rust-ordered-float

MIT License
221 stars 64 forks source link

Div by zero produces NotNan(inf) #148

Closed woojiq closed 6 months ago

woojiq commented 6 months ago

Iiuc it is not expected behavior, is it? I'd expect a panic/result or checked_div function in the library.

#[test]
#[should_panic]
fn just_test() {
    let r = NotNan::new(1.).unwrap() / NotNan::new(0.).unwrap();
    println!("{r:?}");
}
running 1 test
test just_test - should panic ... FAILED

failures:

---- just_test stdout ----
NotNan(inf)
note: test did not panic as expected

Similar issues: #17, #32

woojiq commented 6 months ago

Ah, I guess I need to learn more about Nan and infinity first :)