Split out of #733 at @Happypig375's request — "the inclusion of those functions belong to their own issue".
#733 was about these names being silently read as products (floor(x) → floor * x). That is fixed: every one of them is now refused by name, with a message saying what is missing. What is left is the functions themselves, which is a feature rather than a defect.
Measured on master (21f0d16)
|
|
floor(x) |
UnrecognizedFunctionParseException |
ceil(x) |
UnrecognizedFunctionParseException |
round(x) |
UnrecognizedFunctionParseException |
min(3, 5) |
UnrecognizedFunctionParseException |
max(3, 5) |
UnrecognizedFunctionParseException |
gcd(12, 18) |
UnrecognizedFunctionParseException |
For contrast, the neighbours that do exist:
|
|
sign(x) |
sgn(x) |
abs(x) |
abs(x) |
Why they are not just three more grammar lines
log10 and factorial were added to the grammar because a node already existed behind them. These have no node, so each needs a decision before a rule:
floor / ceil / round — need a node, a derivative (zero almost everywhere, undefined on the integers), a Latexise form, and a rule for what they mean on a complex argument. round additionally needs a tie-breaking convention (half away from zero, or half to even).
min / max — expressible as (a + b - abs(a - b))/2 and (a + b + abs(a - b))/2, so they could be sugar over abs rather than nodes. That is a design choice: sugar simplifies well and prints badly, a node prints well and needs its own rules everywhere.
gcd — only defined on integers, so it needs a decision about what it does with a symbolic or non-integer argument. Providedf is the obvious answer but is worth agreeing before implementing.
Adding any of these introduces a new Entity subtype, which is a breaking change for consumers that switch exhaustively over the node hierarchy — see #248 for that discussion.
Sensible to take them separately rather than as one change; min/max are the cheapest and round the most opinionated.
Split out of #733 at @Happypig375's request — "the inclusion of those functions belong to their own issue".
#733 was about these names being silently read as products (
floor(x)→floor * x). That is fixed: every one of them is now refused by name, with a message saying what is missing. What is left is the functions themselves, which is a feature rather than a defect.Measured on
master(21f0d16)floor(x)UnrecognizedFunctionParseExceptionceil(x)UnrecognizedFunctionParseExceptionround(x)UnrecognizedFunctionParseExceptionmin(3, 5)UnrecognizedFunctionParseExceptionmax(3, 5)UnrecognizedFunctionParseExceptiongcd(12, 18)UnrecognizedFunctionParseExceptionFor contrast, the neighbours that do exist:
sign(x)sgn(x)abs(x)abs(x)Why they are not just three more grammar lines
log10andfactorialwere added to the grammar because a node already existed behind them. These have no node, so each needs a decision before a rule:floor/ceil/round— need a node, a derivative (zero almost everywhere, undefined on the integers), aLatexiseform, and a rule for what they mean on a complex argument.roundadditionally needs a tie-breaking convention (half away from zero, or half to even).min/max— expressible as(a + b - abs(a - b))/2and(a + b + abs(a - b))/2, so they could be sugar overabsrather than nodes. That is a design choice: sugar simplifies well and prints badly, a node prints well and needs its own rules everywhere.gcd— only defined on integers, so it needs a decision about what it does with a symbolic or non-integer argument.Providedfis the obvious answer but is worth agreeing before implementing.Adding any of these introduces a new
Entitysubtype, which is a breaking change for consumers that switch exhaustively over the node hierarchy — see #248 for that discussion.Sensible to take them separately rather than as one change;
min/maxare the cheapest androundthe most opinionated.