/tinymath

A tiny math expression evaluation engine and an interactive calculator.

Primary LanguageC++MIT LicenseMIT

A tiny math expression evaluation engine and an interactive calculator.

Operator

operator description
( ) expression group
x ** y exponent $x^y$
+x unary plus
-x unary plus
!x logical NOT
~x bitwise NOT
x * y multiplication
x / y division
x // y floor division
x % y remainder
x + y addition
x - y subtraction
x << y bitwise left shift
x >> y bitwise right shift
x < y less than
x <= y less than or equal
x > y greater than
x >= y greater than or equal
x == y equal
x != y not equal
x & y bitwise AND
x ^ y bitwise XOR
x | y bitwise OR
x && y logical AND
x || y logical OR
x ?: y coalescing, x ? x : z
x ?? y coalescing, x ? x : z
x ? y : z ternary

See https://en.cppreference.com/w/cpp/language/operator_precedence, https://docs.python.org/3/reference/expressions.html#operator-precedence, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence and https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger for more document.

Constant

name value
e 2.71828182845904523536
pi 3.14159265358979323846

Function

name
double abs(double x)
double ceil(double x)
double floor(double x)
double round(double x)
double trunc(double x)
double min(double x, double y)
double max(double x, double y)
double cbrt(double x)
double exp(double x)
double exp2(double x)
double hypot(double x, double y)
double log(double x)
double log10(double x)
double log2(double x)
double pow(double base, double exp)
double sqrt(double x)
double acos(double x)
double asin(double x)
double atan(double x)
double atan2(double y, double x)
double cos(double x)
double sin(double x)
double tan(double x)

See https://en.cppreference.com/w/cpp/numeric/math and https://docs.python.org/3/library/math.html for function description.