Closed FreezyLemon closed 3 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 89.49%. Comparing base (
44ccdb9
) to head (180b3fa
). Report is 8 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The purpose it was added seems clear and no longer relevant. This means all cases of negative zero will likely be handled as if they were positive zero since we seem to only use
contains
orsignum
instead of checking sign bit.
Is adding some negative 0 test cases needed here? It would ensure that behavior that checks the sign bit is consistent. Or is there an alternative way to remember and enforce this decision against checking sign bit for zero values?
Hm.. on revisit, I think I missed something fairly trivial, don't ask me how.
is_zero(-0.0)
does return true, not false like I said above. I came to a wrong conclusion while I was looking at the code and didn't test it afterwards. Sorry for that.
Anyways,
Is adding some negative 0 test cases needed here?
I think that my mistake above changes the context a bit. It's probably not necessary to test this...?
Or is there an alternative way to remember and enforce this decision against checking sign bit for zero values?
How often does statrs
use bitwise operators or otherwise check the contents of specific bits of numbers? AFAICT, it's usually just "normal" number operators/functions. I guess some dependencies do this (as seen in the ulps_eq
macro), but it should probably be assumed these are correct, right?
turns into
which turns into
The actual code is not quite as clear as this, it took me a few minutes to find the relevant places and shorten it to this.
is_zero
was introduced in order to silence clippy warnings/errors and was a 1:1 replacement forx == 0.0
.I would argue that
is_zero
is unnecessarily complicated, not transparent and possibly incorrect (one example:0.0
==-0.0
evaluates totrue
whileis_zero(-0.0)
will evaluate tofalse
) and was not the right solution to the clippy warnings in the first place.