The main value
The secondary value
The decimals of the value.
Optional
precision: numberThe precision of the result. Default is 3.
The percentage with the given precision
calcPercentage('100', '10', 2) // 10
calcPercentage(50, 75, 0) // 150
calcPercentage(BigInt(125e9), '62500000000', 9) // 50
calcPercentage('1234567898765432123456789', '617283949382716061728394', 18) // 50
Calculates the percentage of the given secondary value from the main value