Another take on decimal data types
kdevel
kdevel at vogtner.de
Thu Jan 11 23:57:29 UTC 2018
On Thursday, 11 January 2018 at 22:36:40 UTC, rumbu wrote:
> 1000
> 100
> 10
> 1
> 0.1
> 0.01
> 0.001
> 0.0001
> 1e-05
>
> Regarding printf, I cannot help, this is a C function, has
> nothing to do with D formatting.
Sure. What about the failed comparison:
gt.d
```
import std.stdio;
import decimal;
void loopme(T) ()
{
"---".writeln;
T e = 10;
while (e > 1e-6) {
e /= 10;
writeln (e, ' ', e > 1e-6);
}
}
void main ()
{
loopme!decimal32;
loopme!decimal64;
loopme!decimal128;
}
```
This gives here:
---
1 true
0.1 false
---
1 true
0.1 false
---
1 true
0.1 true
0.0100000 true
0.00100000 true
0.000100000 true
1.00000e-05 true
1.00000e-06 true
1.00000e-07 false
More information about the Digitalmars-d-announce
mailing list