what happens when "real" == "double"
Benjamin Shropshire
ao at pathlink.com
Mon Jan 29 15:13:09 PST 2007
real is defined as the largest hardware supported FP type. How should a program
determine if real provides more precision than double?
option:
is(real == double)
real.sizeof == double.sizeof
real.epsilon == double.epsilon
other.
Relevance Example:
normalizing a vector of doubles while avoiding rounding can be done using
this code, but only if real is larger than double.
double x,y,z;
real sum = x*x + y*y + z*z;
sum = sqrt(sum);
x /= sum;
y /= sum;
z /= sum;
However, if real == double, somthing else must be done.
More information about the Digitalmars-d-learn
mailing list