LOG(x,y) function doesn't seem to work in LibreOffice Basic

The following function in a LibreOffice Basic module returns the value 4.60517018598809, instead of a value of log 100 base 10, or 2. I’m new to LibreOffice macros, so do they have a separate set of functions from those available in Calc?

Function TEST()
	TEST = LOG(100,10)
End Function

Doc for this function:


Yes, spreadsheet functions and BASIC functions are absolutely unrelated; it’s inevitable that some names coincide - especially when they have a natural name for the function. You may see the difference of BASIC function documentation (provided by mauricio) vs spreadsheet function.

See also tdf#131382.

If you want to use a Calc function inside a BASIC program you must use an LibreOffice API call.

Example: Calling Calc functions in Basic:

Function Test(x, y)
    Dim oService As Object
    oService = createUnoService("com.sun.star.sheet.FunctionAccess")
    REM Always use the function English name
   Test = oService.callFunction("LOG",Array(x,y))
End Function