log Floating Point Logarithm
| Library: | Floating Point Arithmetic |
Behavior
This component calculates one of four floating-point logarithmic functions, selected by the Logarithm Mode attribute. The result is rounded to the selected floating-point size.
- Arbitrary base
- Calculates the logarithm of the upper west input x using the lower west input y as its base. The implementation evaluates ln(x) / ln(y).
- Natural logarithm
- Calculates ln(x) from the single west input.
- Logarithm with base 10
- Calculates log10(x) from the single west input.
- Natural logarithm of (input + 1)
- Calculates ln(1 + x) from the single west input. This mode preserves better numerical accuracy than adding 1 before taking the logarithm when x is close to zero.
The ERR output is 1 when the result is NaN and 0 otherwise. An input containing unknown or error bits is converted to NaN. Other floating-point results, including positive or negative infinity, do not set ERR.
Pins
- West edge, north end (input, bit width matches Float size)
- The value x in Arbitrary base mode.
- West edge, south end (input, bit width matches Float size)
- The logarithm base y. This pin is present only in Arbitrary base mode.
- West edge, center (input, bit width matches Float size)
- The value x in any single-input logarithm mode.
- East edge (output, bit width matches Float size)
- The selected logarithmic result.
- South edge (output, bit width 1)
- ERR: 1 if the result is NaN; otherwise 0.
Attributes
- Float size
- The floating-point width of all inputs and the result: 8, 16, 32, or 64 bits.
- Logarithm Mode
- Selects arbitrary-base, natural, base-10, or natural-logarithm-of-one-plus-input operation.
Poke Tool Behavior
None.
Text Tool Behavior
None.