rekka/meval-rs

implementation for discontinuous functions

Closed this issue · 1 comments

Some functions given certain inputs can produce an undefined result as I am sure you are aware, so if at all possible having Expr.bind return an Option who's value is determined by a check for divide by zero would be appreciated. I realize that this isn't needed as rust checks divide by zero, but for the purpose of creating graphing libraries / calculators it would make sense to have an easy way to check if a function is undefined at any given point.

rekka commented

Thank you for the suggestion. I am just getting back to the repo after a long break...

I do understand the motivation to check individual operations for certain kinds of failure, but it is beyond the scope of this crate. My aim is to have as simple as possible implementation that basically just forward the operations to Rust std implementations. They do follow the IEEE-754 standard so 1. / 0. evaluates to +inf for example, and 0. / 0. evaluates to NaN.

Many cases of failed operations should be covered with Rust std's f64::is_finite.