Re: How to plot multiple charts and ho to round float to specific precision? [message #44974 is a reply to message #44858] |
Thu, 28 July 2005 05:14  |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
liko2@o2.pl wrote:
> No, this does only the rounding and output has still 4 digits after
> coma...I need to have only two digits after coma (eg. 23.46 not 23.4600)
>
It sounds like you don't want to *round* the number, but you want to
*print* it with a certain precision. Check the IDL help for "format
codes" and the FORMAT keyword to the STRING function and PRINT procedure.
IDL> print, 23.46, format='(f0.2)'
23.46
The "f" format code is for outputting floating point numbers. The "2"
means two digits after the decimal point. The "0" means "make the output
string just as long so that it fits".
Good luck,
Benjamin
|
|
|