j
k
j a
j l
Hi, I am in the process of converting some code from Numeric to numarray, and it seems that numarray no longer has the sign() function -- is that so?
ex:
sign(-30.0) = -1 sign(0) = 0 sign(1000) = 1
Is there a replacement?
Thanks,
Mike
Show replies by date
Mike Zingale wrote:
def sign(x): return min(max(-1, math.frexp(x)[0]*2), 1)
- Scott David Daniels Scott.Daniels@Acm.Org
numpy-discussion@python.org
Add to favorites Remove from favorites