News for hackers. Stuff that matters.
Re:Let the Type System do the Work by nagisa on Monday April 21, 2014 @04:02PM (#7623367)
Fahrenheit is not easily addable given current realisation of functionality and, if I recall correctly, somewhere in source code there’s a comment in which author explicitly states he doesn’t support units which don’t linearly correspond to SI-based unit.
Re:Let the Type System do the Work by jimktrains2 on Monday April 21, 2014 @05:25PM (#7624010)
The function to convert Fahrenheit to Celsius is a linear function of C and K?
Re:Let the Type System do the Work by cobbal on Monday April 21, 2014 @07:19PM (#7624642)
Linear in this case means y = m * x. The relationship between Fahrenheit and Celsius is affine (y = m * x + b)

For gory details: https://en.wikipedia.org/wiki/Affine_transformation

Re:Let the Type System do the Work by judk on Monday April 21, 2014 @10:48PM (#7625486)
Celsius is an affine transformation of Kelvin
Re:Let the Type System do the Work by jarrett on Tuesday April 22, 2014 @09:21AM (#7627449)
Exactly, which makes me wonder why the library can support Celsius but not Fahrenheit.

To say it in more detail: To transform between Celsius and Kelvin, you just translate. (That operation is supported in Dimensional.)

To transform between Fahrenheit and Celsius or Fahrenheit and Kelvin, you translate and scale.

We know that Dimensional can scale, because it supports things like miles to kilometers. We know it can translate, because it supports Celsius to Fahrenheit. Is it the combination of scaling and transforming that makes Fahrenheit impossible?

Re:Let the Type System do the Work by jimktrains2 on Tuesday April 22, 2014 @02:49PM (#7629564)
miles = constant * km though, you simply scale one to get the other.

f = m*c + b, which is both a scale and a transform.

Re:Let the Type System do the Work by jarrett on Tuesday April 22, 2014 @05:06PM (#7630449)
But as stated above, Dimensional already does Celsius to Kelvin and vice-versa. Which is indeed of the form you just stated:

f = m*c + b

where m is simply equal to 1. Why wouldn't Fahrenheit conversion be the same thing, just with different constants?

Re:Let the Type System do the Work by jimktrains2 on Thursday April 24, 2014 @08:39PM (#7644044)
Me no reed gud :-\

Yeah, you're correct.