Skip to content

Commit

Permalink
fixes documentation for SQRT function (#502)
Browse files Browse the repository at this point in the history
  • Loading branch information
uklimaschewski authored Sep 15, 2024
1 parent 53a8e99 commit 9d3b7f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/references/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Available through the _ExpressionConfiguration.StandardFunctionsDictionary_ cons
| NOT(value) | Boolean negation, implemented as a function (for compatibility) |
| RANDOM() | Produces a random value between 0 and 1 |
| ROUND(value, scale) | Rounds the given value to the specified scale, using the current rounding mode |
| SQRT(value) | Square root function |
| SQRT(value) | Square root function. Uses the implementation from _The Java Programmers Guide To numerical Computing_ by Ronald Mak, 2002. |
| SUM(value, ...) | Returns the sum of all parameters. If a parameter is of type _ARRAY_, the sum of all elements is calculated. |
| SWITCH(expression, value1, result1, [value2-N, result2-N ...], [default]) | Returns the _result_ correponding to the first matching _value_ in the specified _expression_ or an optional _default_ value if no match found. |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
import java.math.BigInteger;
import java.math.MathContext;

/** Square root function, uses the standard {@link BigDecimal#sqrt(MathContext)} implementation. */
/**
* Square root function, uses the implementation from <i>The Java Programmers Guide To numerical
* Computing</i> by Ronald Mak, 2002.
*/
@FunctionParameter(name = "value", nonNegative = true)
public class SqrtFunction extends AbstractFunction {

Expand All @@ -34,8 +37,9 @@ public EvaluationValue evaluate(

/*
* From The Java Programmers Guide To numerical Computing
* (Ronald Mak, 2003)
* (Ronald Mak, 2002)
*/

BigDecimal x = parameterValues[0].getNumberValue();
MathContext mathContext = expression.getConfiguration().getMathContext();

Expand Down

0 comments on commit 9d3b7f4

Please sign in to comment.