PureBytes Links
Trading Reference Links
|
Dear Tomasz,
The new 3.70 Help is very well prepared again. Tutorials for new itemsis
the
certainly the best way.
I noticed something not so clear in
Modulus operator
A new operator (%) - modulus (or remainder) was
added:
result = number1 % number2
The modulus, or remainder, operator divides number1 by number2
(rounding floating-point numbers to integers) and returns onlythe
remainder as result.
The plural "numbers" in the parenthesis may be translated that we round
number1 and number2, then we divide and then take the remainder.
This would give 3.2%3.1==3%3==0, which is not the result of 3.2%3.1.
As I saw, the procedure is
3.2/3.1 gives 1.03
1.03 becomes 1 after rounding
3.2-3.1*1==0.1, which is the 3.2%3.1.
I saw that the generic formula behind % is
R1%R2==R1-R2*INT(R1/R2);
for positive, negative, integers or non-integers.
Is it O. K. ?
Please confirm.
Best regards
Dimitris Tsokakis
P. S. Please remember in some next edition to correct the typo in
EXAMPLE
The formula "atan( 1.00 )" returns PI/2
It is our only source for PI in AFL.
PI=4*atan(1);
|