trunc function raises correct exception