narrowtux / abacus

Parses and evaluates mathematical expressions in Elixir. Inspired by math.js
MIT License
84 stars 18 forks source link

Accept `.2` and `2.` as floats #11

Closed am-kantox closed 6 years ago

am-kantox commented 7 years ago

Currently the formula’s parser fails with:

{:error, {1, :math_term_parser, ['syntax error before: ', '\'.\'']}}

on floats with omitted leading/trailing zero (.25 / 2..) It is quite common to have floats being written that way, so I would suggest it makes sense to accept this notation.

narrowtux commented 6 years ago

fixed with https://github.com/narrowtux/abacus/commit/0f58c68e8cf639fe9b3077d25e7abac580649451#diff-1bf48c3e78695d2c64a7fe61c41c5e7cL3