"FPDP" Double precision floating point and "FPSP" Single precision floating point
Fingerprint ID: | 0x46504450 (FPDP) and 0x46505350 (FPSP) |
These fingerprints, from RC/Funge-98, implement operations on single and double precision floating point number. Single precision floating point number occupies one stack cell, while double precision occupies two stack cells. They provide the following commands:
- A : xfp yfp — (x+y)fp
- Adds two floating point numbers.
- B : xfp — sin(x)fp
- Calculates sine of floating point number.
- C : xfp — cos(x)fp
- Calculates cosine of floating point number.
- D : xfp yfp — (x÷y)fp
- Divides two floating point numbers.
- E : xfp — arcsin(x)fp
- Calculates arcsine of floating point number.
- F : n — xfp
- Converts integer to floating point number.
- G : xfp — arctan(x)fp
- Calculates arctangent of floating point number.
- H : xfp — arccos(x)fp
- Calculates arccosine of floating point number.
- I : xfp — n
- Converts floating point number to integer, discarding the fraction part.
- K : xfp — log(x)fp
- Calculates natural logarithm of floating point number.
- L : xfp — log10(x)fp
- Calculates common (base 10) logarithm of floating point number.
- M : xfp yfp — (x×y)fp
- Multiplies two floating point numbers.
- N : xfp — -xfp
- Negates floating point number.
- P : xfp —
- Prints floating point number.
- Q : xfp — sqrt(x)fp
- Calculates the square root of floating point number.
- S : xfp yfp — (x-y)fp
- Subtracts two floating point numbers.
- T : xfp — tan(x)fp
- Calculates tangent of floating point number.
- V : xfp — abs(x)fp
- Calculates the absolute value of floating point number.
- X : xfp — exp(x)fp
- Calculates the exponential of floating point number.
- Y : xfp yfp — (x^y)fp
- Raises y to the power of x.
In PyFunge these single and double precision floating point number are implemented as IEEE 754 single precision (32-bit) and double precision (64-bit) format. A single precision number occupies one cell, and a double precision number occupies two cells for lower and upper 32 bits, in the unspecified (endian-specific) order. PyFunge ignores all bits except the lowermost 32 bits for such cells.
The precise operations on floating point numbers are done as specified in IEEE 754. So it correctly handles infinities and NaNs (Not a Number).