I have a doubt to get the real price of a box x, if the price that is given is 521.53 already with a 12% discount applied what is the real price without the discount applied?
I have a doubt to get the real price of a box x, if the price that is given is 521.53 already with a 12% discount applied what is the real price without the discount applied?
First:
To get to 521.53 the discount was applied in this way:
X (1 - 0.12) = 521.53
If you solve for X you get this:
X = 521.53 / 0.88 which is approximately 592.65
If you know the final price $dblPrecioFinal
and the discount applied $dblPorCiento
, the formula, which serves to obtain the real price is:
$dblPrecioReal = $dblPrecioFinal/(1-$dblPorCiento);
Example:
$dblPrecioFinal=521.53;
$dblPorCiento=.12;
$dblPrecioReal = $dblPrecioFinal/(1-$dblPorCiento);
echo "PRECIO REAL: ";
echo round($dblPrecioReal,2);
Resultado:
PRECIO REAL: 592.65
1-0.12 = 0.88
521.53/.088
592.65
using round
to round decimals and use only two decimal digits.