The function of mathematical computation in a programming language is of course essential, and it is simple to implement the mathematical Computing Library through the basic mathematical functions of the L scripting language.
In the L scripting language, you need to import the library before using it, which is similar to the C-language import jar package that references java.
The following example is a library file for an L scripting language
#scplib
#数学函数库
Definition: function, the circumference of the circle, radius
Start: function to find the perimeter of a circle
Calculation: formula, ret,2*3.14* radius
Display: RET
End: function to find the circumference of a circle
Definition: function, area of circle, radius
Start: function to find the area of a circle
Calculation: Formula, ret,3.14* (RADIUS * radius)
Display: RET
End: function to find the area of a circle
Definition: function, exponentiation, NUM1
Start: function, exponentiation
Calculation: Formula, RET,NUM1*NUM1
Display: RET
End: function, exponentiation
Definition: function, square, NUM1
Start: function, square
Calculation: Formula, RET,NUM1*NUM1
Display: RET
End: function, square
Definition: function, three times, NUM1
Start: function, three-time Square
Calculation: Formula, RET,NUM1*NUM1*NUM1
Display: RET
End: function, three-time Square
Definition: function, remainder, num1,num2
Start: function, find remainder
Calculation: Formula, ret,num1%num2
Display: RET
End: function, seek remainder
Definition: function, the average of three numbers, n1,n2,n3
Start: function, calculate the average of three numbers
Calculation: Equation, eee, (N1+N2+N3)/3
Display: eee
End: function, averaging of three numbers
The following script file is an example program that uses the above library of mathematical functions
#scp
Import: library, D:\SCRIPTENGINE\SCRIPTS\TESTSCRIPT_NUMERIC_LIB.SCP
Definitions: integers, rid2,10
Definitions: integers, rid,100
Definitions: integers, number1,8
Definitions: integers, number2,9
Definitions: integers, number3,100
Show: "Now the circumference of the circle"
Call: function, round perimeter, RID
Show: "Now the area of the circle"
Call: function, Rid2 area of the circle,
Invoke: Function, exponentiation, number1
Call: function, seek remainder, Number2,number1
Call: function, three-time Square, number1
Call: function, the average of three numbers, Number1,number2,number3
Call: function, average of three numbers, 100,200,300
Definition: String, user-entered string
Wait: User input, user input string
L A library of simple mathematical functions written in scripting languages