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

Home » Public Forums » archive » print a la C
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
print a la C [message #9059] Thu, 29 May 1997 00:00 Go to previous message
Andrea Spinelli is currently offline  Andrea Spinelli
Messages: 4
Registered: August 1996
Junior Member
Hi,

does anybody know whether there is a freely available somewhere a
function for printing floats in a way similar to the %g
argument of printf? E.g.:

printf("%g\n",0.02); [C]
results in
0.02

print, 0.01 [IDL]
0.0100000

(no extra blanks, no extra zeroes)

Of course, I could say in IDL

print,format='(f4.2)',0.01

but I need something that, without knowing the number of
digits in advance, makes an earnest effort to save space
and keep readability (and works, e.g., also with 0.003!!!)

Thanks in advance,
Andrea Spinelli
spinellia@acm.org
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Beta just expired, anyone got the new one yet?
Next Topic: Re: IDL FAQ - better format

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

Current Time: Wed Oct 08 13:42:26 PDT 2025

Total time taken to generate the page: 0.00361 seconds