You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Kelly Chen <kc...@successfactors.com> on 2009/06/16 20:17:40 UTC

JEXL divide by zero

Currently in ASTDivNode.java and ASTModNode.java, we explicitly catch
div/0 and return 0. The code snippet looks like the following:

 

        /*

         * catch div/0

         */

        if (r.doubleValue() == 0.0) {

            return new Double(0.0);

        }

 

I just wonder what is the consideration for handling this way instead of
throwing an ArithemticException.  Right now this behavior hides the
divided by zero issue and generates some result that is not necessary
correct depends on the usage.

 

Thanks.




The information contained in this message may be legally privileged and confidential.  It is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited.  If you have received this message in error, please immediately notify the sender and/or SuccessFactors, Inc. by telephone at (650) 645-2000 and delete or destroy any copy of this message.