Bug 20396 – format!"%a" leeds to wrong result for denormalized float
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-11-15T20:01:55Z
Last change time
2019-12-06T23:25:14Z
Keywords
pull
Assigned to
No Owner
Creator
berni44
Comments
Comment #0 by bugzilla — 2019-11-15T20:01:55Z
void main()
{
import std.stdio;
import std.math;
writefln!"%a"(nextUp(0.0f));
writefln!"%a"(nextUp(0.0));
}
Leeds on my computer to
0x1p-149
0x0.0000000000001p-1022
The first one should be 0x0.000002p-126. The second one shows, that doubles work correctly (and reals work on my computer too).
This bug is located inside C's snprintf.
Comment #1 by dlang-bot — 2019-11-17T20:30:40Z
@berni44 created dlang/phobos pull request #7285 "Partial replace call to snprintf for '%a' and float or double." fixing this issue:
- Fix Issue 20396 - format!"%a" leeds to wrong result for denormalized float
https://github.com/dlang/phobos/pull/7285
Comment #2 by dlang-bot — 2019-12-06T23:25:14Z
dlang/phobos pull request #7285 "Partial replace call to snprintf for '%a' and float or double." was merged into master:
- e084f5eb3325e1965649e07bbe8cc2b726f88b20 by Bernhard Seckinger:
Fix Issue 20396 - format!"%a" leeds to wrong result for denormalized float
https://github.com/dlang/phobos/pull/7285