View mode: basic / threaded / horizontal-split · Log in · Help
January 29, 2007
what happens when "real" == "double"
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.
January 30, 2007
Re: what happens when "real" == "double"
Benjamin Shropshire schrieb am 2007-01-29:
> real is defined as the largest hardware supported FP type. How should a program 
> determine if real provides more precision than double?

Depending of what exactly "precision" is for you:

(real.dig > double.dig)
or 
(real.epsilon < double.epsilon)

Thomas
Top | Discussion index | About this forum | D home