[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [E-devel] fix for that silly -mfpmath=sse weirdness

On Sep 25, 2006, at 10:44 AM, David Sharp wrote:

amd64 users, rejoice!

i got tired of slowing down e with -mfpmath=387 all the time, so i
finally dug in to this bug after realizing it was probably a problem
with floating point cancelation (occurs when subtracting two numbers
that are very near equal, and causes an extreme loss of precision).

the problem is in _edje_part_recalc() when it linearly interpolates
all the part parameters. all of the caclulations are of this form:
p3.x = (p1.x * (1.0 - pos)) + (p2.x * (pos));
i believe there is some cancelation occuring in the (1.0-pos) part of
this, especially as pos approaches 1.0.

replacing the above line with the following fixes the problem:
p3.x = p1.x + (p2.x - p1.x) * pos;
mathematically equivalent, but, alas, computers aren't as good at math
as we think.

Awesome! My 3500+ CPU has felt fairly sluggish in E, my video card has 128MB of video memory (ATI 9700PRO, using ATI's drivers) and I've noticed that things just aren't as fluid as in Rasters video captures. Hopefully this'll help. Nice work.