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

Home » Public Forums » archive » Re: IDL strplit : split a decimal number
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: IDL strplit : split a decimal number [message #40011 is a reply to message #40007] Wed, 07 July 2004 07:57 Go to previous messageGo to previous message
mwvogel is currently offline  mwvogel
Messages: 9
Registered: February 2003
Junior Member
Alternatively, you could use the format syntax

IDL> PRINT, '['+STRSPLIT( STRING(DOUBLE(!pi), FORMAT='(D)'), '.',
/EXTRACT)+']'
[ 3] [1415927410125732]


"bru" <bruno.galand@boost-technologies.com> schreef in bericht
news:afdbccba.0407070153.3d45d1a4@posting.google.com...
> Hi,
>
> I'm a new IDL user and I have problems using the function STRSPLIT.
> Actually, I need to split a float number to seperate the FLOOR part
> from the decimal one.
> For example, let's take A = 147.123456789d
> I need to make an 2D integer array called B, containing the two parts
> of A seperated by the dot ... B(0) = 147 and B(1) = 123456789 ... with
> all this accuracy.
> But writing such thing as:
> B = strsplit(a, '.', /extr)
> is not accurate enough, since it only returns:
> B(0) = 147 and B(1) = 12346
> I thought it was only the 'print' function which returns an
> approximation of B(1), but if I write B(1)-12346, it returns 0 ... and
> if I try B(1)-123456789, it returns -123444443
>
> Can any one help me with this?
> Maybe I shouldn't use the STRSPLIT function to do this?
> Maybe I don't use this function correctly ...
> Thank you for all remarks.
> Bruno
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Rebinning large array
Next Topic: Re: IDL strplit : split a decimal number -errata

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

Current Time: Fri Oct 10 12:41:39 PDT 2025

Total time taken to generate the page: 0.47974 seconds