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

Home » Public Forums » archive » Re: problem string from double missing digits
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: problem string from double missing digits [message #36404 is a reply to message #36403] Thu, 11 September 2003 06:10 Go to previous messageGo to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Reimar Bauer wrote:
>
> Hi all,
>
> did someone know what here is going on.
>
> IDL> d = 98046763.617D
> IDL> s = string(d)
> IDL> PRINT,s
> 98046764.
> IDL> HELP,s
> S STRING = ' 98046764.'
>
> Where are the digits ????
...
> Or does it mean I have first to determine the Format of the number and I
> have to use this information to get the right number.

If you don't like the default format, you do have to specify the
particular alternative you wish to use. However, you don't have to be
explicit:

IDL> PRINT,string(d,FORMAT='(F)')
98046763.6169999990000000

That's overkill, but at least you didn't lose anything. Coming from a C
background, I personally prefer:

IDL> PRINT,string(d,FORMAT='(%"%f")')
98046763.617000

...
> This goes right. But my feeling is this is terrible. Because I bet noone
> takes care on this. What's your feeling?

My feeling is that you'd lose your bet. Almost everyone who spends much
time printing floating point numbers ends up sooner or later having to
override the default formats.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: problem string from double missing digits
Next Topic: IDL java bridge

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

Current Time: Fri Oct 10 03:42:57 PDT 2025

Total time taken to generate the page: 0.07851 seconds