Change coupon discount calculation

I’m new in Magento, and if someone can bring me some light is there a way to overwrite the calculation method when discount is applyed?

Mage version 1.9.4.

The problem is for eaxmple how mage is calculating the product price exl. vat , and apply VAT after discount

//We have this rounding in Mage.
function roundPrice($price){
    return round($price, 2);
}

$productPrice = 61.67;
$qty = 2;
$discount = 25; //25%

$subTotal = roundPrice($productPrice * $qty);

$discount = roundPrice($productPrice - ($productPrice / 100) * $discount);

var_dump($subTotal - 30.84 (Fixed discount amount)); // Result float(92.5)

var_dump($discount); // Result float(92.51) I need to get this one cent instead of mage default calculation from convert percent into fixed