[Issue 20283] New: CustomFloat.max_exp not working in some cases

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 8 15:15:49 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20283

          Issue ID: 20283
           Summary: CustomFloat.max_exp not working in some cases
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at d-ecke.de

CustomFloat!(2, 6, CustomFloatFlags.nan).max_exp == 2^^5+1 but should be 2^^5.

The bias is 2^^(|6|-1)-1=31. The last -1, because nans are available. I derived
this from how std.numeric defines the bias. (I don't know any external
definition for numbers that do not comply to IEEE.) The maximum exponent is
0b111110=62, because 0b111111 is needed for nan. Therefore the maximum exponent
of 2, that can be represented is 2^(62-31)=2^31. Therefore max_exp should be
32.

--


More information about the Digitalmars-d-bugs mailing list