Format: floor(,base)
Round down to the nearest integer. This function round down to the maximum integer that is not greater than
. For example, in the argument floor(3.82,0.5), the decimal point of 3.82 is above the scale point of 0.5, thus, rounding down to the nearest 0.5 base returns 3.5. The default value of base is 1 if the argument is not defined. This is equivalent to rounding to an integer value by truncating all decimal digits.
Truncate all digits after decimal point.
$ more dat1.csv id,val 1,3.28 2,3.82 3, 4,-0.6 $ mcal c='floor(${val})' a=rsl i=dat1.csv o=rsl1.csv #END# kgcal a=rsl c=floor(${val}) i=dat1.csv o=rsl1.csv $ more rsl1.csv id,val,rsl 1,3.28,3 2,3.82,3 3,, 4,-0.6,-1
Truncate the second digit after decimal point.
$ mcal c='floor(${val},0.1)' a=rsl i=dat1.csv o=rsl2.csv #END# kgcal a=rsl c=floor(${val},0.1) i=dat1.csv o=rsl2.csv $ more rsl2.csv id,val,rsl 1,3.28,3.2 2,3.82,3.8 3,, 4,-0.6,-0.6
Rounding to the nearest 0.5.
$ mcal c='floor(${val},0.5)' a=rsl i=dat1.csv o=rsl3.csv #END# kgcal a=rsl c=floor(${val},0.5) i=dat1.csv o=rsl3.csv $ more rsl3.csv id,val,rsl 1,3.28,3 2,3.82,3.5 3,, 4,-0.6,-1
Rounding to the nearest 10th digit.
$ more dat2.csv id,val 1,1341.28 2,188 3,1.235E+3 4,-1.235E+3 $ mcal c='floor(${val},10)' a=rsl i=dat2.csv o=rsl4.csv #END# kgcal a=rsl c=floor(${val},10) i=dat2.csv o=rsl4.csv $ more rsl4.csv id,val,rsl 1,1341.28,1340 2,188,180 3,1.235E+3,1230 4,-1.235E+3,-1240