/// <summary> /// Get the Inverse Hyperbolic Tangent of an input. /// </summary> /// <param name="arguments">Input to have its Inverse Hyperbolic Tangent calculated.</param> /// <param name="context">Unused, this is information about where the function is being executed.</param> /// <returns>Returns the Inverse Hyperbolic Tangent of a given number</returns> public override CompileResult Execute(IEnumerable <FunctionArgument> arguments, ParsingContext context) { if (this.ArgumentCountIsValid(arguments, 1) == false) { return(new CompileResult(eErrorType.Value)); } var argument = arguments.First().Value; if (!ConvertUtil.TryParseObjectToDecimal(argument, out double result)) { return(new CompileResult(eErrorType.Value)); } return(this.CreateResult(AdvancedTrigonometry.InverseHyperbolicTangent(result), DataType.Decimal)); }
/// <summary> /// Get the cosecant of an input. /// </summary> /// <param name="arguments">Input to have its cosecant calculated.</param> /// <param name="context">Unused, this is information about where the function is being executed.</param> /// <returns>Returns the cosecant of an angle.</returns> public override CompileResult Execute(IEnumerable <FunctionArgument> arguments, ParsingContext context) { if (this.ArgumentCountIsValid(arguments, 1) == false) { return(new CompileResult(eErrorType.Value)); } var argument = arguments.First().Value; if (!ConvertUtil.TryParseObjectToDecimal(argument, out double result)) { return(new CompileResult(eErrorType.Value)); } if (AdvancedTrigonometry.TryCheckIfCosecantWillHaveADivideByZeroError(result, out double cosecant)) { return(new CompileResult(eErrorType.Div0)); } return(this.CreateResult(AdvancedTrigonometry.Cosecant(result), DataType.Decimal)); }