rubysolo/dentaku

Unhandled Math::DomainError

sliiser opened this issue · 1 comments

Some functions (namely asin and acos) are only defined on a specific domain. If input outside of that domain is passed, Math::DomainError is raised and is not handled properly.

Dentaku('asin(2)') #=> Math::DomainError: Numerical argument is out of domain - "asin"

It should return nil for the non-bang variants

I went on to fix it myself, but couldn't figure out what error to raise there. Make a new Dentaku::MathDomainError? raise generic Dentaku::Error? What should the approach be?

Good call -- I think a new exception would be appropriate for this.