[SciPy-user] special.round(10.5) [was: Installing SciPy on Mac OS X Tiger]

Robert Kern rkern at ucsd.edu
Tue Jun 14 17:25:27 EDT 2005


Fernando Perez wrote:
> Robert Kern wrote:
> 
>> Yes, it's been checked in. However, it appears that on your machine, 
>> scipy.special.round(10.5) == 11. Bugger. Can you give me the 
>> repr(scipy.special.round) like this:
>>
>> In [1]: scipy.special.round
>> Out[1]: <ufunc 'round'>
> 
> 
> Yup:
> 
> In [8]: scipy.special.round
> Out[8]: <ufunc 'round'>
> 
> In [9]: scipy.special.round(10.5)
> Out[9]: 11.0
> 
> calderon[~]> uname -a
> Linux calderon.colorado.edu 2.6.10-1.741_FC3 #1 Thu Jan 13 16:38:22 EST 
> 2005 i686 i686 i386 GNU/Linux
> 
> calderon[~]> python -V
> Python 2.3.4
> 
> What should we do here?

Figure out why cephes' round doesn't behave as documented on your machine.

In [1]: scipy.special.round?
Type:           ufunc
String Form:    <ufunc 'round'>
Namespace:      Interactive
Docstring:
     y=Returns the nearest integer to x as a double precision
     floating point result.  If x ends in 0.5 exactly, the
     nearest even integer is chosen.

Can you compile the attached C program and give the results (you might 
need -lm to link)? On my Mac, I get:

[~] kern$ ./testround
10.4 -> 10
10.5 -> 10
10.6 -> 11
11.4 -> 11
11.5 -> 12
11.6 -> 12

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: testround.c
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20050614/de150218/attachment.c>


More information about the SciPy-User mailing list