From f793ca17ebbf90eae4189a3fb07ca7280c6e352c Mon Sep 17 00:00:00 2001 From: Robert Bradshaw Date: Sat, 28 Mar 2009 13:11:40 -0700 Subject: [PATCH] Fix for #260, float floor div --- Cython/Compiler/ExprNodes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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()) -- 2.26.2