Background
- In WfSpecs, we allow users to work with numeric
VariableValues of type INT, DOUBLE
- We allow users to perform a few different
VariableMutationTypes on numeric VariableValues: ADD, SUBTRACT, MULTIPLY, DIVIDE
Proposal
We should support an exponentiation VariableMutationType that allows you to perform expressions such as:
x² -> x.pow(2)
sqrt(x) -> x.pow(0.5)
Acceptance Criteria
- Add an exponentiation
POW VariableMutationType enum
- Add
.pow() to LHExpression
- Support
POW only for numeric VariableValue cases
- A few special cases that come to mind:
| # |
Exponent |
Base |
Result |
| 1 |
0 |
x |
1 |
| 2 |
1 |
x |
x |
| 3 |
NaN |
x |
Exception |
| 4 |
x |
NaN |
Exception |
| 5 |
0 |
y < 0 |
Exception |
- Exceptions should be thrown as early as possible; for example if we know that the Exponent or Base are not numbers at PutWfSpec time, we should reject the request. If they can't be determined at PutWfSpec time, like Case 5, we should throw a
VAR_SUB_ERROR if the case is reached.
Out of Scope
No response
Implementation
Documentation
No response
Additional Context
No response
Background
VariableValues of type INT, DOUBLEVariableMutationTypes on numeric VariableValues:ADD,SUBTRACT,MULTIPLY,DIVIDEProposal
We should support an exponentiation
VariableMutationTypethat allows you to perform expressions such as:x²->x.pow(2)sqrt(x)->x.pow(0.5)Acceptance Criteria
POWVariableMutationTypeenum.pow()to LHExpressionPOWonly for numericVariableValuecasesVAR_SUB_ERRORif the case is reached.Out of Scope
No response
Implementation
Documentation
No response
Additional Context
No response