From 371d7921fefa2cec53bd90a056dcda8720acfd2c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 27 Feb 2022 03:12:07 +0100 Subject: [PATCH] the decay values seems to have problems - maybe because its out of scope of numeric. Use string instead --- backend/src/util/decay.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/util/decay.ts b/backend/src/util/decay.ts index f0f1d181a..49317ad85 100644 --- a/backend/src/util/decay.ts +++ b/backend/src/util/decay.ts @@ -1,11 +1,14 @@ -import Decimal from 'decimal.js-light' +import Decimal from './decimal' import CONFIG from '../config' import { Decay } from '../graphql/model/Decay' // TODO: externalize all those definitions and functions into an external decay library function decayFormula(value: Decimal, seconds: number): Decimal { - return value.mul(new Decimal('0.99999997803504048973201202316767079413460520837376').pow(seconds)) + // TODO why do we need to convert this here to a stting to work properly? + return value.mul( + new Decimal('0.99999997803504048973201202316767079413460520837376').pow(seconds).toString(), + ) } function calculateDecay(