# [Numpy-tickets] [NumPy] #608: <ufunc 'absolute'> should clear the sign bit.

NumPy numpy-tickets@scipy....
Wed Nov 7 12:56:55 CST 2007

```#608: <ufunc 'absolute'> should clear the sign bit.
-------------------------+--------------------------------------------------
Reporter:  lambertdw    |       Owner:  somebody
Type:  enhancement  |      Status:  new
Priority:  normal       |   Milestone:  1.0.4
Component:  numpy.core   |     Version:  none
Severity:  minor        |    Keywords:  abs absolute "ieee floating point"
-------------------------+--------------------------------------------------
{{{
>>> a
array([ 0., -0., -0.])
>>> absolute(a)
array([ 0., -0., -0.])
>>> array([0 if x == 0 else abs(x) for x in a]) # oops, this alters data
type
array([0, 0, 0])
}}}

This affects my docstring tests.

{{{
from scipy import *

def spherical_to_Cartesian(r,phi,psi):
'''
>>> from scipy import *
>>> a = spherical_to_Cartesian(0,3,23)
>>> list(a)                     # fails, but ok.
[0.0, 0.0, 0.0]
>>> list(absolute(a))           # still fails---at first glance
surprising.
[0.0, 0.0, 0.0]
>>> [abs(x) for x in a]      # Maybe Guido should participate?
[0.0, 0.0, 0.0]
>>> alltrue(a == [0,0,0])       # Success!
True
'''
t = r*cos(psi)
return asarray((t*cos(phi),t*sin(phi),r*sin(psi)))
}}}

--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/608>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
```