Consider the following program:
void main
{
import std.stdio;
import std.math;
alias S = real;
S f = 0x1.14ada3f2c1d77p-48;
writefln("up: %a", f.nextUp);
writefln("down: %a", f.nextDown);
writefln("f: %a", f);
}
On Windows it prints the same number.
```
up: 0x1.14ada3f2c1d77p-48
down: 0x1.14ada3f2c1d77p-48
f: 0x1.14ada3f2c1d77p-48
```
On Linux for 32-bit as well as 64-bit it prints the expected result:
```
up: 0x8.a56d1f960ebb801p-51
down: 0x8.a56d1f960ebb7ffp-51
f: 0x8.a56d1f960ebb8p-51
```
If I digged correctly, core.stdc.stdio.fwrite is used under the hood of std.format (and thus writef). Unfortunately I don't have a Windows machine to test this further.
From the documentation for '%a':
> If there is no Precision, as many hexadecimal digits as necessary to exactly represent the mantissa are generated.
Comment #1 by sprink.noreply — 2016-10-25T03:13:42Z
Windows doesn't have a "real" type, or at least it's standard library doesn't. So if it is using C's write then it is probably using double and not "real" or long double.
Comment #2 by robert.schadek — 2024-12-13T18:49:19Z