rekka / meval-rs

Math expression parser and evaluation library for Rust
The Unlicense
153 stars 30 forks source link

Add factorial and log10 #19

Closed abagshaw closed 5 years ago

abagshaw commented 5 years ago

Add support for the ! (factorial) Unary operator, as well as add the log10(x) function.

Also, replace the panic!s during evaluation with a new general error, Error::EvalError allowing the client to catch the error rather than forcing things to blow up.

rekka commented 5 years ago

Thanks for the pull request. I'll try to have a look at it over the weekend.

abagshaw commented 5 years ago

Thanks, I think I'm also going to have a go at refactoring the error handling to make it a little more streamlined, consistent and to remove all panic!s. Feel free to wait for that and I can bundle those changes with this PR, or I can do that in another one.

rekka commented 5 years ago

Looks good, thanks! I'm not sure how I feel about EvalError since the panics were indicating a library bug rather than an expected error, but I suppose that it's better for the library not to panic.