Constant name | Constant description | Value | Example | Answer |
---|---|---|---|---|
true | True | 1 | ||
false | False | 0 | ||
pi | Pi | 3.14159 | 90 * pi / 180 | 1.5708 |
e | Natural logarithm | 2.71828 | log(e) | 1 |
ln2 | natural logarithm of 2 | 0.69315 | exp(ln2) | 2 |
ln10 | natural logarithm of 10 | 2.30259 | exp(ln10) | 10 |
log2e | Logarithm of e to base 2 | 1.4427 | log2e | 1.4427 |
log10e | Logarithm of e to base 10 | 0.43429 | log10e | 0.43429 |
sqrt1_2 | Square root of 1/2 | 0.70711 | sqrt1_2 ** 2 | 0.5 |
sqrt2 | Square root of 2 | 1.41421 | sqrt2 ** 2 | 2 |
Function name | Function description | Number of arguments | Example | Answer |
---|---|---|---|---|
int | Integerization | 1 | int(2.6) | 2 |
abs | Absolute value | 1 | abs(-3.5) | 3.5 |
sign | Sign (-1, 1, 0) | 1 | sign(-7) | -1 |
sqrt | Square root | 1 | sqrt(4) | 2 |
cbrt | Cube root | 1 | cbrt(27) | 3 |
pow | Exponentiation | 2 | pow(3, 4) | 81 |
pow2 | Square | 1 | pow2(5) | 25 |
hypot | Sum of squares | Variable quantity | hypot(2, 6) | 6.32456 |
ceil | Carry up | 1 | ceil(5.4) | 6 |
floor | Carry down | 1 | floor(5.6) | 5 |
round | Rounding off | 1 | round(5.6) | 6 |
fixed | Round down | 1 | fixed(5.6) | 5 |
sin | Sine | 1 | sin(0) | 0 |
cos | Cosine | 1 | cos(0) | 1 |
tan | Tangent | 1 | tan(0) | 0 |
cosec | Cosecant | 1 | cosec(90 * pi / 180) | 1 |
sec | Secant | 1 | sec(0) | 1 |
cot | Cotangent | 1 | cot(90 * pi / 180) | 0 |
asin | Arcsine | 1 | asin(0) | 0 |
acos | Arccosine | 1 | acos(0) | 1.5708 |
atan | Arctangent | 1 | atan(0) | 0 |
sinh | Hyperbolic sine | 1 | sinh(0) | 0 |
cosh | Hyperbolic cosine | 1 | cosh(0) | 1 |
tanh | Hyperbolic tangent | 1 | tanh(0) | 0 |
asinh | Hyperbolic arcsine | 1 | asinh(0) | 0 |
acosh | Hyperbolic arccosine | 1 | acosh(1) | 0 |
atanh | Hyperbolic arctangent | 1 | atanh(0) | 0 |
atan2 | Arctangent2 | 2 | deg(atan2(10, 0)) | 90 |
rad | Radian | 1 | rad(180) | 3.14159 |
deg | Degree | 1 | deg(pi) | 180 |
log | Logarithm with base natural logarithm | 1 | log(2) | 0.69315 |
log2 | Logarithm to base 2 | 1 | log2(2) | 1 |
log10 | Logarithm to base 10 | 1 | log10(10) | 1 |
exp | Natural logarithm power | 1 | exp(2) | 7.38906 |
expm1 | Natural logarithm power - 1 | 1 | expm1(0) | 0 |
count | Number of arguments | Variable quantity | count(6, 2, -1.8) | 3 |
sum | Total | Variable quantity | sum(6, 2, -1.8) | 6.2 |
product | Total power | Variable quantity | product(6, 2, -1.8) | -21.6 |
avg | Average | Variable quantity | avg(6, 2, -1.8) | 2.06667 |
geomean | Geometric mean | Variable quantity | geomean(6, 2, 1.8) | 2.78495 |
harmean | Harmonic mean | Variable quantity | harmean(6, 2, -1.8) | 27 |
median | Median | Variable quantity | median(6, 2, -1.8) | 1.8 |
min | Minimum value | Variable quantity | min(6, 2, -1.8) | -1.8 |
max | Maximum value | Variable quantity | max(6, 2, -1.8) | 6 |
random | Random number (0 ≤ value < 1) | 0 | random() | ??? |
Operator | Explanation | Example | Answer |
---|---|---|---|
! | Logical NOT | !true | 0 |
~ | Bitwise NOT | ~1 | -2 |
+ | Unary+ | +5 | 5 |
- | Unary- | -5 | -5 |
** | Exponentiation | 2 ** 3 | 8 |
* | Multiplication | 2 * 3 | 6 |
/ | Division | 3 / 2 | 1.5 |
% | Surplus | 5 % 3 | 2 |
\ | Integer division | 5 \ 3 | 1 |
+ | Addition | 2 + 3 | 5 |
- | Subtraction | 2 - 3 | -1 |
<< | Left bit shift | 0x80 << 2 | 512 |
>> | Right bit shift | 0x80 >> 2 | 32 |
>>> | Unsigned right bit shift | -0x80 >>> 2 | 1073741792 |
& | Bitwise AND | 0xb & 0xc | 8 |
^ | Bitwise XOR | 0xb ^ 0xc | 7 |
| | Bitwise OR | 0xb | 0xc | 15 |