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

"C" as Celsius recognized, but "°C" is not #50

Open g-liu opened 8 years ago

g-liu commented 8 years ago

It would be wonderful if the degree symbol was recognized as part of a temperature unit. Then, there would be no need to strip out the ° symbol when performing calculations or conversions.

MikiDi commented 8 years ago

I agree that support for °C would be great, although it's not easy to implement as the temperature units are a very special case (discussion here #1 and here #37) ... btw, 'C' is the SI-symbol for Coulomb (that's why it was recognized, see here), you can use 'tempC' for a temperature in °C

MeirionHughes commented 6 years ago

Is this really that difficult? the definition: "By international agreement, since 1954 the unit "degree Celsius" and the Celsius scale are defined by absolute zero... This definition also precisely relates the Celsius scale to the Kelvin scale, which defines the SI base unit of thermodynamic temperature with symbol K... This means that a temperature difference of one degree Celsius and that of one kelvin are exactly the same."

edit: I see from the implementation why its problematic now.

perhaps you could have 1 °C = 274.15 K and 1 Δ°C = 1 K

OR 1 °C = 274.15 K and 1 C° = 1 K

"This is sometimes solved by using the symbol °C (pronounced "degrees Celsius") for a temperature, and C° (pronounced "Celsius degrees") for a temperature interval, although this usage is non-standard.[27]" ref: https://en.wikipedia.org/wiki/Celsius

bcowgill commented 4 years ago

Also one can use the unicode ℃ ℉ as an alias