Thread overview
[Issue 20261] CustomFloat.epsilon yields infinity
[Issue 20261] CustromFloat.epsilon yields infinity
Oct 02, 2019
Berni
Oct 09, 2019
berni44
Oct 09, 2019
berni44
Oct 17, 2019
Dlang Bot
Oct 25, 2019
Dlang Bot
October 02, 2019
https://issues.dlang.org/show_bug.cgi?id=20261

--- Comment #1 from Berni <dlang@croco-puzzle.com> ---
What I wrote about the general case is wrong. Sorry.

--
October 09, 2019
https://issues.dlang.org/show_bug.cgi?id=20261

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@d-ecke.de

--- Comment #2 from berni44 <bugzilla@d-ecke.de> ---
Meanwhile I found out, that .epsilon can be really snappish. In some cases it can only be displayed as denormalized value. If denormalized values are not supported, epsilon cannot be represented at all.

For me, the question arises, what to do in such cases.

a) Just not define .epsilon for these types? Might be hard to implement.
b) Use NaN? But what, if NaN is not available?
c) Use the smallest value greater 0 instead? In rare cases, even this value
might not exist. CustomFloat(7,1,CustomFloatFlags.allowDenormZeroOnly |
CustomFloatFlags.nan). Here only +/- 0 and NaN exists.
d) Use 1+epsilon - 1. This leaves the answer to this question to the routine
converting real to CustomFloat. But in some cases 1+epsilon does not exist too,
see above. But if it exists, it's much simpler to construct than epsilon
itself.
e) Use return type real? I expect some other trouble with that approach.

I tend to d) + completely prohibiting types, where this doesn't work. These are stange types that are of no use anyway.

--
October 09, 2019
https://issues.dlang.org/show_bug.cgi?id=20261

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|CustromFloat.epsilon yields |CustomFloat.epsilon yields
                   |infinity                    |infinity

--
October 17, 2019
https://issues.dlang.org/show_bug.cgi?id=20261

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

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

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@berni44 created dlang/phobos pull request #7238 "Fix Issue 20261 - CustomFloat.epsilon yields infinity" fixing this issue:

- Fix Issue 20261 - CustomFloat.epsilon yields infinity

https://github.com/dlang/phobos/pull/7238

--
October 25, 2019
https://issues.dlang.org/show_bug.cgi?id=20261

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

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

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/phobos pull request #7238 "Fix Issue 20261 - CustomFloat.epsilon yields infinity" was merged into master:

- 4e81fe0ce6f39ef76041c09f65839983079ad9d5 by Bernhard Seckinger:
  Fix Issue 20261 - CustomFloat.epsilon yields infinity

https://github.com/dlang/phobos/pull/7238

--