0 BEGIN PGM 8185_EN MM 1 ;NC program for rounding a value. At the 2 ;program start you define the numerical 3 ;value and the decimal place to which it is 4 ;to be rounded. The control then makes 5 ;calculations and saves the rounded value 6 ;in parameter Q31. 7 ; 8 ; 9 ;Enter values 10 Q30 = 12.6453 ;Number to be rounded 11 FN 0: Q40 =+0.02 ;Value it is to be rounded 12 ; 13 ;Calculations 14 FN 4: Q41 =+1 DIV +Q40 15 Q31 = INT ( ( Q30 * Q41 ) + ( 0.5 * SGN ( Q30 * Q41 ) ) ) / Q41 16 ; 17 ;The rounded value is now saved in Q31 18 STOP 19 ; 20 ;End of program 21 M30 22 END PGM 8185_EN MM