Java Scientific Calculator


Home ·
Download ·
Design and operation ·
Modes ·
Accuracy of calculations ·
Numbers and arithmetic ·
Roots, powers and logs ·
Trigonometric functions ·
Factorials and combinations ·
Logical functions ·
Memory ·
Statistical calculations ·
Variable expressions ·
Graphing functions ·
Other features and functions ·
Modifying the code ·
Testing the code ·
Known issues ·
Similar projects ·

Accuracy of calculations

Internal representation

Internally, all numbers are represented as complex numbers whose real and imaginary parts are double-precision floating-point numbers in 64-bit ieee-754 format.


Most calculations use the StrictMath class from so that they produce identical calculations to standard C libraries of mathematical functions. The calculations in complex numbers use translations of the complex-number functions in the gnu Scientific Library.

Input format

Numbers in the input are converted to internal representation using the BigDecimal class from so that arbitrary length input can be parsed correctly. Since the calculator does not use arbitrary precision, the input may be rounded.

Output format

Output is rounded to fit reasonably in the space available. Since Java provides limited formatting capabilities and we use some nonstandard formats, the formatting is done using classes of Java Scientific Library. This allows the calculator to create readable, accurate output.

Numbers in scientific notation are displayed as a mantissa in the range [1,10) together with an exponent displayed as a small superscript. The superscript is in the same base as the mantissa except for binary numbers, where the exponent is given as a decimal. Binary is treated differently because otherwise there would not be enough space for some binary complex numbers in scientific notation.

If you copy and paste from the calculator, the output format is changed to plain text in standard, rectangular complex notation.

Last modified: Sat 31 May 2008 01:10 pm Logo