AFC - Abacus Formula Compiler for Java

Numeric Functions In AFC

Numeric Functions

The supported numeric functions are shown by example below:

ABS
ABC
21.0=ABS( C2 )-1.0
30.0...0.0
41.0...1.0
51.9999...-1.9999
61.9999...1.9999
70.0...false
81.0...true
93.0...-3.0
104.0...-4.0

ACOS
ABC
123.141592653589793=ACOS( C12 )-1.0
133.127450400112281...-0.9999
142.0943951023931957...-0.5
151.5708963267950633...-1.0E-4
161.5707963267948966...0.0
171.5706963267947298...1.0E-4
181.0471975511965976...0.5
190.014142253477511968...0.9999
200.0...1.0
21!NaN/FE...-1.0001Excel says: #NUM!
22!NaN/FE...1.0001Excel says: #NUM!

ACOSH
ABC
240.0=ACOSH( C24 )1.0
251.3169578969248166...2.0
261.762747174039086...3.0
272.1615809409653055...4.4
283.0630757460972857...10.72
293.705377831216652...20.345
305.298292365610485...100.0
317.600902209541989...1000.0
329.903487550036129...10000.0
3312.206072645505174...100000.0
3414.508657738523969...1000000.0
35!NaN/FE...0.98Excel says: #NUM!
36!NaN/FE...-1.0Excel says: #NUM!

ASIN
ABC
38-1.5707963267948966=ASIN( C38 )-1.0
39-1.5566540733173846...-0.9999
40-0.5235987755982989...-0.5
41-1.0000000016666668E-4...-1.0E-4
420.0...0.0
431.0000000016666668E-4...1.0E-4
440.5235987755982989...0.5
451.5566540733173846...0.9999
461.5707963267948966...1.0
47!NaN/FE...-1.0001Excel says: #NUM!
48!NaN/FE...1.0001Excel says: #NUM!

ASINH
ABC
500.0=ASINH( C50 )0.0
510.48121182505960347...0.5
52-0.48121182505960336...-0.5
531.4436354751788103...2.0
54-1.4436354751788099...-2.0
551.8184464592320668...3.0
562.3124383412727525...5.0
572.99822295029797...10.0
585.298342365610589...100.0
5912.206072645555174...100000.0
60-12.206073762186564...-100000.0

ATAN
ABC
62-1.5707963257948967=ATAN( C62 )-1.0E9
63-1.5697963271282298...-1000.0
64-0.7853981633974483...-1.0
65-0.09966865249116204...-0.1
66-9.999996666668668E-4...-0.0010
670.0...0.0
689.999996666668668E-4...0.0010
690.09966865249116204...0.1
700.7853981633974483...1.0
711.5697963271282298...1000.0
721.5707963257948967...1.0E9

ATANH
ABC
740.0=ATANH( C74 )0.0
750.10033534773107562...0.1
76-0.10033534773107562...-0.1
770.5493061443340549...0.5
78-0.5493061443340549...-0.5
790.8673005276940532...0.7
80-0.8673005276940531...-0.7
81!+Inf/FE...1.0Excel says: #NUM!
82!-Inf/FE...-1.0Excel says: #NUM!
83!NaN/FE...2.0Excel says: #NUM!
84!NaN/FE...1000.0Excel says: #NUM!

ATAN2
ABCD
86-2.356194490192345=ATAN2( C86, D86 )-1.0-1.0
87-0.7853981633974483...1.0-1.0
88-1.5707963267948966...0.0-1.0
892.356194490192345...-1.01.0
900.7853981633974483...1.01.0
911.5707963267948966...0.01.0
923.141592653589793...-1.00.0
930.0...1.00.0
940.0...0.00.0Excel says: #DIV/0!
95-9.999996666668668E-4...1000.0-1.0
969.999996666668668E-4...1000.01.0

GEOMEAN
ABCDEF
981.0=GEOMEAN( C98, D98 )1.01.0
993.0...3.03.0
1002.449489742783178...2.03.0
10112.0...2.072.0
1021.7211914478058505...1.252.37
103!FE...0.01.0Excel says: #NUM!
104!FE...1.0-1.0Excel says: #NUM!
105!FE...-2.0-3.0Excel says: #NUM!
1075.0=GEOMEAN( C107, D107, E107:F107 )5.05.05.05.0
1083.0...9.03.03.01.0
1094.949232003839765...50.02.03.02.0

