Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
SemiFaculty.cs
1using System;
6
8{
13 {
23 {
24 }
25
31 public override IElement Evaluate(double Operand)
32 {
33 if (Operand < 0 || Math.Truncate(Operand) != Operand)
34 throw new ScriptRuntimeException("Operand must be a non-negative integer.", this);
35
36 double Result = 1;
37
38 while (Operand > 0)
39 {
40 Result *= Operand;
41 if (double.IsInfinity(Result) || double.IsNaN(Result))
42 throw new ScriptRuntimeException("Overflow.", this);
43
44 Operand -= 2;
45 }
46
47 return new DoubleNumber(Result);
48 }
49 }
50}
Class managing a script expression.
Definition: Expression.cs:39
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Base class for unary double operators.
SemiFaculty(ScriptNode Operand, int Start, int Length, Expression Expression)
Semi-Faculty operator.
Definition: SemiFaculty.cs:21
override IElement Evaluate(double Operand)
Evaluates the double operator.
Definition: SemiFaculty.cs:31
Basic interface for all types of elements.
Definition: IElement.cs:20