Fix unit conversion rounding (#3519)

This commit is contained in:
DingDongSoLong4 2023-03-10 03:21:00 +02:00 committed by GitHub
parent 1c8aa46da5
commit 579c5ad8b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1,11 +1,11 @@
export function cmToImperial(cm: number) {
const cmInInches = 0.393700787;
const inchesInFeet = 12;
const inches = Math.floor(cm * cmInInches);
const inches = Math.round(cm * cmInInches);
const feet = Math.floor(inches / inchesInFeet);
return [feet, inches % inchesInFeet];
}
export function kgToLbs(kg: number) {
return Math.floor(kg * 2.20462262185);
return Math.round(kg * 2.20462262185);
}