Commit 83ab0e26 authored by Stefan Behnel's avatar Stefan Behnel

Merge branch '0.22.x'

parents 51971799 68e229b4
......@@ -10241,11 +10241,20 @@ class DivNode(NumBinopNode):
except Exception, e:
self.compile_time_value_error(e)
def analyse_operation(self, env):
def _check_truedivision(self, env):
if self.cdivision or env.directives['cdivision']:
self.ctruedivision = False
else:
self.ctruedivision = self.truedivision
def infer_type(self, env):
self._check_truedivision(env)
return self.result_type(
self.operand1.infer_type(env),
self.operand2.infer_type(env))
def analyse_operation(self, env):
self._check_truedivision(env)
NumBinopNode.analyse_operation(self, env)
if self.is_cpp_operation():
self.cdivision = True
......
from __future__ import division
cimport cython
def doit(x,y):
"""
>>> doit(1,2)
......@@ -115,3 +117,15 @@ def float_mix_rev(float a):
(0.25, 0.0, 1.25, 1.0, 1.25, 1.0)
"""
return 1/a, 1//a, 5.0/a, 5.0//a, 5/a, 5//a
def infer_division_type():
"""
>>> v = infer_division_type()
double
>>> v
8333333.25
"""
v = (10000**2 - 1) / 12
print(cython.typeof(v))
return v
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment