[calc] Add guards to pow and mul functions to avoid hangs.

- Fixes #538.

- Removed the drivel from calc when exceptions are raised. Printing the actual
  error might not be pretty, but at least it's not completely useless.