ToDouble() public method

public ToDouble ( ) : double
return double
		public override ScriptNumber Clamp (ScriptNumber min, ScriptNumber max)
		{
			if (m_Value < min.ToDouble ())
				return new ScriptNumberDouble(m_Script, min.ToDouble());
			if (m_Value > max.ToDouble ())
				return new ScriptNumberDouble(m_Script, max.ToDouble());
			return new ScriptNumberDouble(m_Script, m_Value);
		}
 public override ScriptObject AssignCompute(TokenType type, ScriptNumber obj)
 {
     switch (type)
     {
         case TokenType.AssignPlus:
             m_Value += obj.ToDouble();
             return this;
         case TokenType.AssignMinus:
             m_Value -= obj.ToDouble();
             return this;
         case TokenType.AssignMultiply:
             m_Value *= obj.ToDouble();
             return this;
         case TokenType.AssignDivide:
             m_Value /= obj.ToDouble();
             return this;
         case TokenType.AssignModulo:
             m_Value %= obj.ToDouble();
             return this;
         default:
             throw new ExecutionException(Script, "Double不支持的运算符 " + type);
     }
 }
Exemplo n.º 3
0
 public ScriptNumber Pow(ScriptNumber value)
 {
     return(base.m_Script.CreateDouble(Math.Pow(this.ToDouble(), value.ToDouble())));
 }
Exemplo n.º 4
0
 public ScriptNumber Pow(ScriptNumber value)                                                                             //取几次方
 {
     return(m_Script.CreateDouble(Math.Pow(ToDouble(), value.ToDouble())));
 }
 public override ScriptObject Compute(TokenType type, ScriptNumber obj)
 {
     switch (type)
     {
         case TokenType.Plus:
             return Script.CreateDouble(m_Value + obj.ToDouble());
         case TokenType.Minus:
             return Script.CreateDouble(m_Value - obj.ToDouble());
         case TokenType.Multiply:
             return Script.CreateDouble(m_Value * obj.ToDouble());
         case TokenType.Divide:
             return Script.CreateDouble(m_Value / obj.ToDouble());
         case TokenType.Modulo:
             return Script.CreateDouble(m_Value % obj.ToDouble());
         default:
             throw new ExecutionException(Script, "Double不支持的运算符 " + type);
     }
 }
Exemplo n.º 6
0
		public ScriptNumber Pow (ScriptNumber value) {									//取几次方
			return m_Script.CreateDouble (Math.Pow (ToDouble(), value.ToDouble()));
		}