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

Home » Public Forums » archive » Re: division to move a decimal point
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
Re: division to move a decimal point [message #74066] Fri, 31 December 2010 10:01
jeanh is currently offline  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 Go to previous message
David Fanning is currently offline  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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Convolving a vector with the 2nd derivative of a Gaussian
Next Topic: Re: Book Draft Finished!

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

Current Time: Wed Oct 08 20:01:35 PDT 2025

Total time taken to generate the page: 0.03666 seconds