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" | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Shropshire Attachments: | 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
|
Copyright © 1999-2021 by the D Language Foundation