How calculate error function in Calc

I have been attempting to calculate the error function for a number but cannot determine how to do this in Calc. I get a “BASIC runtime error. Variable not defined.” error. The code I used is:

Blockquote
Option Explicit
Sub Main
DIM num As Double
num = ERF.PRECISE(0.5)
print num
End Sub
Blockquote

Any suggestions would be greatly appreciated. Thanks.

https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1sheet_1_1FunctionAccess.html

fa = createUnoService("com.sun.star.sheet.FunctionAccess")
r = fa.callFunction("ERF.PRECISE", Array(0.5))
print r
1 Like

Thanks so much! That worked great