HARMEAN
ABCDEF
1114.0=HARMEAN( C111, D111 )4.04.0
1121.0...1.01.0
1133.2...2.08.0
1142.6666666666666665...2.04.0
1151.6367403314917126...1.252.37
116!FE...0.01.0Excel says: #NUM!
117!FE...1.0-1.0Excel says: #NUM!
118!FE...0.0-1.0Excel says: #NUM!
1203.2=HARMEAN( C120, D120, E120:F120 )2.02.08.08.0
1212.206896551724138...16.04.02.01.0
1222.6666666666666665...4.02.04.02.0

PERMUT
ABCD
1242.0=PERMUT( C124, D124 )2.01.0
1256.0...3.03.0
1261.0...1.11.3
1272520.0...7.05.0
1286.0...3.42.1
129!FE...0.01.0Excel says: #NUM!
1301.0...0.00.0
131!FE...1.0-1.0Excel says: #NUM!
132!FE...-1.01.0Excel says: #NUM!
133!FE...0.0-1.0Excel says: #NUM!

RAND
AB
135true=(RAND() < 1.0)
137true=(RAND() > 0.0)
138true...
139true=(((((((((((RAND() + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) / 10.0) > 0.0)
140true=(((((((((((RAND() + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) + RAND()) / 10.0) < 1.0)
141false=(RAND() = RAND())
142false...

COS
ABC
1440.9367521275331392=COS( C144 )-1000000.0
145-0.9999999999730151...-3.1416
146-0.9999999999964793...-3.14159
1470.9950041652780258...-0.1
1480.9999995000000417...-0.0010
1491.0...0.0
1500.9999995000000417...0.0010
1510.9950041652780258...0.1
152-0.9999999999964793...3.14159
153-0.9999999999730151...3.1416
1540.9367521275331392...1000000.0

COSH
ABC
1561.0=COSH( C156 )0.0
1571.5430806348152437...1.0
1583.7621956910836314...2.0
1593.7621956910836314...-2.0
1601.3440585709080678E43...100.0
1611.8865101504649698E260...600.0
1621.8865101504649698E260...-600.0

SIGN
ABC
1640.0=SIGN( C164 )0.0
1651.0...1.0
1661.0...2.0
167-1.0...-1.0
168-1.0...-2.0
1691.0...10000.0
170-1.0...-10000.0

SIN
ABC
1720.3499935021713079=SIN( C172 )-1000000.0
1737.346410206643537E-6...-3.1416
174-2.6535897933527804E-6...-3.14159
175-0.09983341664682815...-0.1
176-9.999998333333417E-4...-0.0010
1770.0...0.0
1789.999998333333417E-4...0.0010
1790.09983341664682815...0.1
1802.6535897933527804E-6...3.14159
181-7.346410206643537E-6...3.1416
182-0.3499935021713079...1000000.0

SINH
ABC
1840.0=SINH( C184 )0.0
1851.1752011936438014...1.0
18611.53029203041011...3.14
187-1.1752011936438014...-1.0
188-74.20321057778875...-5.0
1891.3440585709080678E43...100.0
1903.6129868840628745E86...200.0
191-3.6129868840628745E86...-200.0
1921.5199748986808874E43...100.123
1934.109203730777486E307...709.0
194(sinh 710)...710.0Excel says: #NUM!

TAN
ABC
1960.37362445398761723=TAN( C196 )-1000000.0
197-7.346410206841779E-6...-3.1416
1982.653589793362123E-6...-3.14159
199-0.10033467208545055...-0.1
200-0.0010000003333334668...-0.0010
2010.0...0.0
2020.0010000003333334668...0.0010
2030.10033467208545055...0.1
204-2.653589793362123E-6...3.14159
2057.346410206841779E-6...3.1416
206-0.37362445398761723...1000000.0

TANH
ABC
2080.0=TANH( C208 )0.0
2090.7615941559557649...1.0
210-0.7615941559557649...-1.0
2110.9999999958776926...10.0
212-0.9999999958776926...-10.0
2131.0...100.0
214-1.0...-100.0
2151.0...10000.0
216-1.0...-1000.0
2170.9972829600991422...3.3
218-0.9972829600991422...-3.3

DEGREES
ABC
220-5.7295779513082325E7=DEGREES( C220 )-1000000.0
221-180.00042091829943...-3.1416
222-179.99469134034814...-3.1415
223-5.729577951308233...-0.1
224-0.057295779513082325...-0.0010
2250.0...0.0
2260.057295779513082325...0.0010
2275.729577951308233...0.1
228179.99469134034814...3.1415
229180.00042091829943...3.1416
2305.7295779513082325E7...1000000.0

RADIANS
ABC
232-17453.292519943294=RADIANS( C232 )-1000000.0
233-6.283185307179586...-360.0
234-3.141592653589793...-180.0
235-0.5235987755982988...-30.0
236-0.0017453292519943296...-0.1
2370.0...0.0
2380.0017453292519943296...0.1
2390.5235987755982988...30.0
2403.141592653589793...180.0
2416.283185307179586...360.0
24217453.292519943294...1000000.0

PI
AB
2443.141592653589793=PI()

CEILING
ABCD
2460.0=CEILING( C246, D246 )0.00.03
2470.03...0.029990.03
2480.03...0.030.03
2490.06...0.030010.03
250640000.0...512000.1128000.0
2510.0...0.0-0.03
252-0.03...-0.02999-0.03
253-0.06...-0.03001-0.03
254!FE...0.03001-0.03Excel says: #NUM!

FLOOR
ABCD
2560.0=FLOOR( C256, D256 )0.00.03
2570.0...0.029990.03
2580.03...0.030.03
2590.03...0.030010.03
260512000.0...639999.9128000.0
2610.0...0.0-0.03
2620.0...-0.02999-0.03
263-0.03...-0.03001-0.03
264!FE...0.03001-0.03Excel says: #NUM!

ROUND
ABCD
26612.0=ROUND( C266, D266 )12.00492.0
26712.01...12.0052.0
26813.0...12.9992.0
26912.0...12.00012.0
270-12.0...-12.00492.0
271-12.01...-12.0052.0
272-13.0...-12.9992.0
273-12.0...-12.00012.0

ROUND to left of decimal point
ABCD
27412300.0=ROUND( C274, D274 )12345.0-2.0
27510000.0...12345.0-4.0

ROUNDDOWN
ABCD
2773.0=ROUNDDOWN( C277, D277 )3.20.0
278120.0...123.456-1.0
2793.141...3.141593.0
2803.1415...3.141594.0
281-3.141...-3.141593.0
282-3.1415...-3.141594.0

ROUNDUP
ABCD
2844.0=ROUNDUP( C284, D284 )3.20.0
285130.0...123.456-1.0
2863.142...3.141593.0
2873.1416000000000004...3.141594.0
288-3.142...-3.141593.0
289-3.1416000000000004...-3.141594.0

TRUNC
ABCD
29112.0=TRUNC( C291 )12.999
29212.0...12.0
293-12.0...-12.0
294-12.0...-12.999
2950.0...0.0
2960.0...0.999
2970.0...-0.999
29812.0=TRUNC( C298, D298 )12.0092.0
29912.01...12.012.0
30012.99...12.9992.0
30112.0...12.0012.0
302-12.0...-12.02.0
303-12.0...-12.0092.0
304-12.01...-12.012.9
305-12.0...-12.0012.0
30612300.0...12345.0-2.0
30710000.0...12345.0-4.0

EVEN
ABC
309-4.0=EVEN( C309 )-3.0
310-4.0...-2.001
311-2.0...-2.0
312-2.0...-1.001
313-2.0...-1.0
3140.0...0.0
3152.0...1.0
3162.0...1.001
3172.0...2.0
3184.0...2.001
3194.0...3.0

ODD
ABC
321-3.0=ODD( C321 )-3.0
322-3.0...-2.0
323-3.0...-1.001
324-1.0...-1.0
325-1.0...-0.0010
3261.0...0.0
3271.0...0.0010
3281.0...1.0
3293.0...1.001
3303.0...2.0
3313.0...3.0

INT
ABC
333-3.0=INT( C333 )-3.0
334-3.0...-2.5
335-2.0...-2.0
336-2.0...-1.5
337-1.0...-1.0
3380.0...0.0
3391.0...1.0
3401.0...1.5
3412.0...2.0
3422.0...2.5
3433.0...3.0

EXP
ABC
3450.049787068367863944=EXP( C345 )-3.0
3460.0820849986238988...-2.5
3470.1353352832366127...-2.0
3480.22313016014842982...-1.5
3490.36787944117144233...-1.0
3501.0...0.0
3512.71828182845905...1.0
3524.4816890703380645...1.5
3537.38905609893065...2.0
35412.182493960703473...2.5
35520.085536923187668...3.0

POWER
ABCD
35765536.0=POWER( C357, D357 )256.02.0
358-1.84528125E8...-45.05.0
35920959.155637813903...1.011000.0
36016.0...256.00.5
36140.315403854658385...20.01.234
36221145.169098491155...1.011000.888
3630.09090909090909091...11.0-1.0
3640.4444444444444444...1.5-2.0
3650.005083366622820051...2.0-7.62
3661.0...0.00.0Excel says: #NUM!
367!NaN/FE...-4.00.5Excel says: #NUM!

LN
ABC
369-6.907755278982137=LN( C369 )0.0010
370-2.3025850929940455...0.1
3710.0...1.0
3720.009950330853168092...1.01
3730.999896315728952...2.718
3741.0002641656503337...2.719
37520.72326583694641...1.0E9
376!-Inf/FE...0.0Excel says: #NUM!
377!NaN/FE...-5.0Excel says: #NUM!

LOG
ABCD
379-3.0=LOG( C379 )0.0010
3800.0...1.0
3811.0...10.0
3821.0413926851582251...11.0
383-2.0959032742893844=LOG( C383, D383 )0.13.0
3840.0...1.03.0
3852.095903274289385...10.03.0
386-0.9163255830492104...0.112.34
3870.9163255830492106...10.012.34
3880.6566510978626311...0.10.03
389-0.6566510978626313...10.00.03
390!-Inf/FE=LOG( C390 )0.0Excel says: #NUM!
391!NaN/FE...-2.0Excel says: #NUM!
3920.0=LOG( C392, D392 )10.00.0Excel says: #NUM!
393!NaN/FE...10.0-2.0Excel says: #NUM!
394!-Inf/FE...0.010.0Excel says: #NUM!
395!NaN/FE...-2.010.0Excel says: #NUM!
396!+Inf/FE...2.01.0Excel says: #DIV/0!

LOG10
ABC
398-3.0=LOG10( C398 )0.0010
399-0.6989700043360187...0.2
4000.0...1.0
4010.004321373782642578...1.01
4021.0...10.0
4031.0004340774793186...10.01
4049.0...1.0E9
405!-Inf/FE...0.0Excel says: #NUM!
406!NaN/FE...-2.0Excel says: #NUM!

MOD
ABCD
4080.0=MOD( C408, D408 )33.0-3.0
4092.0...17.05.0
410-3.0...17.0-5.0
4113.0...-17.05.0
412-2.0...-17.0-5.0
4130.5...17.05.5
4141.84...34.02.01
415!NaN/AE...10.00.0Excel says: #DIV/0!

SQRT
ABC
4170.03162277660168379=SQRT( C417 )0.0010
4180.1...0.01
4190.99498743710662...0.99
4201.0...1.0
4211.004987562112089...1.01
4223.1622776601683795...10.0
42310.0...100.0
424316.22776601683796...100000.0
4250.0...0.0
426!NaN/FE...-1.0Excel says: #NUM!

FACT
ABC
428!FE=FACT( C428 )-1.0Excel says: #NUM!
4291.0...0.0
4301.0...1.0
4312.0...2.0
4326.0...3.0
43324.0...4.0
434120.0...5.0
435720.0...6.0
4365040.0...7.0
43740320.0...8.0
438362880.0...9.0
4393628800.0...10.0
4403.99168E7...11.0
4414.790016E8...12.0
4426.2270208E9...13.0
4438.71782912E10...14.0
4441.307674368E12...15.0
4452.43290200817664E18...20.0
4461.0...1.1
4471.0...1.9
4482.0...2.1

COMBIN
ABCD
4501.0=COMBIN( C450, D450 )0.00.0
4511.0...1.00.0
4521.0...1.01.0
4531.0...2.00.0
4542.0...2.01.0
4551.0...2.02.0
4561.0...3.00.0
4573.0...3.01.0
4583.0...3.02.0
4591.0...3.03.0
46010.0...10.01.0
461252.0...10.05.0
462120.0...10.07.0
463!FE...0.01.0Excel says: #NUM!
464!FE...1.0-1.0Excel says: #NUM!
465!FE...-1.01.0Excel says: #NUM!