function rnd, val,rval ; ; Round val to the nearest rval (there must be a better way...) ; ival = round(val) & irval = round(rval) ivalp = ival while ivalp mod irval ne 0 do ivalp = ivalp+1 ivalm = ival while ivalm mod irval ne 0 do ivalm = ivalm-1 ans = ivalp if ival-ivalm lt ivalp-ival then ans = ivalm return,ans end