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

Aras Pranckevicius aras at unity3d.com
Mon Oct 1 13:43:52 EDT 2007


Hi,

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071001/1243ffa6/attachment.html 


More information about the Mono-devel-list mailing list