Merge pull request #2000 from DrSmugleaf/murica-helpers
Add helpers for converting to and from Fahrenheit
This commit is contained in:
@@ -9,9 +9,31 @@ namespace Content.Shared.Utility
|
|||||||
return celsius + PhysicalConstants.ZERO_CELCIUS;
|
return celsius + PhysicalConstants.ZERO_CELCIUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float CelsiusToFahrenheit(float celsius)
|
||||||
|
{
|
||||||
|
return celsius * 9 / 5 + 32;
|
||||||
|
}
|
||||||
|
|
||||||
public static float KelvinToCelsius(float kelvin)
|
public static float KelvinToCelsius(float kelvin)
|
||||||
{
|
{
|
||||||
return kelvin - PhysicalConstants.ZERO_CELCIUS;
|
return kelvin - PhysicalConstants.ZERO_CELCIUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float KelvinToFahrenheit(float kelvin)
|
||||||
|
{
|
||||||
|
var celsius = KelvinToCelsius(kelvin);
|
||||||
|
return CelsiusToFahrenheit(celsius);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float FahrenheitToCelsius(float fahrenheit)
|
||||||
|
{
|
||||||
|
return (fahrenheit - 32) * 5 / 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float FahrenheitToKelvin(float fahrenheit)
|
||||||
|
{
|
||||||
|
var celsius = FahrenheitToCelsius(fahrenheit);
|
||||||
|
return CelsiusToKelvin(celsius);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user