ROUND() without bias by "properly" handling xxx.5 case (round to nearest even
number)
-------------------------------------------------------------------------------------
Key: CORE-5349
URL: http://tracker.firebirdsql.org/browse/CORE-5349
Project: Firebird Core
Issue Type: Improvement
Components: ISQL
Environment: All
Reporter: Sergio Hernandez
Priority: Minor
Rounding always up (or based on sign) is statically biased, as the average of a
list of numbers will allways tend to increase after you round them.
You are NOT allowed to use this "always up" method it in the S.I.
(International System of Units, refer to section B7.1, read it here:
http://www.hcsoft.net/lab/comohacer/redondeos/SI.png), nor the ASTM standards
in USA (stated on the D29 standard, a spanish explanation is here:
http://www.astm.org/SNEWS/SPANISH/SPSO08/datapoints_spso08.html) or in any ISO
or UNE standard, as they all refer to the S.I. for rounding.
So, in lots of technical environments, actual rounding schema is not usable.
In maths and the alike, included most SQL engines
(http://www.w3schools.com/sql/sql_func_round.asp) you always use the "even
rule" (ANSI/IEEE Std 754-1985 standard for floating point artihmetic): in case
of ending in 0.5, always round to the nearest EVEN number. 13.5 would round to
14 and -13.5 will round to -14 too.
Will it be possible to have a flag -or an optional third parameter- so the
round() funtion uses the nicer "even rounding rule, IEEE 754 standard" instead
of actual "positives up, negatives down"?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel