blob: 1544445d7ac8e87d04fd78b37895f14c81e8fc31 [file] [log] [blame]
using System.Collections.Generic;
namespace AppsheetEpplus;
public class N : ExcelFunction {
public override CompileResult Execute(
IEnumerable<FunctionArgument> arguments,
ParsingContext context) {
ValidateArguments(arguments, 1);
var arg = GetFirstValue(arguments);
if (arg is bool b) {
var val = b ? 1d : 0d;
return CreateResult(val, DataType.Decimal);
}
if (IsNumeric(arg)) {
var val = ConvertUtil.GetValueDouble(arg);
return CreateResult(val, DataType.Decimal);
}
if (arg is string) {
return CreateResult(0d, DataType.Decimal);
}
if (arg is ExcelErrorValue) {
return CreateResult(arg, DataType.ExcelError);
}
throw new ExcelErrorValueException(eErrorType.Value);
}
}