This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Division by zero


Mostly out of curiosity, why doesn't division by zero raise an error?

#|kawa:1|# (/ 1 0)
1/0

But div does:

#|kawa:2|# (div 1 0)
/dev/stdin:3:1: warning - call to #<procedure div> throws
java.lang.ArithmeticException: / by zero
java.lang.ArithmeticException: / by zero
        at gnu.math.IntNum.divide(IntNum.java:591)
        at gnu.math.IntNum.divide(IntNum.java:661)
        at gnu.math.IntNum.quotient(IntNum.java:828)
        at gnu.kawa.functions.DivideOp.applyN(DivideOp.java:127)
        at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
        at gnu.mapping.Procedure.apply(Procedure.java:133)
        at gnu.mapping.Procedure.apply(Procedure.java:113)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:234)
        at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:348)
        at gnu.expr.ModuleExp.evalModule(ModuleExp.java:185)
        at kawa.Shell.run(Shell.java:281)
        at kawa.Shell.run(Shell.java:194)
        at kawa.Shell.run(Shell.java:175)
        at kawa.repl.main(repl.java:848)

Thanks,
JP


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]