You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: libscript/src/math.lcb
+39Lines changed: 39 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -76,6 +76,9 @@ public foreign handler MCMathEvalMaxNumber(in Left as Number, in Right as Number
76
76
77
77
public foreign handler MCMathEvalRandomReal(out Value as CDouble) returns nothing binds to "<builtin>"
78
78
79
+
public foreign handler MCMathEvalSqrtReal(in Operand as CDouble, out Value as CDouble) returns nothing binds to "<builtin>"
80
+
public foreign handler MCMathEvalSqrtNumber(in Operand as Number, out Value as Number) returns nothing binds to "<builtin>"
81
+
79
82
public foreign handler MCMathEvalConvertBase(in Operand as String, in Source as LCInt, in Target as LCInt, out Value as String) returns nothing binds to "<builtin>"
80
83
public foreign handler MCMathEvalConvertToBase10(in Operand as String, in Source as LCInt, out Value as LCInt) returns nothing binds to "<builtin>"
81
84
public foreign handler MCMathEvalConvertFromBase10(in Operand as LCInt, in Target as LCInt, out Value as String) returns nothing binds to "<builtin>"
@@ -565,6 +568,42 @@ end syntax
565
568
566
569
--
567
570
571
+
/**
572
+
Syntax: sqrt(<Operand>)
573
+
Summary: Square root operator.
574
+
Operand: An expression that evaluates to a number.
575
+
576
+
Example:
577
+
variable tVar as Number
578
+
put sqrt(9) into tVar -- tVar contains 3
579
+
580
+
Example:
581
+
variable tVar as Number
582
+
put the square root of 4 into tVar -- tVar contains 2
583
+
584
+
Description:
585
+
The square root of a number is the number which must be
586
+
squared to obtain number : sqrt(number)^2 is equal to number.
587
+
588
+
Tags: Math
589
+
*/
590
+
591
+
syntax SquareRootOperator is prefix operator with function chunk precedence
592
+
"the" "square" "root" "of" <Operand: Expression>
593
+
begin
594
+
MCMathEvalSqrtNumber(Operand, output)
595
+
end syntax
596
+
597
+
public handler Sqrt(in pOperand as Number) returns Number
598
+
variable tVar as Number
599
+
unsafe
600
+
MCMathEvalSqrtNumber(pOperand, tVar)
601
+
end unsafe
602
+
return tVar
603
+
end handler
604
+
605
+
--
606
+
568
607
/**
569
608
Summary: Converts the base of <Operand>
570
609
Operand: An expression that evaluates to a string.
0 commit comments