Converting Doubles to Strings [message #46172] |
Fri, 04 November 2005 23:47  |
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/
|
|
|
|