weird behavior for machine epsilon in float, double and real
bearophile
bearophileHUGS at lycos.com
Sat Apr 11 01:32:21 PDT 2009
Andrew Spott:
> import std.stdio;
> [...]
This is the same code of yours, a bit refactored:
import std.stdio: writefln;
template Tuple(T...) { alias T Tuple; }
void computeEpsilon(T)() {
T ep = 1;
T n = 1;
while ((ep + n) != n)
ep /= 2;
writefln("%.30f type: %s", ep, typeid(T));
}
void main() {
foreach (T; Tuple!(float, double, real))
computeEpsilon!(T)();
}
Bye,
bearophile
More information about the Digitalmars-d
mailing list