Skip to content

[Rust] incorrect comparison with f64::NAN #895

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
alazarev-io opened this issue May 20, 2022 · 1 comment
Closed

[Rust] incorrect comparison with f64::NAN #895

alazarev-io opened this issue May 20, 2022 · 1 comment

Comments

@alazarev-io
Copy link

The generator produces for the optional double the following code:

    if value == f64::NAN {
        None
    } else {
        Some(value)
    }

But the comparison if value == f64::NAN is always false, it needs to use if value.is_nan() instead.

@mjpt777
Copy link
Contributor

mjpt777 commented May 24, 2022

@mward can you pick this up?

mward pushed a commit to mward/simple-binary-encoding that referenced this issue May 24, 2022
mjpt777 pushed a commit that referenced this issue May 24, 2022
Co-authored-by: Michael Ward <mward@drw.com>
@mjpt777 mjpt777 closed this as completed May 24, 2022
mward pushed a commit to mward/simple-binary-encoding that referenced this issue May 25, 2022
mjpt777 pushed a commit that referenced this issue May 26, 2022
* [Rust] fix generated comparison when value is NAN (#895)

* [Rust] added test for issue #895

Co-authored-by: Michael Ward <mward@drw.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants