Coder-Spirit / php-bignumbers

A robust library to handle immutable big numbers inside PHP applications
MIT License
131 stars 29 forks source link

Add convenient comparison methods isGreaterThan() etc. #59

Closed petrkotek closed 7 years ago

petrkotek commented 7 years ago

This PR adds functions like isGreaterOrEqualTo($b, $scale). Reason for these methods is readability.

I believe, that $a->isGreaterThan($b) is much easier to understand than $a->comp($b) === 1.

Let me know, what you think. I noticed that there currently is equals() method, so I'd be OK with renaming these functions to $a->greaterThan($b) (or maybe also adding isEqualTo()) for consistency.

Note: Wiki would also need to be updated.

Thanks for a great library & consideration of this contribution!

petrkotek commented 7 years ago

@castarco: any thoughts around this?

castarco commented 7 years ago

Hi, excuse me for being so slow responding to PRs. I'll take a look.