Re: Controlling number of decimal places [message #40202] |
Tue, 27 July 2004 20:28  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Edwin writes:
> Say I have a DOUBLE variable that holds 200.23234 for example. I want
> to output this number to a text file as a number rounded to two
> decimal places. In other words, I want to output to a text file
> "200.23".
>
> How do I do this? I've looked into the ROUND function but only rounds
> to the nearest integer.
Something like this should work:
PrintF, lun, data, Format='(F8.2)'
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Controlling number of decimal places [message #40288 is a reply to message #40202] |
Wed, 28 July 2004 13:15  |
i-kant
Messages: 14 Registered: June 2004
|
Junior Member |
|
|
>
> Something like this should work:
>
> PrintF, lun, data, Format='(F8.2)'
>
I guess you mean that data is the DOUBLE variable. If so, can you
explain what F8.2 means? I'm guessing the 2 determines 2 decimal
places, but what about the rest of it.
Thanks!
Edwin
|
|
|