# floating point: precision and performance between a division and a subtraction for a ratio in decibels

To compare two images, the peak signal-to-noise ratio (PSNR) metric can be used, defined as follows:

$$mathrm {PSNR} = 10 cdot log_ {10} left ( frac { mathrm {MAX} ^ 2} { mathrm {MSE}} right) = 20 cdot log_ {10} ( mathrm {MAX}) – 10 cdot log_ {10} ( mathrm {MSE}) dB.$$

with $$mathrm {MAX}$$ being the maximum gray scale value ($$2 ^ 8-1 = 255$$ in my case), and $$mathrm {MSE}$$ being the mean square error.

My question is, between the definition with division ($$mathrm {PSNR} _ { div}$$) and subtraction ($$mathrm {PSNR} _ {-}$$), Which is the most numerically accurate? And which is the most computationally efficient?

I did an experiment with MATLAB R2015a, and for some MSE values, I have different scores. For example, knowing that the epsilon machine is $$epsilon = 2.2204e {-16}$$, for $$mathrm {MSE} = 1708.25$$ Y $$mathrm {MSE} = 1710.00$$, I have $$left | mathrm {PSNR} _ { div} – mathrm {PSNR} _ {-} right | = 1.42109e-14$$ Y $$7.10543e-15$$ respectively. What can I conclude?

Note: in $$mathrm {PSNR} _ {-}$$, $$20 cdot log_ {10} ( mathrm {MAX})$$ It can be reduced to a precalculated constant.