Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:software:qview:qview_6:qcl_library:vc10divround [2017/02/03 15:57] – created qem103 | en: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 = **// | ||
+ | |||
+ | **C = **// | ||
+ | |||
+ | 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/ | ||
+ | | IN |GLOBAL /\\ SYSTEM| | ||
+ | | IN |GLOBAL /\\ SYSTEM| | ||
+ | | OUT |GLOBAL /\\ SYSTEM| | ||
+ | |||
+ | === 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 | ||
+ | </ | ||
+ | |||
+ | === Note === | ||