Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Xnor.cs
1using System;
6
8{
13 {
23 : base(Left, Right, Start, Length, Expression)
24 {
25 }
26
33 public override IElement EvaluateOptimizedResult(bool Left)
34 {
35 return null;
36 }
37
44 public override IElement Evaluate(bool Left, bool Right)
45 {
46 if (!(Left ^ Right))
47 return BooleanValue.True;
48 else
49 return BooleanValue.False;
50 }
51
58 public override IElement Evaluate(double Left, double Right)
59 {
60 ulong L, R;
61 bool LSigned;
62 bool RSigned;
63
64 if (Left != Math.Floor(Left) || Right != Math.Floor(Right))
66
67 if (Left < 0)
68 {
69 LSigned = true;
70 if (Left < long.MinValue)
72
73 L = (ulong)((long)Left);
74 }
75 else
76 {
77 LSigned = false;
78 if (Left > ulong.MaxValue)
80
81 L = (ulong)Left;
82 }
83
84 if (Right < 0)
85 {
86 RSigned = true;
87 if (Right < long.MinValue)
89
90 R = (ulong)((long)Right);
91 }
92 else
93 {
94 RSigned = false;
95 if (Right > ulong.MaxValue)
97
98 R = (ulong)Right;
99 }
100
101 L = ~(L ^ R);
102
103 if (LSigned && RSigned)
104 return new DoubleNumber((long)L);
105 else
106 return new DoubleNumber(L);
107 }
108 }
109}
Class managing a script expression.
Definition: Expression.cs:41
Base class for binary dual double/bool operators.
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
Boolean-valued number.
Definition: BooleanValue.cs:12
static readonly BooleanValue False
Constant false value.
static readonly BooleanValue True
Constant true value.
Unspecified Exclusive Xnor.
Definition: Xnor.cs:13
Xnor(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
Unspecified Exclusive Or.
Definition: Xnor.cs:22
override IElement Evaluate(bool Left, bool Right)
Evaluates the boolean operator.
Definition: Xnor.cs:44
override IElement Evaluate(double Left, double Right)
Evaluates the double operator.
Definition: Xnor.cs:58
override IElement EvaluateOptimizedResult(bool Left)
Gives the operator a chance to optimize its execution if it knows the value of the left operand....
Definition: Xnor.cs:33
Basic interface for all types of elements.
Definition: IElement.cs:21