AFC - Abacus Formula Compiler for Java

Numeric Operators In AFC

Arithmetic Operators

The supported numeric operators are shown by example below. The examples also show how operator precedence is taken into account.

Addition (+)
ABCDE
23.0=(C2 + D2)1.02.0
312.0=((C3 + D3) + E3)5.04.03.0
46.6...1.12.23.3

Subtraction (-)
ABCDE
62.0=(C6 - D6)3.01.0
71.0=((C7 - D7) - E7)5.03.01.0
8-4.4...1.12.23.3

Multiplication (*)
ABCD
1035.0=(C10 * D10)5.07.0
110.2...0.40.5

Precedence (* before +)
ABCDE
137.0=(C13 + (D13 * E13))1.02.03.0
149.0=((C14 + D14) * E14)1.02.03.0

Division (/)
ABCDE
162.5=(C16 / D16)10.04.0
178.0=(C17 - (D17 / E17))10.04.02.0
187.0...10.09.03.0
199.666666666666666...10.01.03.0

Division by zero
ABCD
20!+Inf/AE=(C20 / D20)1.00.0Excel says: #DIV/0!

Negation (-)
ABCD
22-10.0=(-C22)10.0
23-2.0=((-C23) - (-D23))5.03.0
24-1.0...-3.0-4.0

Percentage (%)
ABCDEF
260.15=(C26%)15.0
275.13=((((C27 + D27)%) + E27) + (F27%))3.04.05.06.0
283.377...1.12.23.34.4

Exponentiation (^)
ABCDEFG
30256.0=(C30 ^ D30)2.08.0
3124.0=((C31 ^ D31) + (E31 ^ (F31 + G31)))2.03.02.01.03.0
321240.0...4.05.06.02.01.0

Empty cells are 0
ABCDE
341.0=((C34 + D34) - E34)1.0
3517.0...17.0
36-2.0...2.04.0
370.0=(C37 * D37)3.0

Comparison Operators

These are operators that return a boolean value, which is either the number 1 (true) or 0 (false) internally, shown by example:

Equal (=)
ABCD
2false=(C2 = D2)10.020.0
3false...50.040.0
4true...50.050.0
5false...10.0
6false...10.0
7false...-10.0
8false...-10.0

Not equal (<>)
ABCD
10true=(C10 <> D10)10.020.0
11true...50.040.0
12false...50.050.0
13true...10.0
14true...10.0
15true...-10.0
16true...-10.0

Greater than (>)
ABCD
18false=(C18 > D18)10.020.0
19true...50.040.0
20false...50.050.0
21true...10.0
22false...10.0
23false...-10.0
24true...-10.0

Less than (<)
ABCD
26true=(C26 < D26)10.020.0
27false...50.040.0
28false...50.050.0
29false...10.0
30true...10.0
31true...-10.0
32false...-10.0

Greater or equal (>=)
ABCD
34false=(C34 >= D34)10.020.0
35true...50.040.0
36true...50.050.0
37true...10.0
38false...10.0
39false...-10.0
40true...-10.0

Less or equal (<=)
ABCD
42true=(C42 <= D42)10.020.0
43false...50.040.0
44true...50.050.0
45false...10.0
46true...10.0
47true...-10.0
48false...-10.0