gentooboontoo / js-quantities

JavaScript library for quantity calculation and unit conversion
http://gentooboontoo.github.io/js-quantities/
MIT License
396 stars 102 forks source link

Fix for temperature conversion bug + ability to calculate inverses #2

Closed rage-shadowman closed 11 years ago

rage-shadowman commented 11 years ago

Implemented a fix for the Celsius <--> Fahrenheit conversion bug that was logged against your branch.

Also added ability to calculate the inverse of quantities (for Ohm <--> Siemens conversion).

Added unit tests for both.

rage-shadowman commented 11 years ago

I am new to github, so please let me know if this is not the right way send a pull request (or if I should try to push the fix some other way).

gentooboontoo commented 11 years ago

Good work. I will review and merge your pull request in the next days.

rage-shadowman commented 11 years ago

Thanks. I just fixed an issue with rate conversions so now only "unit" conversions use base offset in their calculations. I believe this is correct behavior, though I'm not a math whiz so I'm uncertain in what circumstances you might use "degC^2" for instance (whether that is always a rate, or if it can sometimes be a unit).

I shouldn't be committing anything more to this repo (although that's what I thought yesterday too, before I realized the rate issue).

If you can think of more/better unit tests to find any more failures please do so. Everything I could think of that might cause failures I have added as unit tests and then fixed the code to make the broken ones pass.

rage-shadowman commented 11 years ago

My fork should now behave exactly the same as ruby-units wrt temperatures and temperature degrees. If I missed any spots, please add unit test for the broken behavior and I will try to fix it.

gentooboontoo commented 11 years ago

Sorry for the lag... Great work (and huge pull request)! (It was even useful for ruby-units with the fix of the very old conductance definition typo).

Thanks.

rage-shadowman commented 11 years ago

:) glad to contribute to such a useful library