Re: division to move a decimal point [message #74066] |
Fri, 31 December 2010 10:01 |
jeanh
Messages: 79 Registered: November 2009
|
Member |
|
|
On 31/12/2010 12:13 PM, Jeff wrote:
> Hi,
> I would like to convert the number 1948005 to 19480.05
> The closest I can get is
> print, 1948005*1./100.
> which gives 19480.1
> Any help would be appreciated!
> Thanks,
> Jeff
>
>
print, 1948005*1./100., format = '(D10.2)'
==>19480.05
The number is well calculated, you just need to display it with the
proper format.
Jean
|
|
|
Re: division to move a decimal point [message #74067 is a reply to message #74066] |
Fri, 31 December 2010 09:21  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Jeff writes:
> I would like to convert the number 1948005 to 19480.05
> The closest I can get is
> print, 1948005*1./100.
> which gives 19480.1
> Any help would be appreciated!
You might be interested in the Number_Formatter function in
the Coyote Library, described at the end of this article:
http://www.dfanning.com/misc_tips/dbl_to_str.html
IDL> print, number_formatter(1948005/100., decimal=2)
19480.05
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|