static Temperature() { Kelvin = new ScaleUnit <Temperature>(_udic, 1); Celsius = new ScaleUnit <Temperature>(_udic, 1, -273.15); Fahrenheit = new ScaleUnit <Temperature>(_udic, 9 / 5.0, -459.67); DefaultParsers = new Lazy <Funnel <string, Temperature> >(() => new Funnel <string, Temperature>( new Parser <Temperature>($@"^({CommonRegex.RegexDouble}) ?(k|kelvin)$", m => new Temperature(double.Parse(m.Groups[1].Value), Kelvin)), new Parser <Temperature>($@"^({CommonRegex.RegexDouble}) ?(f|fahrenheit)$", m => new Temperature(double.Parse(m.Groups[1].Value), Fahrenheit)), new Parser <Temperature>($@"^({CommonRegex.RegexDouble}) ?(c|celsius)$", m => new Temperature(double.Parse(m.Groups[1].Value), Celsius)) )); }
public Temperature(BigRational val, IScaleUnit <Temperature> unit) : this(unit.ToArbitrary(val)) { }