On Mit, 2011-10-05 at 17:01 +1000, Peter Hutterer wrote: 
> Co-authored by Jeremy Huddleston <[email protected]>
> Signed-off-by: Peter Hutterer <[email protected]>

[...]

> +FP3232
> +double_to_fp3232(double in)
> +{
> +    FP3232 ret;
> +    int32_t integral;
> +    double tmp;
> +    uint32_t frac_d;
> +
> +    tmp = floor(in);
> +    integral = (int32_t)tmp;
> +    tmp = ldexp(in - (int)in, 32);

This needs to be

    ldexp(in - integral, 32)

or it's incorrect for -x.y with y > 5.

Though I'm not sure what using ldexp() instead of (1ULL << 32) or (1 <<
16) buys in exchange for generating larger and probably less efficient
code. If you insist in using ldexp though, consider converting the above
to

    (in - integral) * ldexp(1, 32)

which gcc seems clever enough to turn into the same code as

    (in - integral) * (1ULL << 32)

In general, I find the conversion code so verbose as to be borderline
confusing, but I guess the top priority right now is to make it
correct...

I assume there will be followup patches to make the relevant code use
these and fix make check.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to