Avoid divisions by zero when simplifying numeric calculations.
Merge pull request #153 from simartin/ticket_4930

Fixed #4930 ((error) Internal Error: Division by zero)