If we'd like to incorporate this into our website at some point, we need to have some limits to prevent devious users from crafting some nightmare expressions that chew up tons of time or memory.
Possible limits:
Parser should limit string size? (this could be a constraint added external to this library)
Parser should limit number size? (since Ruby will automatically upgrade to BigDecimal, etc)
Limit expression tree size? (this could probably be a pretty large limit, a limited input string would double as a constraint on expression tree size)
Limit distribution / expansion. (x + 1)^999 Or, just large exponents in general. 2^1000 is also probably pretty bad.
Make sure all loops conclude after some maximum number of iterations in attempt to avoid infinite loops. (as we already do in Solver... we'll also need to check #factors and #poly_div)
If we'd like to incorporate this into our website at some point, we need to have some limits to prevent devious users from crafting some nightmare expressions that chew up tons of time or memory.
Possible limits:
(x + 1)^999
Or, just large exponents in general.2^1000
is also probably pretty bad.Solver
... we'll also need to check#factors
and#poly_div
)