Subject Re: [firebird-support] Re: Is this a bug in ROUND function?
Author Slavomir Skopalik

For exact numbers you have to use exact numeric types.

Double is float point type with all advantages and disadvantages.

Look here https://en.wikipedia.org/wiki/Double-precision_floating-point_format

Just for fun, try this:

1e20 + 1 + 1 - 1e20 + 1

Slavek

Ing. Slavomir Skopalik
Executive Head
Elekt Labs s.r.o.
MASA - Collection and evaluation of data from machines and laboratories
http://eng.elektlabs.cz/products-and-services/masa
-----------------------------------------------------------------
Address:
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
---------------------------------------------------------------
Mobile: +420 724 207 851
icq:199 118 333
skype:skopaliks
e-mail:skopalik@...
http://www.elektlabs.cz
On 29.08.19 13:45, m.djorov@... [firebird-support] wrote:
 
In binary representation of the values maybe 4.72 is the closest, but we are talking about mathematic.
This is from the description of the ROUND function in the documentation:
Rounds a number to the nearest integer. If the fractional part is exactly 0.5, rounding is upward for positive numbers and downward for negative numbers.
So .725 is all cases is rounded up to .73 as it should be, but in one case it is not.

Posted by: m.djorov@...
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++