;==================== begin sigfigs.nls ========================================
; sigfigs - Like precision but specifies number of significant figures.
;
; By Rik Blok, 2013 <http://www.zoology.ubc.ca/~rikblok/wiki/doku.php>
;
; This is free and unencumbered software released into the public domain.
;
; Anyone is free to copy, modify, publish, use, compile, sell, or
; distribute this software, either in source code form or as a compiled
; binary, for any purpose, commercial or non-commercial, and by any
; means.
;
; Example:
;
;   ; print pi to 3 sigfigs
;   print sigfigs pi 3
;
;   ; print ticks to same digit as dt
;   print sigfigs dt 2
;   tick-advance dt
;   print sigfigs-other ticks dt 2
;
; Revisions:
;
;   2013-08-03 - initial release by Rik Blok
;-------------------------------------------------------------------------------


to-report sigfigs [ number digits ]
  report precision number (digits - ceiling log number 10)
end


to-report sigfigs-other [ number other-number digits ]
; print _number_ to same decimal as _digits_ sigfigs of _other-number_
  report precision number (digits - ceiling log other-number 10)
end
;==================== end sigfigs.nls ==========================================