[Mono-dev] Incorrect trunc() definition for MSVC in mono-compiler.h

Aras Pranckevicius aras at unity3d.com
Wed Oct 3 05:02:06 EDT 2007


mono/utils/mono-compiler.h has incorrect trunc() definition for Visual
Studio, causing overflow exceptions to be thrown from int->float
conversions with negative inputs.

Line 88 is:
  #define trunc(x)    floor((x))
when it should be something like:
  #define trunc(x)    (((x) < 0) ? ceil((x)) : floor((x)))

Aras Pranckevicius
work: http://unity3d.com
home: http://aras-p.info

More information about the Mono-devel-list mailing list