help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

about 'round' function on mingw


From: Tatsuro MATSUOKA
Subject: about 'round' function on mingw
Date: Fri, 25 Apr 2008 08:04:20 +0900 (JST)

Hello

I have posted to the topic round function on mingwML.
Sorry my poor knowldge prevent to answer the reply.

Please tell me what I should answer.

Regards

Tatsuro

"Greg Chicares" <address@hidden>  wrote

On 2008-04-24 20:59Z, Tatsuro MATSUOKA wrote:
>
>> | The code used internally by MinGW for "round" is the following
>> | (http://www.koders.com/c/fidB63EAFA2C117AAFC1CF9FE9691F8DDBE4DD01A22.aspx)
>> |
>> | double
>> | round (double x)
>> | {
>> |   /* Add +/- 0.5 then then round towards zero.  */
>> |   return trunc ( x + (x >= 0.0 ?  0.5 : -0.5));
>> | }
>> |
>> | The problem with this implementation is when x is the vicinity of bitmax: 
>> it
>> | leads to floating-point overflow (in the mantissa) and produces rounding 
>> error,
>> | For instance if x = bitmax, round(x) => bitmax+1, while it should return
>> | bitmax.

Please say very precisely what "bitmax" means, so that I can
write a minimal standalone testcase for your exact problem
without trying to build your package. I'd guess you mean the
largest normalized floating-point number, but without seeing
its hexadecimal representation, I can't be sure.



--------------------------------------
GANBARE! NIPPON! Win your ticket to Olympic Games 2008.
http://pr.mail.yahoo.co.jp/ganbare-nippon/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]