diff --git a/src/tinyexpr.cpp b/src/tinyexpr.cpp index 5827e10c0..5f242c64d 100644 --- a/src/tinyexpr.cpp +++ b/src/tinyexpr.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "common.h" @@ -195,6 +196,18 @@ static double min(double a, double b) { return a < b ? a : b; } +static double maximum(const std::vector &args) { + double ret = -std::numeric_limits::infinity(); + for (auto a : args) ret = max(ret, a); + return ret; +} + +static double minimum(const std::vector &args) { + double ret = std::numeric_limits::infinity(); + for (auto a : args) ret = min(ret, a); + return ret; +} + struct te_builtin { const wchar_t *name; te_fun_t fn; @@ -222,8 +235,8 @@ static const te_builtin functions[] = { {L"log", std::log10}, {L"log10", std::log10}, {L"log2", std::log2}, - {L"max", max}, - {L"min", min}, + {L"max", maximum}, + {L"min", minimum}, {L"ncr", ncr}, {L"npr", npr}, {L"pi", M_PI},