JanetDocsPlaygroundI'm feeling luckyGitHub sign in

math/trunc



    cfunction
    src/core/math.c on line 287, column 1

    (math/trunc x)

    Returns the integer between x and 0 nearest to x.


1 exampleSign in to add an example
Loading...
(map math/abs   [-2.9 -2.1 2.1 2.9])  # => @[ 2.9  2.1  2.1  2.9 ]
(map math/floor [-2.9 -2.1 2.1 2.9])  # => @[ -3   -3   2    2   ]
(map math/ceil  [-2.9 -2.1 2.1 2.9])  # => @[ -2   -2   3    3   ]
(map math/round [-2.9 -2.1 2.1 2.9])  # => @[ -3   -2   2    3   ]
(map math/trunc [-2.9 -2.1 2.1 2.9])  # => @[ -2   -2   2    2   ]
cellularmitosisPlayground