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

Miguel de Icaza miguel at novell.com
Wed Oct 3 13:46:11 EDT 2007


Hello,

    Thanks, I have commited a patch.

> 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)))
> 



More information about the Mono-devel-list mailing list