![]() |
LT4335 float instructions.
Version of 8 July 2011. Home. |
FG_E | float get, value embedded | m8_e4_01_001 | |||
---|---|---|---|---|---|
Pulled: none
Pushed:
Embedded is a tiny float, with 8 bits for the mantissa and 4 for the exponent. | |||||
FG_AE | float get, absolute address, sizes embedded | m4_e4_000_10_1111 | FG_AR | float get, absolute address, all operands in registers | 08_000_10_1111 |
Pulled:
• #0 signed integer: address to read in genspace Pushed:
m4 and e4 are how many words to retrieve for the mantissa and exponent. If both zero, FG_AR is performed instead. | Pulled:
• #0 signed integer: address to read in genspace • #1 signed integer in 0…255: how many bits to retrieve for exponent • #2 signed integer in 0…255: how many bits to retrieve for mantissa Pushed:
| ||||
FG_AE_Y | float get, absolute address, sizes embedded, synchronized | m4_e4_100_10_1111 | FG_AR_Y | float get, absolute address, all operands in registers, synchronized | 08_100_10_1111 |
Same as FG_AE, plus synchronization. If m4 and e4 are both zero, FG_AR_Y is performed instead. | Same as FG_AR, plus synchronization. | ||||
FG_RO | float get, relative address, offset embedded | s9_01_10_1111 | |||
Pulled:
• #0 signed integer in 0…255: how many bits to retrieve for exponent • #1 signed integer in 0…255: how many bits to retrieve for mantissa Pushed:
s9 is the offset. | |||||
FG_RS | float get, relative address, sizes embedded | m4_e4_010_10_1111 | FG_RR | float get, relative address, all operands in registers | 08_010_10_1111 |
Pulled:
• #0 signed integer: offset Pushed:
m4 and e4 are how many words to retrieve for the mantissa and exponent. If both zero, FG_RR is performed instead. | Pulled:
• #0 signed integer: offset • #1 signed integer in 0…255: how many bits to retrieve for exponent • #2 signed integer in 0…255: how many bits to retrieve for mantissa Pushed:
| ||||
FG_RO_Y | float get, relative address, offset embedded, synchronized | s9_11_10_1111 | |||
Same as FG_RO, plus synchronization. | |||||
FG_RS_Y | float get, relative address, sizes embedded, synchronized | m4_e4_110_10_1111 | FG_RR_Y | float get, relative address, all operands in registers, synchronized | 08_110_10_1111 |
Same as FG_RS, plus synchronization. If m4 and e4 are both zero, FG_RR_Y is performed instead. | Same as FG_RR, plus synchronization. |
Intentionally omitted is an option to embed an 8-bit mantissa size but place the exponent size in a register, and vice versa.
Put. (see also integer and string) The next instructions pull an float from the stack and write it into genspace. They attempt to convert each of the mantissa and exponent from the size it assumed in its register to the size requested for genspace, which is likely different from the trimmed size. Rounding-nearest-half-even may be necessary, and a reduction in digits may incur a null.
FP_AE | float put, absolute address, sizes embedded | m4_e4_000_01_1111 | FP_AR | float put, absolute address, all operands in registers | 08_000_01_1111 |
---|---|---|---|---|---|
Pulled:
• #0 exp, #1 man: data to write • #2 signed integer: the address to write in genspace Pushed: none m4 and e4 are how many words to write for the mantissa and exponent. If both zero, FP_AR is performed instead. | Pulled:
• #0 exp, #1 man: data to write • #2 signed integer: address to write in genspace • #3 signed integer in 0…255: how many bits to write for exponent • #4 signed integer in 0…255: how many bits to write for mantissa Pushed: none | ||||
FP_AE_Y | float put, absolute address, sizes embedded, synchronized | m4_e4_100_01_1111 | FP_AR_Y | float put, absolute address, all operands in registers, synchronized | 08_100_01_1111 |
Same as FP_AE, plus synchronization. If m4 and e4 are both zero, FP_AR_Y is performed instead. | Same as FP_AR, plus synchronization. | ||||
FP_RO | float put, relative address, offset embedded | s9_01_01_1111 | |||
Pulled:
• #0 exp, #1 man: data to write • #1 signed integer in 0…255: how many bits to write for exponent • #2 signed integer in 0…255: how many bits to write for mantissa Pushed: none s9 is the offset. | |||||
FP_RS | float put, relative address, sizes embedded | m4_e4_010_01_1111 | FP_RR | float put, relative address, all operands in registers | 08_010_01_1111 |
Pulled:
• #0 exp, #1 man: data to write • #2 signed integer: offset Pushed: none m4 and e4 are how many words to write for the mantissa and exponent. If both zero, FP_RR is performed instead. | Pulled:
• #0 exp, #1 man: data to write • #2 signed integer: offset • #3 signed integer in 0…255: how many bits to write for exponent • #4 signed integer in 0…255: how many bits to write for mantissa Pushed: none | ||||
FP_RO_Y | float put, relative address, offset embedded, synchronized | s9_11_01_1111 | |||
Same as FP_RO, plus synchronization. | |||||
FP_RS_Y | float put, relative address, sizes embedded, synchronized | m4_e4_110_01_1111 | FP_RR_Y | float put, relative address, all operands in registers, synchronized | 08_110_01_1111 |
Same as FP_RS, plus synchronization. If m4 and e4 are both zero, FP_RR_Y is performed instead. | Same as FP_RR, plus synchronization. |
Get-and-(conditional)-put. (see also integer and string) The machine compares the float in genspace to the "old value" float:
It is not necessary that the numbers have been normalized or trimmed. For example, here are two numbers that would test as equal:
The two floats must be of exactly the same value; there is no provision for a tolerance. (If an exact match of bit patterns is desired, the string version of get-and-put should be used.) If the "new value" float is of such large or small magnitude that its exponent will not fit into the indicated region of genspace, a null will be written instead.
FGP_AE | float get-and-put, absolute address, sizes embedded | m4_e4_000_11_1111 | FGP_AR | float get-and-put, absolute address, all operands in registers | 08_000_11_1111 |
---|---|---|---|---|---|
Pulled:
• #0 signed integer: the address to examine in genspace • #1 exp, #2 man: old value • #3 exp, #4 man: new value Pushed:
m4 and e4 are how many words in genspace to examine for the mantissa and exponent. If both zero, FGP_AR is performed instead. | Pulled:
• #0 signed integer: address to examine in genspace • #1 signed integer in 0…255: how many bits in genspace to examine for exponent • #2 signed integer in 0…255: how many bits in genspace to examine for mantissa • #3 exp, #4 man: old value • #5 exp, #6 man: new value Pushed:
| ||||
FGP_AE_Y | float get-and-put, absolute address, sizes embedded, synchronized | m4_e4_100_11_1111 | FGP_AR_Y | float get-and-put, absolute address, all operands in registers, synchronized | 08_100_11_1111 |
Same as FGP_AE, plus synchronization. If m4 and e4 are both zero, FGP_AR_Y is performed instead. | Same as FGP_AR, plus synchronization. | ||||
FGP_RO | float get-and-put, relative address, offset embedded | s9_01_11_1111 | |||
Pulled:
• #0 signed integer in 0…255: how many bits in genspace to examine for exponent • #1 signed integer in 0…255: how many bits in genspace to examine for mantissa • #2 exp, #3 man: old value • #4 exp, #5 man: new value Pushed:
s9 is the offset. | |||||
FGP_RS | float get-and-put, relative address, sizes embedded | m4_e4_010_11_1111 | FGP_RR | float get-and-put, relative address, all operands in registers | 08_010_11_1111 |
Pulled:
• #0 signed integer: offset • #1 exp, #2 man: old value • #3 exp, #4 man: new value Pushed:
m4 and e4 are how many words in genspace to examine for the mantissa and exponent. If both zero, FGP_RR is performed instead. | Pulled:
• #0 signed integer: offset • #1 signed integer in 0…255: how many bits in genspace to examine • #2 exp, #3 man: old value • #4 exp, #5 man: new value Pushed:
| ||||
FGP_RO_Y | float get-and-put, relative address, offset embedded, synchronized | s9_11_11_1111 | |||
Same as FGP_RO, plus synchronization. | |||||
FGP_RS_Y | float get-and-put, relative address, sizes embedded, synchronized | m4_e4_110_11_1111 | FGP_RR_Y | float get-and-put, relative address, all operands in registers, synchronized | 08_110_11_1111 |
Same as FGP_RE, plus synchronization. If m4 and e4 are both zero, FGP_RR_Y is performed instead. | Same as FGP_RR, plus synchronization. |
Versus. (see also integer, string, and branch) Two floats may be compared with each other. The result is a string at #0, which contains 32 bits. Its contents are:
Address of bit within #0new | With FV_E and FV_R, this bit equals 1 when … | Comments | |
---|---|---|---|
0 | #0.1old and #2.3old both have values, and #0.1old > #2.3old | never both 1 | exact comparison, analogous to integer and string |
1 | #0.1old and #2.3old both have values, and #0.1old ≤ #2.3old | ||
2 | #0.1old and #2.3old both have values, and #0.1old ≠ #2.3old | never both 1 | |
3 | #0.1old and #2.3old both have values, and #0.1old = #2.3old | ||
4 | #0.1old and #2.3old both have values, and #0.1old < #2.3old | never both 1 | |
5 | #0.1old and #2.3old both have values, and #0.1old ≥ #2.3old | ||
6 | #0.1old is null | never the same | analogous to integer |
7 | #0.1old has a value | ||
8 | #2.3old is null | never the same | |
9 | #2.3old has a value | ||
10 | #0.1old and #2.3old are similar | never the same | |
11 | #0.1old and #2.3old are dissimilar | ||
12 | #0.1old has a value, and #2.3old is null | never the same | |
13 | #0.1old is null, or #2.3old has a value | ||
14 | #0.1old is null, and #2.3old has a value | never the same | |
15 | #0.1old has a value, or #2.3old is null | ||
16 | #0.1old has a value, and #2.3old has a value | never the same | |
17 | #0.1old is null, or #2.3old is null | ||
18 | #0.1old is null, and #2.3old is null | never the same | |
19 | #0.1old has a value, or #2.3old has a value | ||
20 | #0.1old and #2.3old both have values, and #0.1old > #2.3old | never both 1 | absolute tolerance |
21 | #0.1old and #2.3old both have values, and #0.1old ≤ #2.3old | ||
22 | #0.1old and #2.3old both have values, and #0.1old ≠ #2.3old | never both 1 | |
23 | #0.1old and #2.3old both have values, and #0.1old = #2.3old | ||
24 | #0.1old and #2.3old both have values, and #0.1old < #2.3old | never both 1 | |
25 | #0.1old and #2.3old both have values, and #0.1old ≥ #2.3old | ||
26 | #0.1old and #2.3old both have values, and #0.1old > #2.3old | never both 1 | relative tolerance |
27 | #0.1old and #2.3old both have values, and #0.1old ≤ #2.3old | ||
28 | #0.1old and #2.3old both have values, and #0.1old ≠ #2.3old | never both 1 | |
29 | #0.1old and #2.3old both have values, and #0.1old = #2.3old | ||
30 | #0.1old and #2.3old both have values, and #0.1old < #2.3old | never both 1 | |
31 | #0.1old and #2.3old both have values, and #0.1old ≥ #2.3old |
A comparand is regarded as null if the mantissa, the exponent, or both are null. The programmer can investigate the component integers if greater detail is required.
FV_E | float versus, tolerance embedded | s9_1111_0111 | FV_R | float versus, tolerance in register | 081_1111_0111 |
---|---|---|---|---|---|
Pulled:
• #0 exp, #1 man: comparand • #2 exp, #3 man: comparand Pushed:
If s9 is null, FV_R is performed instead. | Pulled:
• #0 exp, #1 man: comparand • #2 exp, #3 man: comparand • #4 unsigned integer: tolerance Pushed:
|
The absolute and relative tolerances are most easily described by reference to the number produced by the FIL instruction, namely the base-two logarithm of a float's absolute value, rounded to an integer, rounded toward negative infinity.
The absolute and relative tolerance comparisons are not intended to be a comprehensive error-management system. Rather, they are a quick and easy way to determine whether two floats are "very nearly" equal, and can be beneficial to iterative numerical routines that must frequently test for a termination condition.
Arithmetic. (see also integer) Float arithmetic offers the usual operations. The output will be null on overflow, null input, or division by zero. Null or not, the float will be normalized, and each component integer trimmed.
The precision is the number of bits that the mantissa will have before normalization or trimming, and all those bits are guaranteed accurate according to the round-nearest-half-even rule; this is a relative precision, not an absolute. If the requested precision is not in 0…255, an exception will be thrown. When the precision is embedded in the opcode, it is the first eight bits.
FA_E | float add, precision embedded | u8_00000_0111 | FA_R | float add, precision in register | 08_00000_0111 |
---|---|---|---|---|---|
Pulled:
• #0 exp, #1 man: augend • #2 exp, #3 man: addend Pushed:
If u8 is zero, FA_R is performed instead. | Pulled:
• #0 exp, #1 man: augend • #2 exp, #3 man: addend • #4 signed integer in 0…255: precision Pushed:
| ||||
FS_E | float subtract, precision embedded | u8_10000_0111 | FS_R | float subtract, precision in register | 08_10000_0111 |
Pulled:
• #0 exp, #1 man: minuend • #2 exp, #3 man: subtrahend Pushed:
If u8 is zero, FS_R is performed instead. | Pulled:
• #0 exp, #1 man: minuend • #2 exp, #3 man: subtrahend • #4 signed integer in 0…255: precision Pushed:
| ||||
FS_0E | float negate, precision embedded | u8_01000_0111 | FS_0R | float negate, precision in register | 08_01000_0111 |
Pulled:
• #0 exp, #1 man: negand Pushed:
If u8 is zero, FS_0R is performed instead. | Pulled:
• #0 exp, #1 man: negand • #3 signed integer in 0…255: precision Pushed:
| ||||
FM_E | float multiply, precision embedded | u8_11000_0111 | FM_R | float multiply, precision in register | 08_11000_0111 |
Pulled:
• #0 exp, #1 man: multiplicand • #2 exp, #3 man: multiplier Pushed:
If u8 is zero, FM_R is performed instead. | Pulled:
• #0 exp, #1 man: multiplicand • #2 exp, #3 man: multiplier • #4 signed integer in 0…255: precision Pushed:
| ||||
FD_E | float divide, precision embedded | u8_00100_0111 | FD_R | float divide, precision in register | 08_00100_0111 |
Pulled:
• #0 exp, #1 man: dividend • #2 exp, #3 man: divisor Pushed:
If u8 is zero, FD_R is performed instead. | Pulled:
• #0 exp, #1 man: dividend • #2 exp, #3 man: divisor • #4 signed integer in 0…255: precision Pushed:
| ||||
FD_1E | float reciprocal, precision embedded | u8_10100_0111 | FD_1R | float reciprocal, precision in register | 08_10100_0111 |
Pulled:
• #0 exp, #1 man: operand Pushed:
If u8 is zero, FD_1R is performed instead. | Pulled:
• #0 exp, #1 man: operand • #3 signed integer in 0…255: precision Pushed:
| ||||
FMA_E | float multiply and add, precision embedded | u8_01100_0111 | FMA_R | float multiply and add, precision in register | 08_01100_0111 |
Pulled:
• #0 exp, #1 man: multiplicand • #2 exp, #3 man: multiplier • #4 exp, #5 man: addend Pushed:
If u8 is zero, FMA_R is performed instead. | Pulled:
• #0 exp, #1 man: multiplicand • #2 exp, #3 man: multiplier • #4 exp, #5 man: addend • #6 signed integer in 0…255: precision Pushed:
| ||||
FMS_E | float multiply and subtract, precision embedded | u8_11100_0111 | FMS_R | float multiply and subtract, precision in register | 08_11100_0111 |
Pulled:
• #0 exp, #1 man: multiplicand • #2 exp, #3 man: multiplier • #4 exp, #5 man: addend Pushed:
If u8 is zero, FMS_R is performed instead. | Pulled:
• #0 exp, #1 man: multiplicand • #2 exp, #3 man: multiplier • #4 exp, #5 man: addend • #6 signed integer in 0…255: precision Pushed:
|
Integer-style division of floats. The remaining division operations are similar to those for integers. They involves two inputs (numerator N and denominator D) and two outputs (quotient Q and remainder R).
Here are the specifications:
Whatever the signs of N and D, Q is rounded toward negative infinity; no attempt is made to round Q to the nearest integer. Not observed is the usual float rounding rule, round-nearest-half-even.
Q will be trimmed as any other integer. The requested precision affects only R.
Another way to look at the operation is this:
A result is null if either input is null, or if there is division by zero.
FIL is a rough guide to the magnitude of a float. The result is signed integer n if the float's absolute value is at least 2**n, but less than 2**(n + 1). It is easy for the machine to calculate. Define the leader of a positive integer as the address (within the register) of its rightmost nonzero bit. The leader of a negative integer is the leader of its absolute value, and the leader of zero or null is undefined. Then, for a float that is neither null nor zero, the result is obtained by adding the exponent to the mantissa's leader.
FR_E | float remainder, precision embedded | u8_00010_0111 | FR_R | float remainder, precision in register | 08_00010_0111 |
---|---|---|---|---|---|
Pulled:
• #0 exp, #1 man: numerator • #2 exp, #3 man: denominator Pushed:
If u8 is zero, FR_R is performed instead. | Pulled:
• #0 exp, #1 man: numerator • #2 exp, #3 man: denominator • #4 signed integer: precision Pushed:
| ||||
FQ_RE | float quotient and remainder, precision embedded | u8_10010_0111 | FQ_RR | float quotient and remainder, precision in register | 08_10010_0111 |
Pulled:
• #0 exp, #1 man: numerator • #2 exp, #3 man: denominator Pushed:
If u8 is zero, FQ_RR is performed instead. | Pulled:
• #0 exp, #1 man: numerator • #2 exp, #3 man: denominator • #4 signed integer in 0…255: precision Pushed:
| ||||
FQ | float quotient | ?_x_10111_0111 | FIL | float integer logarithm | ?_x_10111_0111 |
Pulled:
• #0 exp, #1 man: numerator • #2 exp, #3 man: denominator Pushed:
| Pulled:
• #0 exp, #1 man: operand Pushed:
#0new is null if #0.1old is null or zero. |
Format. (see also integer) The first instructions round-nearest-half-even the operand to a requested precision. The result is normalized and trimmed.
The last two instructions change the formatting of a float, but not its value. A programmer who desires the mantissa or exponent to be trimmed to a non-minimal size will need to invoke the integer instructions directly.
FF_RE | float format round, precision embedded | u8_01010_0111 | FF_RR | float format round, precision in register | 08_01010_0111 |
---|---|---|---|---|---|
Pulled:
• #0 exp, #1 man: operand Pushed:
If u8 is zero, FF_RR is performed instead. | Pulled:
• #0 exp, #1 man: operand • #3 signed integer in 0…255: precision Pushed:
| ||||
FF_N | float format normalize | ?_x_10111_0111 | FF_T | float format trim | ?_x_10111_0111 |
Pulled:
• #0 exp, #1 man: operand Pushed:
| Pulled:
• #0 exp, #1 man: operand Pushed:
|
Transcendental. The standard mathematical functions in the table below can be included on LT4335 implementations intended for scientific purposes. As compared to the other instruction tables, a condensed format has been used, because most of the operations are very similar to one another; the top row explains.
As usual, any null input ensures a null output.
FT…E | float transcendental <function>, precision embedded | u8_b5_0111 | FT…R | float transcendental <function>, precision in register | 08_b5_0111 | Comments |
---|---|---|---|---|---|---|
Pulled:
• #0 exp, #1 man: operand Pushed:
If u8 is zero, FT…R is performed instead. | Pulled:
• #0 exp, #1 man: operand • #3 signed integer in 0…255: precision Pushed:
| |||||
FT_R2E | flo tra square root, prec emb | u8_00110_0111 | FT_R2R | flo tra square root, prec reg | 08_00110_0111 | If operand is less than zero, result will be null. |
FT_R3E | flo tra cube root, prec emb | u8_10110_0111 | FT_R3R | flo tra cube root, prec reg | 08_10110_0111 | |
FT_EE | flo tra exponential, prec emb | u8_01110_0111 | FT_ER | flo tra exponential, prec reg | 08_01110_0111 | |
FT_LE | flo tra logarithm, prec emb | u8_11110_0111 | FT_LR | flo tra logarithm, prec reg | 08_11110_0111 | If operand is not greater than zero, result will be null. |
FT_CSE | flo tra circular sine, prec emb | u8_00001_0111 | FT_CSR | flo tra circular sine, prec reg | 08_00001_0111 | |
FT_HSE | flo tra hyperbolic sine, prec emb | u8_10001_0111 | FT_HSR | flo tra hyperbolic sine, prec reg | 08_10001_0111 | |
FT_ICSE | flo tra inverse circular sine, prec emb | u8_01001_0111 | FT_ICSR | flo tra inverse circular sine, prec reg | 08_01001_0111 | If absolute value of operand is greater than one, result will be null. Otherwise, −π ÷ 2 ≤ result ≤ +π ÷ 2. |
FT_IHSE | flo tra inverse hyperbolic sine, prec emb | u8_11001_0111 | FT_IHSR | flo tra inverse hyperbolic sine, prec reg | 08_11001_0111 | |
FT_CCE | flo tra circular cosine, prec emb | u8_00101_0111 | FT_CCR | flo tra circular cosine, prec reg | 08_00101_0111 | |
FT_HCE | flo tra hyperbolic cosine, prec emb | u8_10101_0111 | FT_HCR | flo tra hyperbolic cosine, prec reg | 08_10101_0111 | |
FT_ICCE | flo tra inverse circular cosine, prec emb | u8_01101_0111 | FT_ICCR | flo tra inverse circular cosine, prec reg | 08_01101_0111 | If absolute value of operand is greater than one, result will be null. Otherwise, 0 ≤ result ≤ π. |
FT_IHCE | flo tra inverse hyperbolic cosine, prec emb | u8_11101_0111 | FT_IHCR | flo tra inverse hyperbolic cosine, prec reg | 08_11101_0111 | If operand is less than one, result will be null. |
FT_CTE | flo tra circular tangent, prec emb | u8_00011_0111 | FT_CTR | flo tra circular tangent, prec reg | 08_00011_0111 | If operand approximates an odd multiple of π ÷ 2, result will be null because of overflow. |
FT_HTE | flo tra hyperbolic tangent, prec emb | u8_10011_0111 | FT_HTR | flo tra hyperbolic tangent, prec reg | 08_10011_0111 | |
FT_ICT_1E | flo tra inverse circular tangent, one argument, prec emb | u8_01011_0111 | FT_ICT_1R | flo tra inverse circular tangent, one argument, prec reg | 08_01011_0111 | −π ÷ 2 < result < +π ÷ 2. |
FT_IHTE | flo tra inverse hyperbolic tangent, prec emb | u8_11011_0111 | FT_IHTR | flo tra inverse hyperbolic tangent, prec reg | 08_11011_0111 | If absolute value of operand is not less than one, result will be null. |
FT_ICT_2E | flo tra inverse circular tangent, two arguments, prec emb | u8_00111_0111 | FT_ICT_2R | flo tra inverse circular tangent, two arguments, prec reg | 08_00111_0111 | see note below |
Pulled:
• #0 exp, #1 man: abscissa • #2 exp, #3 man: ordinate Pushed:
If u8 is zero, FA_ICT_2R is performed instead. | Pulled:
• #0 exp, #1 man: abscissa • #2 exp, #3 man: ordinate • #4 signed integer in 0…255: precision Pushed:
|
Generally, FT_ICT_2E and FT_ICT_2R return the inverse circular tangent of ordinate ÷ abscissa. According to the signs of ordinate and abscissa, however, the result may be increased or decreased by 2 × π. Also, a nonnull result is obtained when the abscissa is zero if the ordinate is not zero. The effect is that of the widely used atan2 function found in many computer languages, with an overall range of −π < result ≤ +π. Here are the details:
if… | then… |
---|---|
ordinate < 0 and abscissa < 0 | −π < result < −π ÷ 2 |
ordinate < 0 and abscissa = 0 | result = −π ÷ 2 |
ordinate < 0 and abscissa > 0 | −π ÷ 2 < result < 0 |
ordinate = 0 and abscissa > 0 | result = 0 |
ordinate > 0 and abscissa > 0 | 0 < result < +π ÷ 2 |
ordinate > 0 and abscissa = 0 | result = +π ÷ 2 |
ordinate > 0 and abscissa < 0 | +π ÷ 2 < result < +π |
ordinate = 0 and abscissa < 0 | result = +π |
ordinate = 0 and abscissa = 0 | result is null |