Omron NJ-series User Manual page 224

Machine automation controller cpu unit software
Hide thumbs Also See for NJ-series:
Table of Contents

Advertisement

Data Processing
The floating-point format expresses only an approximate value. Therefore, there may be a difference
between the floating-point number and its true value. There is also a limited number of effective dig-
its for these values. Therefore, the following actions are taken when you perform calculations with
the floating-point format.
Rounding
If the real value exceeds the effective digits of the mantissa, the value is rounded off according to the
following rules.
• The result of the calculation will be the closest value to the value that can be expressed as a float-
ing-point number.
• If there are two values that are the closest to the real value (e.g., if the real value is the median
value of two approximate values), the mantissa with a least significant bit value of 0 is selected as
the result of the calculation.
Overflows and Underflows
An overflow occurs when the absolute value of the true value is larger than the maximum value that
can be expressed in the floating-point format. An underflow occurs when the absolute value of the
true value is smaller than the minimum value that can be expressed in the floating-point format.
• If an overflow occurs and the true value is positive, the result of the calculation is positive infinity. If
the true value is negative, the result of the calculation is negative infinity.
• If an underflow occurs and the true value is positive, the result of the calculation is positive zero. If
the true value is negative, the result of the calculation is negative zero.
Special Value Calculations
Calculations that involve special values (i.e., positive infinity, negative infinity, +0, 0, and nonnu-
meric data) are performed according to the following rules.
• Addition of positive and negative infinity results in nonnumeric data.
• Subtraction of two infinite values of the same sign results in nonnumeric data.
• Multiplication of +0 or 0 with infinity results in nonnumeric data.
• Division of +0 by itself, 0 by itself, or infinity by itself results in nonnumeric data.
• Addition of positive and negative zero results in positive zero.
• Subtracting +0 from itself or 0 from itself results in +0.
• Any arithmetic that involves nonnumeric data results in nonnumeric data.
• Comparison instructions (such as for the Cmp instruction) treat +0 and 0 as equal.
• If you compare nonnumeric data with anything else, the result is always not equal.
 Text String Data Format
All STRING variables are terminated with a NULL character (character code BYTE#16#00).
Converting Data Types
When you use a variable of a different data type, the data type is automatically converted in some
cases. You can also perform the conversion yourself with a data type conversion instruction.
Data Type Conversion
All variables must have data types. Programs must operate properly according to these data types.
For example, the left and right sides of an assignment expression should normally use the same
data type. In some cases, however, it may be necessary to assign data of a different data type to a
variable in order to program something successfully.
Example:
NJ-series CPU Unit Software User's Manual (W501)
6 Programming
6
6-37

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents