Ejemplo n.º 1
0
        public static TAlgebraicNumber Abs <TAlgebraicNumber>(
            this IAlgebraicNumberCalculator <TAlgebraicNumber> calculator,
            TAlgebraicNumber number)
        {
            if (calculator is null)
            {
                throw new ArgumentNullException(nameof(calculator));
            }

            return(calculator.IsStrictlyNegative(number)
                ? calculator.Opposite(number)
                : number);
        }
Ejemplo n.º 2
0
 public Direction <TAlgebraicNumber> Opposite() =>
 new Direction <TAlgebraicNumber>(_calculator, _calculator.Opposite(X), _calculator.Opposite(Y));