using System; using System.Collections.Generic; using System.Text; using Sunweaver.Commands.Attributes; namespace Sunweaver.Commands { /// /// /// [BasePair("Square root, but a little different from the standard square root. This returns the " + "signed square root. For instance, -25 sqrt would return -5. " + "Fraction results are rounded to the nearest integer. eg: 15 sqrt returns 4.")] public class sqrt : Abstracts.UnaryOperation { public override void Operation(long a) { VM.Stack.Push((long)Math.Sign(a) * (long)Math.Round(Math.Sqrt((double)Math.Abs(a)))); } } }