At about the time of 9/18/2005 11:48 PM, Barry Schwarz stated the following:
sqrt doesn't convert anything, let alone double to long long. sqrt
returns a double. sqrtl returns a long double.
The code in question is this:
rstats.tavg = acc1 / count;
rstats.tvar = (acc2 / count) - (rstats.tavg * rstats.tavg);
rstats.tdev = sqrt(rstats.tvar);
This code takes values that were collected earlier and computes average,
variance, and standard deviation. The acc1 and acc2 variables are
defined as uint64 (unsigned long long int) while everything else is
defined as a ldfloat (long double). I do need a square root function,
but I used sqrt as a place holder until I can find the sqrt function
that I really need. I do thank you for telling me that sqrtl returns a
long double.
The fact that it is a counter only matters if you are counting things
in excess of 2+ billion. Possible if you are working with stars in
galaxies or grains of sand but why do you think the bit size matters?
It probably doesn't, but I threw those numbers in there anyways. The
real questions were how to convert a unsigned long long int to a long
double, and if there was a sqrt function that returned a long double.