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

Home » Public Forums » archive » Re: number format in structure
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: number format in structure [message #45671 is a reply to message #45670] Sun, 25 September 2005 19:51 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
kl_tah@hotmail.com writes:
> Hi All,
>
> does anyone happen to know how I can specify the format to which
> numbers stored in structure tags should adhere?
>
> for example, I'd like to (hypothetically) be able to do
>
> s={a:3.2f,b=2.3f}
>
> s.a=123.12345678
>
> will yield
>
> print,s.a
> 123.12

You could store the format in the structure, as in,
s = {a:0., a_format: '3.2F', $
b:0., b_format: '5.3F' }
and
print, s.a, format=s.a_format

This is still not easy if you want to make a compound print statement
with many fields.

Also, beware that a single precision floating point number can't store
the 11 significant figures of the number you entered. You would have
to use double precision (single = 6-7 decimal digits; double = 17
decimal digits).

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help needed: read procedure for SCAN-data (soil climate analysis network)
Next Topic: undercurve highlight/Shade

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

Current Time: Fri Oct 10 00:36:56 PDT 2025

Total time taken to generate the page: 0.80132 seconds