Use dtype specific comparison

This should remove dtype specific to float32 in the nightly buildbot.
Merge pull request #1447 from nouiz/err_msg

Use dtype specific comparison