Data type real does not have enough precision to avoid the rounding error in your specific calculation. That is why you get a value very close to zero, but not zero as a result.
Try using data type extended instead.
Cheers