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

Bug#134097: Looks like a documentation bug?



retitle 134097 drem(): need to document rounding to even number when quotient==0.5
thanks

IMHO, drem() *is* behaving as documented, just as the previous comment has
stated. The manpage for drem() describes the rounding to the nearest even
number when the quotient is exactly 0.5.

However, the info pages are not very clear about this; so this appears to
be a documentation bug.  The info entry for drem() is quoted below. Note
that nowhere does it specifically indicate the rounding towards even
numbers when q=0.5:

> - Function: double drem (double NUMERATOR, double DENOMINATOR)
> - Function: float dremf (float NUMERATOR, float DENOMINATOR)
> - Function: long double dreml (long double NUMERATOR, long double
>          DENOMINATOR)
>     These functions are like `fmod' except that they rounds the
>     internal quotient N to the nearest integer instead of towards zero
>     to an integer.  For example, `drem (6.5, 2.3)' returns `-0.4',
>     which is `6.5' minus `6.9'.
>
>     The absolute value of the result is less than or equal to half the
>     absolute value of the DENOMINATOR.  The difference between `fmod 
>     (NUMERATOR, DENOMINATOR)' and `drem (NUMERATOR, DENOMINATOR)' is
>     always either DENOMINATOR, minus DENOMINATOR, or zero.
>
>     If DENOMINATOR is zero, `drem' signals a domain error.


T

-- 
Indifference will certainly be the downfall of mankind, but who cares? --
Miquel van Smoorenburg



Reply to: