Why is #INF displayed in my instruction?

Updated March 18, 2025

You may have come across a scenario in Cx-Programmer where the value of a memory address shows #INF as its value.

This is telling you that the value of that memory address is evaluated as Infinity. This math error typical occurs as a result from floating point arithmetic. Below is a snippet of two scenarios. One where the value of D300 is showing +1.#INF Float, and the other is showing the value of D300 to be -1.#INF Float. 

For the instance on the left, D300 is being evaluated as a Floating Point data type (Float), with a value of Positive (+1) Infinity (#INF).

For the instance on the right, D300 is being evaluated as a Floating Point data type (Float), with a value of negative (-1) Infinity (#INF).

Floating Point Format

When data is expressed in a floating-point format, the following formula applies to conform to the IEEE745 standard.

 
 

Example

The simplest way that a #INF can be produced, is by executing a floating point divide, where the divisor word is +0.0. This can be positive or negative, and the result will be a reflection of the divisor word.

Another way this can occur, is from inadvertently moving data into the result word. Below shows an example where #7F80 is moved into D200. #7F80 satisfies the conditions for positive infinity, where the sign = 0, exponent =255, and the mantissa = 0.

 

This could occur from a math error, or from using overlapping memory areas. Avoid using overlapping memory areas or dividing by 0 where possible to avoid this scenario.

 
 

More information can be found in the CP1H/CP1L Programming Manual, Section 3-14.

Start a Conversation
This conversation is closed
Uploading...