You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.4 KiB
42 lines
1.4 KiB
6 years ago
|
EnableExplicit
|
||
|
|
||
|
Global PBEx_Math
|
||
|
|
||
|
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
|
||
|
PBEx_Math = OpenLibrary(#PB_Any, "PB.Ex_Math_x86.dll")
|
||
|
CompilerElseIf #PB_Compiler_Processor = #PB_Processor_x64
|
||
|
PBEx_Math = OpenLibrary(#PB_Any, "PB.Ex_Math_x64.dll")
|
||
|
CompilerEndIf
|
||
|
|
||
|
If PBEx_Math
|
||
|
Prototype.d Calculate(Calculation.p-Unicode, ErrorOutput)
|
||
|
Global Calculate.Calculate = GetFunction(PBEx_Math, "Calculate")
|
||
|
|
||
|
EndIf
|
||
|
|
||
|
Define ErrorOutput$ = ""
|
||
|
|
||
|
Debug "1 + 2 - 1 = " + Calculate("1 + 2 - 1", @ErrorOutput$)
|
||
|
Debug "2^32 = " + Calculate("2^32", @ErrorOutput$)
|
||
|
Debug "5 + 2 * 2 = " + Calculate("5 + 2 * 2", @ErrorOutput$)
|
||
|
Debug "(10 + 20) * 10 = " + Calculate("(10 + 20) * 10", @ErrorOutput$)
|
||
|
Debug "pi * 4 = " + Calculate("pi * 4", @ErrorOutput$)
|
||
|
Debug "2.5 + 10 = " + Calculate("2.5 + 10", @ErrorOutput$)
|
||
|
Debug "Modulo = " + Calculate("2 % 1 == 0", @ErrorOutput$)
|
||
|
Debug "AND condition = " + Calculate("1 == 1", @ErrorOutput$)
|
||
|
Debug "sqrt(64) = " + Calculate("sqrt(64)", @ErrorOutput$)
|
||
|
Debug "round(5.4) = " + Calculate("round(5.4)", @ErrorOutput$)
|
||
|
Debug "is 5 ot 10 greater? = " + Calculate("max(5, 10)", @ErrorOutput$)
|
||
|
Debug "15 > 10? = " + Calculate("15 > 10", @ErrorOutput$)
|
||
|
Debug "sin(1.5708) = " + Calculate("sin(1.5708)", @ErrorOutput$)
|
||
|
|
||
|
CloseLibrary(PBEx_Math)
|
||
|
|
||
|
; IDE Options = PureBasic 5.60 (Windows - x64)
|
||
|
; CursorPosition = 19
|
||
|
; EnableXP
|
||
|
; EnableUser
|
||
|
; Executable = PB.Ex_MSSQL_x86.exe
|
||
|
; CompileSourceDirectory
|
||
|
; EnableCompileCount = 152
|
||
|
; EnableBuildCount = 6
|