Misleading documentation for TFPURoundingMode
Original Reporter info from Mantis: Wolfgang Ehrhardt
-
Reporter name:
Original Reporter info from Mantis: Wolfgang Ehrhardt
- Reporter name:
Description:
The docmentation for TFPURoundingMode in https://www.freepascal.org/docs-html/rtl/system/tfpuroundingmode.html is misleading.
The TFPURoundingMode enumerates the FPU Rounding modes, which is applied to all non-exact floating-point operation.
The current description describes only the special case when used with the round function.
type TFPURoundingMode = (
rmNearest, Round to nearest integer
rmDown, Round to biggest integer smaller than value.
rmUp, Round to smallest integer larger than value
rmTruncate Cut off fractional part
);
The Delphi6 Help
rmNearest Rounds to the closest value.
rmDown Rounds toward negative infinity.
rmUp Rounds toward positive infinity.
rmTruncate Truncates the value, rounding positive numbers down and negative numbers up.
and Wikipedia (https://en.wikipedia.org/wiki/IEEE_floating_point#Rounding_rules) are more
exact
So I suggest to use something like this
type TFPURoundingMode = (
rmNearest, Rounding to nearest-even (least significant 0 in case of a tie)
rmDown, Rounding towards negative infinity (also known as rounding down).
rmUp, Rounding towards positive infinity (also known as rounding up).
rmTruncate Rounding towards zero (also known as truncation).
);
Additional information:
This issue report comes from http://www.lazarusforum.de/viewtopic.php?p=103793#p103793 ff.
Mantis conversion info:
- Mantis ID: 33805
- Fixed in version: 3.1.1
- Fixed in revision: 1489 (#560d6eec)
- Target version: 3.2.0