From fb5ebd2d271cadf1eb8ee3e3de01ac53c315f0ba Mon Sep 17 00:00:00 2001 From: David Morrison Date: Wed, 20 Dec 2023 20:59:05 -0800 Subject: [PATCH] fix(label): use round instead of floor to improve round trip conversion between hex and label --- src/utility.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utility.ts b/src/utility.ts index 37a7109..9881e65 100644 --- a/src/utility.ts +++ b/src/utility.ts @@ -146,7 +146,7 @@ export function label_to_Hu(s:string): number { * */ export function JuMuHu_to_label(c:JuMuHu, precise=false): string { const divisor = precise ? 1 : 10 - return Math.floor(c.Ju/divisor)+Hu_to_label(c.Hu)+Math.floor(c.Mu*2/divisor) + return Math.round(c.Ju/divisor)+Hu_to_label(c.Hu)+Math.round(c.Mu*2/divisor) } /**