Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:software:qview:qview_6:qcl_library:vc10divround [2017/02/03 15:57] – created qem103en:software:qview:qview_6:qcl_library:vc10divround [2019/08/29 17:01] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== VC10DivRound ======
 +
 +**V = **//Variables//
 +
 +**C = **//Calculation functions//
 +
 +The VC10DivRound function __divides a number by a factor 10 or a multiple of 10 and applies an approximation by the method of rounding__. The value is then first divided by the 10^cdec value and then the following rule is applied: 
 +  * If the figure immediately to the right of the decimal point is  1, 2, 3 or 4 it leaves unchanged the integer value
 +  * If is 5, 6, 7, 8 or 9 it increases by one the integer value
 +the function then returns the integer value of the number. 
 +
 +===== IMPLEMENTATION =====
 +
 +**VC10DivRound (valIn, cdec, valOut)**
 +
 +Parameters:
 +
 +^IN/OUT^VARIABLE TYPE^EXAMPLE NAME^DIM^^
 +|  IN  |GLOBAL /\\    SYSTEM|  valIn  |  L  |Value to be processed|
 +|  IN  |GLOBAL /\\    SYSTEM|  cdec  |  B  |Number of decimal digits (0÷3)|
 +|  OUT  |GLOBAL /\\    SYSTEM|  valOut  |  L  |Return value (rounded)|
 +
 +=== Example ===
 +
 +In the example you want to round the value passed to 565, with two decimal places.\\
 +The resulting value will be 6.
 +
 +<code QCL>
 +MAIN:
 +valIn = 565
 +cdec = 2
 +VC10DivRound (valIn, cdec, valOut)
 +
 +glVarArrot = valOut
 +
 +WAIT 1
 +JUMP MAIN
 +END
 +</code>
 +
 +=== Note ===