Bug 20283 – CustomFloat.max_exp not working in some cases

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-10-08T15:15:49Z
Last change time
2019-10-20T17:12:40Z
Keywords
pull
Assigned to
No Owner
Creator
berni44

Comments

Comment #0 by bugzilla — 2019-10-08T15:15:49Z
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.
Comment #1 by dlang-bot — 2019-10-17T14:51:09Z
@berni44 created dlang/phobos pull request #7235 "Fix Issue 20283 - CustomFloat.max_exp not working in some cases" fixing this issue: - Fix Issue 20283 - CustomFloat.max_exp not working in some cases https://github.com/dlang/phobos/pull/7235
Comment #2 by dlang-bot — 2019-10-20T17:12:40Z
dlang/phobos pull request #7235 "Fix Issue 20283 - CustomFloat.max_exp not working in some cases" was merged into master: - 5e6b6a5c1aa2c4de1028cb1b700c6c54726efc68 by Bernhard Seckinger: Fix Issue 20283 - CustomFloat.max_exp not working in some cases https://github.com/dlang/phobos/pull/7235