
3 Oct
2002
3 Oct
'02
12:33 p.m.
Hi.
I have problems in understanding GiNaC policy regarding the choice of exceptions thrown.
The operator `operator/' defined on objects of the class `numeric' throws a `runtime_error' in the case of a division by zero. In contrast, the `operator/' defined on objects of the class `ex' throws a `logic_error' in the case of a division by zero.
Why is there such a difference?
According to the standard, the exception `logic_error' should be used when errors could have been detected before program execution: I thus believe that a `runtime_error' should be thrown even in the case of an `ex' object.
The same argument hold for the exception thrown by `power': logic_error: power::eval(): division by zero.
Thanks Tatiana Zolo
8253
Age (days ago)
8253
Last active (days ago)
0 comments
1 participants
participants (1)
-
Tatiana Zolo