[Numpy-discussion] Re ading scientific notation using D instead of E

Robert C. ricitron at mac.com
Fri Feb 12 12:06:02 EST 2010


Thank you for the replies. It must be because I am using python on OSX. Is
there no work around for it then?



Robert Kern-2 wrote:
> 
> On Fri, Feb 12, 2010 at 10:05,  <josef.pktd at gmail.com> wrote:
>> On Fri, Feb 12, 2010 at 11:03 AM,  <josef.pktd at gmail.com> wrote:
> 
>>>>>> np.float('1.5698D+03')
>>>
>>> 1569.8
>>>>>> np.float('1.23D+04')
>>> 12300.0
>>>
>>> it's still working with numpy 1.4.0
>>
>> maybe this is a python feature with python builtin float:
>>
>>>>> float('1.5698D+03')
>> 1569.8
>>>>> float('123D+04')
>> 1230000.0
>>
>> with python 2.5
> 
> numpy.float is indeed Python's builtin float type (for obscure
> historical reasons that I won't go into). However, in Python 2.5, at
> least, the parsing of the string is offloaded to the standard C
> function strtod(). On your platform, strtod() will parse the D
> correctly. On OS X, for example, it doesn't. It has nothing to do with
> Python versions but rather the platform that you are on.
> 
> -- 
> Robert Kern
> 
> "I have come to believe that the whole world is an enigma, a harmless
> enigma that is made terrible by our own mad attempt to interpret it as
> though it had an underlying truth."
>   -- Umberto Eco
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 

-- 
View this message in context: http://old.nabble.com/Reading-scientific-notation-using-D-instead-of-E-tp27565041p27566555.html
Sent from the Numpy-discussion mailing list archive at Nabble.com.




More information about the NumPy-Discussion mailing list