On Sun, Nov 20, 2011 at 3:53 PM, Michal Fapso <[email protected]> wrote:
> Hi Hannes, I am really confused now. I tried to isolate the problem,
> so I created a small C test program (it is attached to this mail). It
> simulates the interpolation between frames 0 and 71 for only 2 frames
> (#2 which works fine and #3 which shows the rounding error). The main
> problem seems to come from this:
>
> double next_scale_prev_scale = next_scale * prev_scale;
>
> ...but then, interestingly (next_scale_prev_scale != next_scale *
> prev_scale). Can someone explain that? Maybe I am missing something
> obvious here.
>
Floating point calculation is not exact. This means if you try to
compare to fp variables the result of == and != is not what you
expect. If you use exact comparision in a program it is a bug.

Regarding
ext_scale_prev_scale != next_scale * prev_scale:

FP processor calculates some bits more, than stored in memory. The
exessive bits are thown away while storing. Immediatly after
mutiplication there are some bits more than in result stored somwhere.
If these bits are not zero the memory variant is not equal to just
calculated result.

Einar

_______________________________________________
Cinelerra mailing list
[email protected]
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra

Reply via email to