# High Throughput Natural Logarithm (Clock-Driven Logic)

Computes the base e natural logarithm of a specified input value.

If x is 0, ln is - $\infty$. If x is not complex and is less than 0, ln is not a number (NaN).

## x

An input for this operation. x must be in the range [1/e, 1) and unsigned. The integer word length must be 0 bits.

This input supports only scalar values of the fixed-point data type.

Computing ln(x) When x is Outside the Valid Range

Complete the following steps to compute ln( x) when x is outside the range [1/e, 1):

1. Shift the binary point of x until the binary point is immediately to the left of the first nonzero bit of x. The resulting number M always is greater than or equal to 0.5, which is in the valid range [1/e, 1).
2. Compute ln(M) + (E × ln(2)), where E is equal the number of times you shifted the binary point to the left. The result is equivalent to ln(x).
3. Because M is in the valid range of [1/e, 1), use this node to compute ln(M)
Note

If you shift the binary point to the right, E is the negative value of the number of times you shifted the point. For example, if you shift the binary point three places to the right, E is -3.

NI recommends a binary shift to transform x into M because this operation requires fewer FPGA resources than a division operation.

## input valid

Boolean value that specifies whether the next data point is valid and can be processed.

Wire output valid of an upstream node to this input to transfer data from the upstream node to this node.

 True The data point is valid and can be processed. False The data point is not valid.

## ready for output

Boolean value that specifies whether downstream nodes are ready for this node to return a new value.

Use Feedback Node to wire this input to the ready for input input of a downstream node. If this input is False during a given cycle, output valid returns False during that cycle.

 True The downstream node is ready for the next data element. False The downstream node is not ready for the next data element.

Default: False

## ln(x)

Natural logarithm of x. If x is outside the range [1/e, 1), ln(x) is undefined.

## undefined

A Boolean that indicates whether ln(x) is undefined.

 TRUE ln(x) is undefined. FALSE ln(x) is not undefined.

## output valid

Boolean value that indicates whether this node computes a result that downstream nodes can use.

Wire this output to the input valid input of a downstream node to transfer data from the node to the downstream node.

 True Downstream nodes can use the result this node computes. False This node returns an undefined value that downstream nodes cannot use. Note This node may return different undefined values when executed in simulation mode versus when executed on hardware.

## ready for input

Boolean value that indicates whether this node is ready to accept new input data.

Use Feedback Node to wire this output to the ready for output output of an upstream node.

 True The node is ready to accept new input data. False The node is not ready to accept new input data.
Note

If this output returns False during a given cycle, this node discards any data that other nodes send to this node during the following cycle. This node discards the data even if input valid is True during the following cycle.

Where This Node Can Run:

Desktop OS: none

FPGA: All devices

Web Server: Not supported in VIs that run in a web application