How to calculate the difference between two rasters in QGIS?

Oh will you feel silly! ;-)

The result is actually correct. The two rasters are identical where they overlap. Where they do not, the result is NaN because you cannot do math with a non-existent value.


I´m not quite sure,if what bugmeont suggested is correct. I guess if both layers are equal the outcome of the new one should be a layer with zeros and not with no-data values.

edit: also yourpicture shows 0 there, where there is no overlap and NaN where you have overlap, which also does not fit to the explanation.