ueberpruefen

This commit is contained in:
2025-10-28 23:38:37 +01:00
parent c2c5dd1041
commit 8dab9bfd25
56 changed files with 13640 additions and 2002 deletions

View File

@@ -0,0 +1,65 @@
import { Temperature, TemperatureUnit } from '../../types';
/**
* Convert Fahrenheit to Celsius
*/
export function fahrenheitToCelsius(f: number): number {
return (f - 32) * (5 / 9);
}
/**
* Convert Celsius to Fahrenheit
*/
export function celsiusToFahrenheit(c: number): number {
return (c * 9 / 5) + 32;
}
/**
* Convert temperature between units
*/
export function convertTemperature(temp: Temperature, toUnit: TemperatureUnit): Temperature {
if (temp.unit === toUnit) {
return temp;
}
const value = temp.unit === 'F'
? fahrenheitToCelsius(temp.value)
: celsiusToFahrenheit(temp.value);
return { value: Math.round(value), unit: toUnit };
}
/**
* Format temperature for display
*/
export function formatTemperature(temp: Temperature): string {
return `${temp.value}°${temp.unit}`;
}
/**
* Convert pounds to kilograms
*/
export function poundsToKilograms(lb: number): number {
return lb * 0.453592;
}
/**
* Convert kilograms to pounds
*/
export function kilogramsToPounds(kg: number): number {
return kg / 0.453592;
}
/**
* Convert inches to centimeters
*/
export function inchesToCentimeters(inches: number): number {
return inches * 2.54;
}
/**
* Convert centimeters to inches
*/
export function centimetersToInches(cm: number): number {
return cm / 2.54;
}