comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » String to Floating conversion
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: String to float [message #82675 is a reply to message #80324] Wed, 09 January 2013 11:47 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Fab writes:

>
> On 01/09/2013 08:10 PM, Gompie wrote:
>> Hi,
>> I have a string +2.64342987e+02 which I want to convert to float. Each digit is important so I dont want to loose any of them while type converting to float.
>>
>> print float(+2.64342987e+02) gives 264.343
>> print, double(+2.64342987e+02) gives 264.34299
>>
>> I want 264.342987
>>
>> Can anyone help.
>> Rgds
>> Gompie
>>
>
> http://www.idlcoyote.com/math_tips/sky_is_falling.html
>
> Let see if david is faster than me ;-)

Right!

IDL> n="+2.64342987e+02"
IDL> Print, Double(Str_Replace(n, 'e', 'd')), Format='(F0.6)'
264.342987

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: String to float
Next Topic: Re: find missing elements in an array

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 00:01:49 PDT 2025

Total time taken to generate the page: 0.56038 seconds