Preventing temperature going below absolute zero.

This commit is contained in:
Roland 2024-07-30 18:51:12 -06:00
parent 1a41cd6aac
commit 9dd027b86b
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680

View file

@ -35,6 +35,12 @@ export function TemperatureCalculator() {
newCelsius = roundDigits(numValue - 273.15);
newFahrenheit = roundDigits((newCelsius * 1.8) + 32);
}
if (newFahrenheit < -459.67) {
console.warn('Temperature was below absolute zero!');
newCelsius = -273.3;
newFahrenheit = -459.67;
newKelvin = 0;
}
setState({
celsius: newCelsius,
fahrenheit: newFahrenheit,