if() returning wrong answers

Started by
30 comments, last by Graham 21 years, 6 months ago
quote:Original post by Anonymous Poster
I don''t consider that as a counterexample. Getting the error to reach 0 would mean an infinite loop even with infinitely accurate numbers, so the example has in fact nothing to do with float''s precicion.


Not true. Not all iterative functions are asymptotic. Some are mathematically guaranteed to reach an exact certain number after n iterations, but progressive floating point error keeps that from happening.

Don''t listen to me. I''ve had too much coffee.
Advertisement
have you Initialized your floats to 0.0f ?
EVERYONE forgets to do this, it IS important, esp in Classes
its easy as well
Constructor(){
myfloat1 = myfloat2 = ... = 0.0f;
}

i have screwed up many an engine by forgetting this ...
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website

This topic is closed to new replies.

Advertisement