Displaying 1 result from an estimated 1 matches for "inspect_singleton_sqr".
2014 Mar 26
3
[LLVMdev] [cfe-dev] computing a conservatively rounded square of a double
On 03/26/2014 11:36 AM, Geoffrey Irving wrote:
> I am trying to compute conservative lower and upper bounds for the
> square of a double. I have set the rounding mode to FE_UPWARDS
> elsewhere, so the code is
>
> struct Interval {
> double nlo, hi;
> };
>
> Interval inspect_singleton_sqr(const double x) {
> Interval s;
> s.nlo = x * -x;
> s.hi = x * x;
> return s;
> }
>
> Both multiplies are necessary, since they round in different
> directions. However, clang does not know this, assumes that x * -x =
> -(x * x), and simplifies down to a sing...