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

Home » Public Forums » archive » Re: Controlling number of decimal places
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: Controlling number of decimal places [message #40202] Tue, 27 July 2004 20:28 Go to next message
David Fanning is currently offline  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 Go to previous message
i-kant is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: System Variables & .sav files
Next Topic: Import Arc Export File to IDLffShape

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

Current Time: Wed Oct 08 18:41:28 PDT 2025

Total time taken to generate the page: 0.01141 seconds