the decay values seems to have problems - maybe because its out of scope of numeric. Use string instead

This commit is contained in:
Ulf Gebhardt 2022-02-27 03:12:07 +01:00
parent 2c77785b77
commit 371d7921fe
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -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(