the precision of PRINT and HELP statements [message #26930] |
Thu, 04 October 2001 09:46  |
george.mccabe
Messages: 10 Registered: October 2001
|
Junior Member |
|
|
hello,
this one made me laugh when i realized what was going on -
IDL> help, chkN
CHKN LONG = 140486
IDL> help, float(Nhb)/Nreq0
<Expression> FLOAT = 140486.
IDL> print, chkN - float(Nhb)/Nreq0
-0.500000
perhaps one should expect IDL's PRINT statement to act this way,
IDL> print, float(Nhb)/Nreq0
140486.
IDL> print, format='(g)', float(Nhb)/Nreq0
140486.5
but, the HELP command i feel should show the actual value to the
precision of the variable type.
is there a way to set the format of HELP output, or adjust system wide
format settings?
thank you,
george, george.mccabe@gsfc.nasa.gov
|
|
|
Re: the precision of PRINT and HELP statements [message #27064 is a reply to message #26930] |
Thu, 04 October 2001 23:29  |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
George McCabe wrote:
>
> hello,
>
> this one made me laugh when i realized what was going on -
>
> IDL> help, chkN
> CHKN LONG = 140486
> IDL> help, float(Nhb)/Nreq0
> <Expression> FLOAT = 140486.
> IDL> print, chkN - float(Nhb)/Nreq0
> -0.500000
>
> perhaps one should expect IDL's PRINT statement to act this way,
>
> IDL> print, float(Nhb)/Nreq0
> 140486.
> IDL> print, format='(g)', float(Nhb)/Nreq0
> 140486.5
>
> but, the HELP command i feel should show the actual value to the
> precision of the variable type.
>
> is there a way to set the format of HELP output, or adjust system wide
> format settings?
>
> thank you,
> george, george.mccabe@gsfc.nasa.gov
Dear George,
we have some routines which returns the format code of a value
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/find_form.tar.gz
; EXAMPLE:
; numbers=[100,2.1345,1000.]
; print,find_form(numbers)
; F10.4
; print,find_form(numbers,/reduce_accuracy)
; F10.2
; print,find_form(-40010138.D)
; I9
; print,find_form(-40010138.D,/force)
; F10.0
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/number_format.tar.gz
For further routines and licensing please have a look at
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
regards
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======
read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
|
|
|