builtin-math: Use normal C trunc

uClibc-ng does not expose C++11 math
functions to the std namespace, breaking
compilation. This is fine as the argument
type is double.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2019-11-24 12:40:03 -08:00 committed by Fabian Homborg
parent 80a4898e75
commit 3b0f642de9

View File

@ -163,7 +163,7 @@ static wcstring format_double(double v, const math_cmd_opts_t &opts) {
// As a special-case, a scale of 0 means to truncate to an integer
// instead of rounding.
if (opts.scale == 0) {
v = std::trunc(v);
v = trunc(v);
return format_string(L"%.*f", opts.scale, v);
}