如何在 gnuplot 中使用 floor 函数

How to use floor function in gnuplot

Here OP 在 gnuplot 中使用函数 floor 定义了函数 roundfloor 的帮助说:

gnuplot> help floor
 The `floor(x)` function returns the largest integer not greater than its
 argument.  For complex numbers, `floor` returns the largest integer not
 greater than the real part of its argument.

我如何使用 floor 我做了:

gnuplot> floor(7.3)
         ^
         invalid command

我能以某种方式更改数字四舍五入的小数位数吗?

要检查或打印函数调用的结果,您必须明确地print

gnuplot> print floor(7.3)
7

要修改链接的 round 函数以仅在某个小数位舍入,请使用以下

round(x) = x - floor(x) < 0.5 ? floor(x) : ceil(x)
round2(x, n) = round(x*10**n)*10.0**(-n)

并这样称呼它

gnuplot> print round2(7.3456, 1)
7.3
gnuplot> print round2(7.3456, 2)
7.35