From 14fd8a04356c1295354b756bea5defe16a81b501 Mon Sep 17 00:00:00 2001 From: Sergio Alen Date: Sun, 3 May 2020 14:57:42 +0800 Subject: [PATCH] Fix rounding float to integer (#23) --- lib/helper.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helper.ts b/lib/helper.ts index 5f19ee7..c27ce6d 100644 --- a/lib/helper.ts +++ b/lib/helper.ts @@ -76,7 +76,7 @@ export function saveTypos(outDir: string, typos: string[], type: string) { // covert float number to integer export function floatToInt(float: number): number { - return Math.ceil(float * 255); + return Math.round(float * 255); } // convert interger to hex