Calcul8r is a simple but very powerful calculator built using html5 technologies.
The expression engine uses SconeScript (from the sconeserver project), and numeric calculations are done using the gmp and mpfr libraries.
Expressions can be as simple or as complicated as you need them to be.
Numeric precision for floating point numbers can be configured up to two billion bits.
Integers can be up to one million digits.
Calculations are performed on your local machine.
An extensive set of operators and functions are provided.
Calcul8r uses a syntax similar to c or JavaScript.
The following table lists the supported operators in order of precedence:
Operator | Description |
---|---|
, | Sequence |
+ | Add |
- | Subtract |
* | Multiply |
/ | Divide |
% | Modulus (remainder) |
^ | Power |
! (postfix) | Factorial |
- (prefix) | Negative |
() | Subexpression, function call |
Numeric literal values are treated as decimal by default. If no decimal point is given, the value is stored internally as an integer, otherwise it is stored as floating point.
Integers can also be input in the following bases:
Functions are called by specifying the name of the function followed by the list of arguments in brackets. Most functions take a single argument, but where multiple arguments are required, these should be separated by commas. The following functions are supported:
abs(x) - absolute
ceil(x) - integer ceiling
floor(x) - integer floor
trunc(x) - integer truncation
ln(x) - natural logarithm
exp(x) - Exponential
sin(a) - sine
cos(a) - cosine
tan(a) - tangent
asin(x) - arcsine
acos(x) - arccosine
atan(x) - arctangent
atan2(y,x) - arctangent (2 arg form)
sinh(a) - hyperbolic sine
cosh(a) - hyperbolic cosine
tanh(a) - hyperbolic tangent
sqrt(a) - square root
gcd(a,b,...) - greatest common divisor
lcm(a,b,...) - lowest common multiple
mean(a,b,...) - arithmetic mean
fib(n) - returns the nth Fibonacci number
bin(n) - convert integer to binary string with 0b prefix
oct(n) - convert integer to octal string with 0o prefix
hex(n) - convert integer to hexadecimal string with 0x prefix
Several named constants are available, including PI and e.