Thread overview
[Issue 17324] Floating point 1/(1/x) > 0 if x > 0 not generally true
May 09, 2017
Don
May 09, 2017
Don
Jul 15, 2022
Dlang Bot
Jul 15, 2022
Dlang Bot
May 09, 2017
https://issues.dlang.org/show_bug.cgi?id=17324

--- Comment #1 from Don <clugdbug@yahoo.com.au> ---
Right, it's a bit sloppy, I'm treating +0.0 as "> 0".
The wording should actually be something like:

identities such as: x and 1/(1/x) always have the same sign bit.

(The point is that you can take the reciprocal without destroying the sign
bit).


>  assert(1/y > 0); // fails

That's because y is +infinity, so the result is +0.0.


>    assert(1/(1/x) > 0); // passes due to wrong optimuzation

That's not a problem, the compiler was able to avoid creating a spurious NaN. It's allowed to use arbitrary intermediate precision.

--
May 09, 2017
https://issues.dlang.org/show_bug.cgi?id=17324

Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|dmd                         |dlang.org

--
July 15, 2022
https://issues.dlang.org/show_bug.cgi?id=17324

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Dlang Bot <dlang-bot@dlang.rocks> ---
@RazvanN7 created dlang/dlang.org pull request #3342 "Fix Issue 17324 - Floating point 1/(1/x) > 0 if x > 0 not generally true" fixing this issue:

- Fix Issue 17324 - Floating point 1/(1/x) > 0 if x > 0 not generally true

https://github.com/dlang/dlang.org/pull/3342

--
July 15, 2022
https://issues.dlang.org/show_bug.cgi?id=17324

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dlang.org pull request #3342 "Fix Issue 17324 - Floating point 1/(1/x) > 0 if x > 0 not generally true" was merged into master:

- dc1295bbe6111c0e21155252695d59923f93cceb by Razvan Nitu:
  Fix Issue 17324 - Floating point 1/(1/x) > 0 if x > 0 not generally true

https://github.com/dlang/dlang.org/pull/3342

--