Calculator Help

Basic Usage

Input commands to the input field at the bottom. Execute the command by pressing Enter or by clicking the Calculate button. The large text area shows the history of input and output text.

While in the input field, you can scroll the command history back and forth with the up and down arrow keys.

You can clear the output window and command history by clicking the Clear button.

Operators

The calculator understands basic operations, which are:

+addition
-subtraction
*multiplication
/division
%modulus
^power

For example:

1 + 2 * 3 ^ 4

calculates 1 + 2 * 34, which is 163.

Variables

You can assign values to variables and use variables in expressions, for example:

x = 5
x + 6

Output Format

You can change the output format of floating-point values with the "Floating" and "Fixed" radio buttons. These are for example:

Floating:1.2345e3
Fixed:1234.5

Note that the calculator supports extremely large exponents for floating-point values. Displaying such numbers in the fixed-point format may be impractical.

Functions

The calculator supports many functions.

Basic:

abs(x)Absolute value of x.
cbrt(x)Cube root of x.
ceil(x)Ceiling function (round towards positive infinity) of x. Parameter x must be real.
copySign(x, y)Copies sign of y to the value of x. Both x and y must be real.
factorial(x)Factorial of x, that is x!. Parameter x must be an integer.
floor(x)Floor function (round towards negative infinity) of x. Parameter x must be real.
fmod(x, y)Modulus, equivalent to x % y. Both x and y must be real.
hypot(x, y)Equivalent to sqrt(x2 + y2). Both x and y must be real.
inverseRoot(x, y)Equivalent to x-1/y. Parameter y must be an integer.
n(x, y)The value of x to the precision of y digits. Parameter y must be an integer.
root(x, y)Equivalent to x1/y. Parameter y must be an integer.
scale(x, y)Equivalent to x * 10y. Parameter y must be an integer.
sqrt(x)Square root of x.
truncate(x)Nearest integer rounded towards zero of x. Parameter x must be real.

Trigonometric:

acos(x)Arc cosine of x.
acosh(x)Hyperbolic arc cosine of x.
asin(x)Arc sine of x.
asinh(x)Hyperbolic arc sine of x.
atan(x)Arc tangent of x.
atan2(x, y)Angle of the point (y, x). Both x and y must be real.
atanh(x)Hyperbolic arc tangent of x.
cos(x)Cosine of x.
cosh(x)Hyperbolic cosine of x.
exp(x)Exponent function of x, that is ex.
log(x)Natural logarithm of x.
sin(x)Sine of x.
sinh(x)Hyperbolic sine of x.
tan(x)Tangent of x.
tanh(x)Hyperbolic tangent of x.

Complex manipulation:

arg(x)Angle on the complex plane of x.
conj(x)Complex conjugate of x.
imag(x)Imaginary part of x.
real(x)Real part of x.

Advanced:

agm(x, y)Arithmetic-geometric mean of x and y.
gcd(x, y)Greatest common divisor of x and y. Both x and y must be integers.
lcm(x, y)Least common multiple of x and y. Both x and y must be integers.
pi(x)π calculated to x digits of precision. Parameter x must be an integer.

Functional equivalents to the basic operators:

add(x, y)Equivalent to x + y.
subtract(x, y)Equivalent to x - y.
multiply(x, y)Equivalent to x * y.
divide(x, y)Equivalent to x / y.
negate(x)Equivalent to -x.
mod(x, y)Equivalent to x % y.
pow(x, y)Equivalent to x ^ y.

For example:

digits=40
exp(sqrt(n(163, digits)) * pi(digits))

Number Types

The calculator supports complex and rational numbers in addition to integers and floating-point values. For example, sqrt(-1.0) returns i. Here i is the imaginary unit and it can be used in input expressions as well. If you don't specify an exponent or a decimal point for a number, it will be treated as an integer. Integers have infinite precision (see below). For example, inputting

2/3

will get you just

2/3,

the rational number. If you want a floating-point calculation instead, use e.g.

2.00 / 3.00

Precision

The calculator can perform calculations to arbitrary precision (actually the precision is currently limited to about 226 million digits). By default, the precision of a floating-point number is the number of significant digits that you specify for it. For example:

2. has a precision of 1 digit,
2.0 has a precision of 2 digits,
2.00000 has a precision of 6 digits

The result of the calculation is only performed to the precision allowed by the precision of the input operands, so for example

sqrt(2.00)

calculates the square root of two to three digits of precision.

Integers have infinite precision. This limits their use in certain operations. For example

sqrt(2)

will give an error that an inexact square root can't be calculated to infinite precision. However, sqrt(4) would work.

If you want to use extreme precision (which this calculator is certainly designed for), you can use the function n(x, y) to specify the precision of a number. For example,

sqrt(n(2, 1000))

would calculate the square root of two with a precision of 1000 digits.

If you set the precision very high, the calculation may take a very long time. During the calculation the calculator may appear unresponsive. For example, calculating

exp(n(1, 1000000))

might take an hour or so, depending on your computer's performance.


This calculator taken from the Apfloat for Java package, by Mikko Tommila, which is distributed under the GNU Lesser General Public License.