You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the new functionality you would like to see
The calculator only provides support for integer arithmetic. It should also support arithmetics on other number domains, such as rational numbers (e.g. 1/3, 15/2), real numbers (e.g. 0.33, Pi, ...) with a given precision, and complex numbers (e.g. 2+3i). The detailed requirements for each number domain are provided below.
When supporting arithmetics on these number domains, care should be taken when carrying out operations that may result in an error. A clean, generic and reusable solution needs to be implemented; knowing that the same types of problems may also occur for all number domains (integers; rational numbers; real numbers; complex numbers; ...) E.g. for the real number domain, 0.0 / 0.0 is a NaN (an undefined number); 1.0/0.0 is +infinity (while 1/0 in the integer domain should report a division by zero error); -1.0/0.0 is -infinity (while -1/0 in the integer domain should report a division by zero error); taking the square root of a negative real number is a NaN, while it results in an imaginary number in the complex number domain; taking the logarithm of a negative value is not allowed, and so on.
Support for real numbers
All operations available in the calculator should support real numbers in floating point notation.
The user interface should allow to configure and change the precision of the real numbers (i.e., how many significant digits of a real number will be encoded)
Scientific notation should be available to be able express very large or very small decimal numbers. For example, 6.022E23 is equivalent to 6.022×10^23, which would be written as 6022 followed by 20 zeroes in "traditional" notation of natural numbers. Similarly, 1.6E-35 is equivalent to 1.6×10^(−35) which would be written as 0.00...00016 (with lots of zeroes after the floating point of the decimal number).
As on most scientific calculators, it should be possible to use and convert numbers from degrees or radians (the use of radians if often more intuitive and useful when working frequently with trigonometric functions like sin, cos, tan, and so on).
Support for rational numbers
All operations available in the calculator should support rational numbers, which can be seen as a fraction of two integer numbers (e.g. 3/4, 12/7, ...). See https://en.wikipedia.org/wiki/Rational_number
Operations on rational numbers should use their exact representation, rather than decimal floating point approximation to avoid loss of precision. E.g. 1/3 should not be represented as a floating point decimal number 0.333333 as this will lead to a loss of precision since it is not possible to represent an infinite sequence of numbers in the decimal notation.
It should be possible to simplify rational numbers to their canoncial form, e.g. 6/12 can be simplified to 1/2, and 18/12 can be simplified to 1 1/2.
Support for complex numbers
A complex number can be expressed in the form a + b i, where a and b are real numbers. a corresponds to the real part, and b to the imaginary part. Operations on complex numbers specify specific rules, see https://en.wikipedia.org/wiki/Complex_number
Recommendations for the implementation
For real number support, it is recommended to use something like java.math.BigDecimal, which allows for artibrary-precision decimal numbers and also provides operations for arithmetic, scale manipulation, rounding, comparison, hashing, and format conversion.
The text was updated successfully, but these errors were encountered:
Describe the new functionality you would like to see
Support for real numbers
Support for rational numbers
Support for complex numbers
Recommendations for the implementation
For real number support, it is recommended to use something like java.math.BigDecimal, which allows for artibrary-precision decimal numbers and also provides operations for arithmetic, scale manipulation, rounding, comparison, hashing, and format conversion.
The text was updated successfully, but these errors were encountered: