2-207
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Math Instructions
2
Fraction
Fraction
The Fraction instruction finds the fractional part of a real number.
* If you omit an input parameter, the default value is not applied. A building error will occur.
The Fraction instruction finds the fractional part of real number In.
The following example is for when In is REAL#−123.456. The value of variable abc will be
REAL#−0.456.
• Use the CheckReal instruction (page 2-209) to see if the value of Out is positive infinity, negative
infinity, or nonnumeric data.
Instruction Name FB/FUN Graphic expression ST expression
Fraction Real Number
Fraction
FUN Out:=Fraction(In);
Variables
Name Meaning I/O Description Valid range Unit Default
In Real num-
ber
Input Real number Depends on data type.
---
*
Out Fractional
part
Output Fractional part Depends on data type. --- ---
Boolean
Bit strings Integers
Real
numbers
Times, durations,
dates, and text strings
BOOL
BYTE
WORD
DWORD
LWORD
USINT
UINT
UDINT
ULINT
SINT
INT
DINT
LINT
REAL
LREAL
TIME
DATE
TOD
DT
STRING
In OK OK
Out OK OK
Function
Additional Information
(@)Fraction
EN ENO
In Out
abc:=Fraction(REAL#-123.456);
LD ST
REAL#-123.456
abc
Fraction
EN ENO
In