bfoz / units-ruby

Add support for units of measure to Ruby's Numeric class
BSD 2-Clause "Simplified" License
5 stars 3 forks source link

Operator comparisons #37

Open bfoz opened 10 years ago

bfoz commented 10 years ago

Comparing operator proxies needs to work, despite not having a good way to do it. Even a bad way is better than not working at all.

At the very least, a proxy should be comparable with a Units::Numeric by converting the proxy to the Numeric's unit.

bfoz commented 10 years ago

Implemented comparisons with Units::Numeric.

The SquareRoot portion of the implementation may be wrong. It squares the target units before doing the conversion so that the proxy units after calling sqrt() will match the target units. I’m not sure what the desired behavior is.