mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
the decay values seems to have problems - maybe because its out of scope of numeric. Use string instead
This commit is contained in:
parent
2c77785b77
commit
371d7921fe
@ -1,11 +1,14 @@
|
|||||||
import Decimal from 'decimal.js-light'
|
import Decimal from './decimal'
|
||||||
import CONFIG from '../config'
|
import CONFIG from '../config'
|
||||||
import { Decay } from '../graphql/model/Decay'
|
import { Decay } from '../graphql/model/Decay'
|
||||||
|
|
||||||
// TODO: externalize all those definitions and functions into an external decay library
|
// TODO: externalize all those definitions and functions into an external decay library
|
||||||
|
|
||||||
function decayFormula(value: Decimal, seconds: number): Decimal {
|
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(
|
function calculateDecay(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user