[go: up one dir, main page]

Menu

[r377]: / idl_lib / round_sf.pro  Maximize  Restore  History

Download this file

7 lines (7 with data), 162 Bytes

1
2
3
4
5
6
7
;rounds x to n sig. figs.
;note: doesn't work with zero!
function round_sf, x, n
mag=floor(alog10(abs(x)))
mult=10^(n-mag-1.)
return, round(x*mult)/mult
end