Command line calculator
- Size
- 11K (11,017 bytes)
- Added
- 2026-11-20 13:06
- Downloads
- 2
- Long Description
- --------------------------------------------------------------------------- About Compute: "Compute" is a minimalistic and short command line calculator/expression evaluator that performs floating point math. For example, 1> Compute 2+2 +4 will compute two plus two. ("1>" stands for the shell prompt, it is not part of your input). "Compute" respects operator priorities, such as 1> Compute 2+3*4 +14 that is, multiplication is performed first, as it should. Compute also implements all transcendental functions the operating system math libraries provide. The following functions are available: atan(x) : computes the arcus tangent of its argument in radiants sin(x) : computes the sine of x, x is in radiants cos(x) : computes the cosine of x, x is in radiants tan(x) : computes the tangent of x, x is in radiants sinh(x) : computes the hyperbolic sine of x cosh(x) : computes the hyperbolic cosine of x tanh(x) : computes the hyperbolic tangent of x exp(x) : computes exponential function of x, namely e^x log(x) : computes the natural logarithm (to the base of e) of x ln(x) : identical to log(x), the natural logartihm sqrt(x) : computes the square root of x root(x) : identical to sqrt(x), the square root asin(x) : computes the arcus sine of its argument in radiants acos(x) : computes the arcus cosine of its argument in radiants log10(x): computes the logarithm to the base of 10 lg(x) : identical to log10(x) x^y : raises x to the power of y --------------------------------------------------------------------------- Background: "Compute" is a short trivial program I wrote in 2000 to test the Os 3.9 and later Os 3.1.4 math libraries. It is more a test program for the math libraries than anything else. Since it may be useful for other purposes, and is also extremely tiny, I decided to publish it. Since "Compute" was designed as a test program, it is included in three versions: Compute: The default version uses the double precision IEEE format and tests the mathieeedoubbas and mathieeedoubtrans libraries. Compute_Single: This version uses the single precision IEEE format and as such tests the mathieeesingbas and mathieeesingtrans libraries. Compute_FFP: This version uses the Motorola FFP (fast floating point) format and thus tests the mathffp and mathtrans libraries. Note that FFP (and thus mathtrans) have a couple of known issues due to the simplicity of the format. FFP cannot represent infinities and NANs (not-a-number) whereas the IEEE versions can. This may result in some numerical instabilities and defects that are due to the format. "Compute" uses its own conversion functions between floating point formats and decimal input/output, it does not depend on the compiler version. These functions attempt to maximize precision, they do not attempt to generate nice looking results. That is, no "optical rounding" is performed. Outputs may show as +INF/-INF (for infinities), signed zeros (-0) or "NAN", which stands for "Not-A-Number", indicating that a function failed. For example: 1> Compute 0/0 +NAN --------------------------------------------------------------------------- Changes made for release 45.2: The 45.1 release closed the math base library twice. This was fixed in the 45.2 version. --------------------------------------------------------------------------- History: Changes made for release 45.1: This is the first Aminet release. Note that the program is quite old (see the output of the "version" program on "Compute"). ----------------------------------------------------------------------------- The THOR-Software Licence (v3, January 2nd 2021) This License applies to the computer programs known as "Compute", "Compute_FFP" and "Compute_Single". The "Program", below, refers to such program. The "Archive" refers to the package of distribution, as prepared by the author of the Program, Thomas Richter. Each licensee is addressed as "you". The Program and the data i