Question: Default handler for division_by_zero

Hello, I have a question regarding the behavior of the numeric event division_by_zero. The documentation of ?event says that "A division of a non-0 number by 0 should signal a division_by_zero event. The default action is to return a correctly signed infinity, if possible, and otherwise an undefined. This event is also properly signaled when an attempt is made to evaluate a function at an infinite singularity, e.g., ln(0)." Yet, when using the default settings, I get the following output: > NumericEventHandler( division_by_zero = default ): > 1/0; Error, numeric exception: division by zero > 1./0; Error, numeric exception: division by zero > 1/0.; Float(inf) > 1./0.; Float(inf) What makes the handler trow an error when an exact 0 is used? Should it not return a "correctly signed infinity" in the default case? Now, one could write a new handler, as stated in the documentation of ?NumericEventHandler: > MyHandler := proc(operator,operands,defVal) # MyHandler issues a warning, and then continues # with the default value. WARNING("division by zero in %1 with args %2",operator,operands); defVal end proc: > NumericEventHandler(division_by_zero=MyHandler): This results in a the correct handling : > 1/0; Warning, division by zero in `^` with args [0, -1] inf > 1./0; Warning, division by zero in `^` with args [0, -1] Float(inf) > 1/0.; Warning, division by zero in `/` with args [1, 0.] Float(inf) > 1./0.; Warning, devision by zero in `/` with args [1,0.] Float(inf) In this case, it does return an exact inf in the first case, and a Float(inf) in all other cases. This conforms to what the documentation says and/or at least feels more correct (especially for the second case). Or where is it stated when a division_by_zero triggers an exception instead? Also, note that on the one hand throwing an exception in the default case only occurs when the operator is `^`, while there is a difference between the results in the second/custom handler (MyHandler) on the other hand (i.e. inf for the first example, Float(inf) for the second). Regards, Franky.
Please Wait...