I made a copy-paste of your code, just changed the name of "format" to "formt" to avoid internal collisions,
i get 3 messageboxes, first displays 2, second displays -1 and the third one displays 130.
The following is the exact code being compiled:
'Generated with PluriBASIC 6.0.74371.0
$ filename "hello_world.exe"
uses rtl64
' STARTS STR$.BIN
' Enter the stock code and functions here.
' END OF STR$.BIN
' STARTS PLURIBASIC_INIT.BIN
' Enter the stock code and functions here.
' END OF PLURIBASIC_INIT.BIN
' STARTS CALLBACKDATA.BIN
' CALLBACK data
' END OF CALLBACKDATA.BIN
' STARTS ENTRY_POINT.BIN
' Enttry point code
' END OF ENTRY_POINT.BIN
' Initializes various things in the script.
FUNCTION PluriBASIC_Initialize() AS LONG
END FUNCTION
function formt(double d, string f="") as string
return str(d)
end function
FUNCTION PBMAIN() AS LONG
DOUBLE d
STRING s
d = 1.6
s = STR(d)
print formt(1.4+1.1)
short b= -1
print formt(b)
string b=130.5
print formt(b)
END FUNCTION
PBMAIN() ' invoke entry point