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

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



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.

d#

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?