Calcumber supports a variety of built-in functions for arithmetic, trigonometry, and unit-aware calculations. Here’s an overview:
🔢Numeric functions
Function | Description |
---|
abs(x) | Absolute value |
sign(x) | Sign of x (-1, 0 or 1) |
ceil(x) | Round up (towards positive infinity) |
floor(x) | Round down (towards negative infinity) |
round(x) | Round to nearest integer (bankers rounding) |
△Trigonometric Functions
The argument is interpreted in radians. Use the deg unit to convert:
sin(pi/6)
→ 0.5
sin(30 deg)
→ 0.5
Function | Description |
---|
sin(x), cos(x), tan(x) | Trigonometric functions |
asin(x), acos(x), atan(x) | Inverse trigonometric functions |
sinh(x), cosh(x), tanh(x) | Hyperbolic trigonometric functions |
📈Exponential and Logarithmic Functions
Function | Description |
---|
exp(x), ln(x), log(x) | Natural exponential function (_e^x) and logarithm. |
exp10(x), log10(x) | Base 10 exponential function (10^x) and logarithm. |
📊Combinatorics and Math Helpers
Function | Description |
---|
sqrt(x) | Square root of x, same as x^0.5 |
fac(n) | Factorial of n (often written as n!) |
📏Unit Aware Functions
Function | Description |
---|
unit(5 m) | Returns the unit part → 1 m |
magn(5 m) | Returns the numeric magnitude → 5 |
ubase(1 N) | Converts to base units → 1 kg*m/s^2 (not implemented yet, use ubase statement) |
usimp(1 N*m) | Simplifies unit → J (not implemented yet, use usimp statement) |