News:

Congratulations!
 You've won the News Item Lottery! Your prize? Reading this news item! :)

r6819:linux:minibug in display/viewport.cc

Started by isidoro, October 16, 2013, 11:32:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

isidoro

The floor function in display/viewport.cc requires to
#include <cmath>
to compile.

Ters

Or rather math.h, which is more in the style of the other includes.

kierongreen

Fixed in 6820 (along with some accidental climate code which will be tidied up shortly...)

Dwachs

Is this piece of code

found_i = ((int)floor(base_i/(double)rw4)) + i_off;

not equivalent to

found_i = base_i / rw4 + i_off;

?? Integer division does the rounding it self.

Or maybe

found_i = (base_i + rw4*i_off) / rw4;



kierongreen

found_i = base_i / rw4 + i_off;
does not give identical values

however
found_i = (base_i + rw4*i_off) / rw4;
does give the same result so I've changed the code to this in 6822 and removed the math.h header include. Actually I've also moved the rw4*i_off to outside the height loop as that should be marginally more efficient...

Markohs

I come back to the forum and you already identified and repaired the bug! oh boy, good! ;) Thx.