A result of 5.91 feet does not mean 5 feet 91 inches, and 5.10 feet does not mean 5 feet 10 inches. That is the representation problem I wanted to unpack when looking at a meters-to-feet converter: a correct scalar conversion can still be misunderstood if the output unit is not explicit.
This comes up constantly with height. A JavaScript calculation returns an ordinary decimal number, while readers may expect a compound expression containing two different units. Those are different output formats, and the conversion page implements only the first.
Convert One Length Unit into Another
The page uses a shared unit table rather than a special height formula. The relevant scales are one meter per meter and 0.3048 meters per foot.
The shared function first converts the source value to meters and then divides by the destination scale:
export function convertLength ( value , fromKey , toKey ) { const meters = ( Number ( value ) || 0 ) * ( lengthUnitMap [ fromKey ] || 0 ) ; return lengthUnitMap [ toKey ] ?…