Wierd rounding behavior on Linux... (serious problem)

Steve Lime Steve.Lime at DNR.STATE.MN.US
Tue Aug 15 14:10:55 EDT 2006

Hi all: I'm investigating bug 1716 and have tracked the problem down to
some odd rounding behavior with
the MS_NINT macro. For example,

 1)  241.5 rounds to 242
 2)  242.5 also rounds to 242 (should be 243)

Seems to me that a x.5 needs to always round up or down the same way.
The macro is defined a number
of ways depending on environment in map.h. On my Mac bug 1716 doesn't
show up, but on Linux, at least
SUSE 9.1 it does. This behavior is seen in 4.6 and 4.8, so I guess the
original MS_NINT macro is not the 
problem but one of the other definitions. In fact I tried removing the
other defs, defaulting to the original
and all returns to normal.

MS_NINT is used in a lot of places so fixing this might take care of a
number of issues. Ideas?


More information about the mapserver-dev mailing list