From f5417bcc8d414a03c5641e7e5c3010c396437599 Mon Sep 17 00:00:00 2001 From: Tom French Date: Fri, 29 Jul 2022 00:03:33 +0100 Subject: [PATCH] fix: use Math.round in place of truncating digits --- packages/loot-core/src/shared/rules.js | 2 +- packages/loot-core/src/shared/schedules.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/loot-core/src/shared/rules.js b/packages/loot-core/src/shared/rules.js index 033eb83..bfc7c98 100644 --- a/packages/loot-core/src/shared/rules.js +++ b/packages/loot-core/src/shared/rules.js @@ -199,5 +199,5 @@ export function makeValue(value, cond) { } export function getApproxNumberThreshold(number) { - return (Math.abs(number) * 0.075) | 0; + return Math.round(Math.abs(number) * 0.075); } diff --git a/packages/loot-core/src/shared/schedules.js b/packages/loot-core/src/shared/schedules.js index af92e06..6525a8b 100644 --- a/packages/loot-core/src/shared/schedules.js +++ b/packages/loot-core/src/shared/schedules.js @@ -221,7 +221,7 @@ export function extractScheduleConds(conditions) { export function getScheduledAmount(amount) { if (amount && typeof amount !== 'number') { - return ((amount.num1 + amount.num2) / 2) | 0; + return Math.round((amount.num1 + amount.num2) / 2); } return amount; }