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

Home » Public Forums » archive » Controlling number of decimal places
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Controlling number of decimal places [message #40275 is a reply to message #40207] Thu, 29 July 2004 13:40 Go to previous messageGo to previous message
i-kant is currently offline  i-kant
Messages: 14
Registered: June 2004
Junior Member
Sorry I'm still having trouble with this. I didn't fully explain my
problem.

The complete situation is that I have two DOUBLE variables. Say A and
B, each holding a number with 5 decimal places, ex. 200.52343

I want to output these two numbers rounded to two decimal places to a
text file using PRINTF in the following format (with the comma):

A,B

So If my numbers were 560.34345 and 780.93434, I want my text file to
read:


560.34,780.93



David, I have tried your suggestion about the PRINTF format codes, but
I am having trouble getting it to work:

I can either write:

printf, 1, A, FORMAT='(F8.2)'
printf, 1, ','
printf, 1, B, FORMAT='(F8.2)'

which leads to all three entries being on separate lines.

or I can write:

printf, 1, A, ',', B, FORMAT='(F8.2)'

which also doesn't work since the FORMAT code doesn't know what to do
with the comma in between.

The only solution I can think of is not to use FORMAT codes but to use
some kind of rounding up function...Any ideas?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Programatically create structure
Next Topic: Displaying fluid flow in porous medium

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

Current Time: Sat Oct 11 06:33:06 PDT 2025

Total time taken to generate the page: 0.31902 seconds