Fix class cast exceptions inside UnaryMathOp

Perform proper class casts to prevent exceptions
from occuring and add unit tests around them.
Merge remote-tracking branch 'upstream/master'
Remove a caleb-statement
Merge pull request #29 from strazzere/master

Fix class cast exceptions inside UnaryMathOp