From: Robert Bradshaw Date: Sat, 28 Mar 2009 20:11:40 +0000 (-0700) Subject: Fix for #260, float floor div X-Git-Tag: 0.12.alpha0~334^2~2^2~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f793ca17ebbf90eae4189a3fb07ca7280c6e352c;p=cython.git Fix for #260, float floor div --- diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 282ecb3c..89c5281e 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -4265,7 +4265,11 @@ class DivNode(NumBinopNode): code.putln("}") def calculate_result_code(self): - if self.cdivision: + if self.type.is_float and self.operator == '//': + return "floor(%s / %s)" % ( + self.operand1.result(), + self.operand2.result()) + elif self.cdivision: return "(%s / %s)" % ( self.operand1.result(), self.operand2.result())