Calculator
Calculator is an extensive math expression evaluator for Webacus. You can perform basic arithmetic, percentage operations with precision. It features a flexible expression parser with a large set of built-in units, functions and constants.
Basic Arithmetic operations
| Operation |
Operator |
Phrases |
Example |
| Addition |
+ |
PLUS, AND, WITH, ADD |
1 + 24, 1 plus 3 plus 5 |
| Subtraction |
- |
MINUS, SUBTRACT, WITHOUT |
0.234 - 3.14, 23 without 10 |
| Multiplication |
* |
TIMES, MULTIPLIEDBY, MUL |
1234 * 100, 6665.01 MUL 001 |
| Division |
/ |
DIVIDE, DIVIDEBY |
(1+23)/(0.01) |
| Power |
^ |
POW |
2 ^ 2 ^ 2 pow 23 |
| Modulus |
mod |
|
134 mod 13 |
| Percentage |
of |
|
25% of 1024, 10 of 234 |
Operator precedence rule
| Operators |
Meaning |
Association |
| () |
Parentheses |
|
| log() |
Function call |
|
| 34 cm , 45 cm |
Unit suffix |
|
| ^ |
Exponent |
right to left |
| +x, -x, !x |
Unary |
right to left |
| as, in |
Unit or number system conversion |
|
| *, / , mod, of |
Multiplication, division, modulus and percentage |
left to right |
| +, - |
Addition and subtraction |
left to right |
| <, >, <=, >=, <==, >== |
Camparison |
left to right |
| ==, !=, ===, !== |
Equality |
left to right |
| = |
Assignment |
right to left |
Percentage operation
For general percentage operations like adding or subtracting the per cent of value, you can do 12 + 24%, 1230 - 23.23%
Variables
You can declare variables using = or : operator, you can also reassign them
Please note that you can't use variable names which are being used for phrases in operations and units
radius : 20cm
PI*radius^2
Constants
| Variable name |
Value |
| E |
2.718281828459045235360287 |
| PI |
3.141592653589793238462645 |
| PI2 |
6.2831853071795864769 |
Functions
abs(-23) + log(123)
List of supported functions:
| Description |
Function |
Example |
| Square root |
sqrt |
sqrt(4) |
| Cube root |
cbrt |
cbrt(12) |
| Absolute value |
abs |
abs(-4) |
| Logarithm |
log |
log(10) |
| Natural logarithm |
ln |
ln(10) |
| Rounding |
round |
round(3.14) |
| Ceiling |
ceil |
ceil(1.67) |
| Flooring |
floor |
floor(1.23) |
| Sum of start...end |
sigma |
sigma(0, 100) |
| Cosine |
cos |
cos(0) |
| Sine |
sin |
sin(10) |
| Tangent |
tan |
tan(50) |
| Inverse cosine |
acos |
acos(7) |
| Inverse sine |
asin |
asin(89.01) |
| Inverse tangent |
atan |
atan(45) |
| Hyperbolic cosine |
cosh |
cosh(34) |
| Hyperbolic sine |
sinh |
sinh(9) |
| Hyperbolic tangent |
tanh |
tanh(45) |
| Hyperbolic inverse cosine |
acosh |
acosh(34) |
| Hyperbolic inverse sine |
asinh |
asinh(9) |
| Hyperbolic inverse tangent |
atanh |
atanh(45) |
Units
You can convert one unit into another. Calculator will automatically convert units to perform operations if it's needed during conversion.
23day in sec
100min + 34sec + 1day + 10% of 100 day
Length
| Unit |
Phrases |
| Centimeter |
cm, centimeter |
| Meter |
m, meter |
| Millimeter |
mm, milimeter |
| Kilometer |
km |
| Inch |
inch |
| Feet |
ft |
| Yard |
yd, yard |
| Mile |
mi |
| Nautical mile (nmi) |
nmi |
Speed
| Unit |
Phrases |
| Kilometer per hour |
kmh, kmph, khm, kph |
| Miles per hour |
mph |
| Meters per second |
mps |
| Feet per second |
fps |
| Knots |
kts, knots |
Time
| Unit |
Phrases |
| Nanosecond |
nsec, nanosecond, nanoseconds |
| Microsecond |
msec, microsecond, microseconds |
| Seconds |
sec, second |
| Minutes |
minute |
| Hours |
hr, hour |
| Days |
day |
| Week |
week, weeks |
Temperature
| Unit |
Phrases |
| Kelvin |
K, kelvin |
| Farenheit |
°F, F |
| Celcius |
°C, C |
Mass
| Unit |
Phrases |
| Gram |
g, gram, grams |
| Tonne |
tonne, tonnes |
| Kilogram |
kg, kilogram, kilograms |
| Milligram |
mg, milligram, milligrams |
| Microgram |
microgram, micrograms |
| Imperialton |
imperialton |
| Uston |
uston |
| Stone |
stone, stones |
| Pound |
pound, pounds |
| Ounce |
ounce, ounces |
Digital storage
| Unit |
Phrases |
| Bit |
bit |
| Kilobit |
kilobit, kB |
| Kibibit |
kibibit, kiB |
| Megabit |
megabit, mB |
| Mebibit |
mebibit, miB |
| Gigabit |
gigabit, gB |
| Gibibit |
gibibit, giB |
| Terabit |
gerabit, tB |
| Tebibit |
tebibit, tiB |
| Petabit |
petabit, pB |
| Pebibit |
pebibit, piB |
| Byte |
byte |
| Kilobyte |
kilobyte, kb |
| Kibibyte |
kibibyte, kib |
| Megabyte |
megabyte, mB |
| Mebibyte |
mebibyte, mib |
| Gigabyte |
gigabyte, gb |
| Gibibyte |
gibibyte, gib |
| Terabyte |
gerabyte, tb |
| Tebibyte |
tebibyte, tib |
| Petabyte |
petabyte, pb |
| Pebibyte |
pebibyte, pib |
Number System
You can convert one number system into another:
0.34 km in octal # 0o0.25605075341217270244 Kilometer
0b1011 + 0xac
Scales
You use scales in the number literal:
45 B
Sources:
[1] github.com/5anthosh/fcal/wiki