CEP 516 in pure mode
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 26 Mar 2009 04:56:52 +0000 (21:56 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 26 Mar 2009 04:56:52 +0000 (21:56 -0700)
Cython/Shadow.py

index c6c1a77741610334e6a0a64fed1beffd00dd7784..1fe9dc19a540b8539d439cc5d87b5d6305245ce8 100644 (file)
@@ -6,6 +6,19 @@ def empty_decorator(x):
 def locals(**arg_types):
     return empty_decorator
 
+# Special functions
+
+def cdiv(a, b):
+    q = a / b
+    if q < 0:
+        q += 1
+
+def cmod(a, b):
+    r = a % b
+    if (a*b) < 0:
+        r -= b
+    return r
+
 
 # Emulated language constructs