-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Celsius_to_Fahrenheit and Fahrenheit_to_Celsius scalar functions #184
Comments
Maybe we should revisit this and add (proper, limited) support for dealing with °C and °F directly.
Note that you can do this today. Just add the following to your
(you might want to add Try it here. Also, did you notice that we have |
Another thing we can do right now is the following:
And then use it like so:
Try it here |
I like this (i.e. If we add the units Celsius and Fahrenheit, then numbat will also be able to add, subtract and divide them, all of which are unphysical operations. Someone may try to evaluate
While I know how to do this, I am suggesting we add these functions to the default interface, so that Linux users looking for an unit converter will not have to write code to do these conversions, and we can recommend numbat to them. |
@sharkdp I like your suggestion.
That shouldn't be a problem if each has its own dimension, right? Because then you can't combine the different temperature units without explicitly converting them. |
No, @archisman-panigrahi is right. It is still a problem. Adding two values in °C usually doesn't make any sense (unless one of them is an absolute value and the other one a relative value). It's kind of similar to DateTimes and durations. I think we probably need to add proper support in the language for units with additive offsets. A first step would be to add support for units that you can't do anything with... except convert to and from. |
I totally agree (with sharkdp/insect#68) that Celsius and Fahrenheit are problematic units to work with, and it's best not to support any arithmetic with them.
However, Celsius and Fahrenheit are among the most commonly converted units (to be frank, after moving to the US, this is the most frequent unit conversion I mentally do everyday, using the (approximate) formula c ≈ (f-30)/2)
I propose we include two functions (whose input and output are both scalar),
Celsius_to_Fahrenheit
andFahrenheit_to_Celsius
, which will work like the following.The text was updated successfully, but these errors were encountered: