8000 np.nan has negative sign, should be positive. (Trac #920) · Issue #1518 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

np.nan has negative sign, should be positive. (Trac #920) #1518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
thouis opened this issue Oct 19, 2012 · 4 comments
Closed

np.nan has negative sign, should be positive. (Trac #920) #1518

thouis opened this issue Oct 19, 2012 · 4 comments

Comments

@thouis
Copy link
Contributor
thouis commented Oct 19, 2012

Original ticket http://projects.scipy.org/numpy/ticket/920 on 2008-10-02 by @charris, assigned to unknown.

On my reverse endian machine

In [3]: array([np.nan]).tostring()
Out[3]: '\x00\x00\x00\x00\x00\x00\xf8\xff'
@thouis
Copy link
Contributor Author
thouis commented Oct 19, 2012

@cournape wrote on 2009-03-09

Chuck, what's the rationale for having a positive nan ?

@thouis
Copy link
Contributor Author
thouis commented Oct 19, 2012

@charris wrote on 2009-03-09

Hi David,

I don't think it matters much, the ieee spec says the sign of nan is undefined. This turned up when I was working on the signbit functions and it just seemed the right thing to do. But go ahead and close the ticket, anything that depends on the sign of a nan is probably an error.

@thouis
Copy link
Contributor Author
thouis commented Oct 19, 2012

@charris wrote on 2009-03-10

However, the gcc NAN macro give a positive nan and the sign of nans is accessible through the signbit ufunc. Copysign also returns the signbit for nans. So it just seems a little nicer to make it positive. The easy way is to use copysign on the computed nan:

mynan = copysign(mynan, 1.0);

@thouis
Copy link
Contributor Author
thouis commented Oct 19, 2012

@cournape wrote on 2009-03-11

Fixed in r6634

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0