PureBytes Links
Trading Reference Links
|
Mike,
>From the Help manual:
Operator precedence and the parentheses
AFL supports parentheses in formulas.
Parentheses can be used to control the operation precedence (the order in
which the operators are calculated). AmiBroker always does operations within
the innermost parentheses first. When parentheses are not used, the
precedence is as follows (higher precedence listed first):
NoSymbolMeaning
1^Exponentiation
2-Negation - Unary minus
3*Multiplication
4/Division
5+Addition
6-Subtraction
7<Less than
8>Greater than
9<= Less than or equal to
10>=Greater than or equal to
11==Equal to
12!=Not equal to
13&Bit-wise "And" (AFL 2.1+)
14|Bit-wise "Or" (AFL 2.1+)
15NOTLogical "Not"
16ANDLogical "And"
17ORLogical "Or"
18=Variable assignment operator
So....lets breakdown your formula.....
x=100 - 100 / (1 + 30 / 0);
Filter=1;
AddColumn(x,"");//Original formula
AddColumn((1 + 30 / 0),"");//Parenthesis get executed first and Division
before addition..so...30 divided by 0 = 0 ...1 + 0 = 1
AddColumn(100 / (1 + 30 / 0),"");//100 divided by 1 = 100
AddColumn(100-100,"");//100 - 100 = 0
Anthony
-------Original Message-------
From: amibroker@xxxxxxxxxxxxxxx
Date: Sunday, March 02, 2003 22:00:48
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] [Tomasz] 1 / 0 = 0?
Tomasz,
AB returning 0 for an expression like 1 / 0. Is it correct?
The following expression
100 - 100 / (1 + 30 / 0)
is equal 0 in AB, but I think it should be equal 100.
Thanks,
Mike
Yahoo! Groups Sponsor
ADVERTISEMENT
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq
html
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------------------------ Yahoo! Groups Sponsor ---------------------~-->
DVD Rentals with No Late Fees - Try Netflix for FREE!
http://us.click.yahoo.com/abvVKB/pEZFAA/46VHAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|