You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
796 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { roundHalfUp } from "@/lib/math";
const KG_TO_LB = 2.20462;
const CM_TO_IN = 2.54;
/** kg → lbROUND_HALF_UP 保留 2 位GD-13 */
export function kgToLb(kg: number): number {
return roundHalfUp(kg * KG_TO_LB, 2);
}
/** cm → inROUND_HALF_UP 保留 2 位GD-13内部哈希/展示用) */
export function cmToIn(cm: number): number {
return roundHalfUp(cm / CM_TO_IN, 2);
}
/** MotherShip axel/quote 与 RPA 表单要求英寸为正整数(向上取整) */
export function toAxelWholeInches(inches: number): number {
return Math.max(1, Math.ceil(inches - Number.EPSILON));
}
/** MotherShip axel/quote 要求磅为正整数(向上取整) */
export function toAxelWholePounds(lb: number): number {
return Math.max(1, Math.ceil(lb - Number.EPSILON));
}