return ErrorEval.NUM_ERROR;
}
final double result = Math.sqrt(Math.PI * d);
+ //NumberToTextConverter reduces the precision to what Excel uses internally
+ //without this conversion, `result` is too precise
return new NumberEval(Double.parseDouble(NumberToTextConverter.toText(result)));
} catch (EvaluationException e) {
return e.getErrorEval();
//https://support.microsoft.com/en-us/office/sqrtpi-function-1fb4e63f-9b51-46d6-ad68-b3e7a8b519b4
@Test
void testBasic() {
+ //the expected values were observed in my copy of Excel
confirmValue(Arrays.asList(1), 1.77245385090552);
confirmValue(Arrays.asList(2), 2.506628274631);
}