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

Home » Public Forums » archive » Converting Doubles to Strings
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Converting Doubles to Strings [message #46172] Fri, 04 November 2005 23:47 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

I've run into an interesting problem. I have a double precision
number that I wish to convert to a string (so I can put it into
a text widget, for example). I don't know ahead of time how many
significant digits will be in this number. The number could
look like this 45.6, or this 123456789.123456789, or this
-22.1234567890. If it looks like the latter number, I am
having a very hard time converting it to a string. For example,
this doesn't work:

IDL> v = String(-22.1234567890, Format='(D0)')
IDL> Print, v
-22.123457

Is this a bug in IDL? Or am I overlooking something?

Cheers,

David
--
David Fanning, Ph.D.,
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: Converting Doubles to Strings [message #46242 is a reply to message #46172] Mon, 07 November 2005 22:51 Go to previous message
biophys is currently offline  biophys
Messages: 68
Registered: July 2004
Member
yes, i agree with you. here i used it just because ocassionally i may
have integers feeding from another widget. however, this turned out to
be unnecessary. thanks, bp


Reimar Bauer wrote:
> biophys wrote:
>
> Dont't do that conversion of an input float to double please use an internal
> variable and look at this nice article
>
> http://www.dfanning.com/math_tips/double.html
>
> cheers
> Reimar
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Specifying Log Axis Tick Marks
Next Topic: Re: Save 2D conversion matrix

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

Current Time: Sat Oct 11 13:45:05 PDT 2025

Total time taken to generate the page: 1.27992 seconds