correct round of reals?
Fredrik Lundh
effbot at telia.com
Sat May 13 13:35:55 EDT 2000
Tim Peters <tim_one at email.msn.com> wrote:
> That's pretty! I like it.
thanks!
> > (this assumes IEEE doubles)
>
> And inherits the rounding mode in effect.
that's on purpose, of course. quoting from SUSV2:
NAME
rint - round-to-nearest integral value
SYNOPSIS
#include <math.h>
double rint(double x);
DESCRIPTION
The rint() function returns the integral value
(represented as a double) nearest x in the direction
of the current rounding mode. The current rounding
mode is implementation-dependent.
> Unclear whether Peter wants that, or wants to force
> nearest/even.
well, he wants to emulate "rint" for platforms that don't
support it natively, so I think his only remaining problem
is to port our python code to C... (see his other post).
</F>
More information about the Python-list
mailing list