[Numpy-discussion] making the distinction between -0.0 and 0.0..

Christopher Barker Chris.Barker@noaa....
Tue Sep 29 12:04:09 CDT 2009


Pauli Virtanen wrote:
> Tue, 29 Sep 2009 09:53:40 -0700, Christopher Barker wrote:
> [clip]
>> How can I identify -0.0?
> 
> signbit
> 

perfect for numpy, but at this point I don't have a numpy dependency 
(very unusual for my code!). Anyone know a pure-python way to get it?

It seems I should be able to do something like:

struct.pack("d",-3.4)[0] & Something

but I'm not sure what "Something" is, and it would be endian-dependent, 
wouldn't it?

thanks,
-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the NumPy-Discussion mailing list