Author: Justin Peel <[email protected]>
Branch: unsigned-dtypes
Changeset: r47693:dd230c7003f6
Date: 2011-09-29 14:40 -0600
http://bitbucket.org/pypy/pypy/changeset/dd230c7003f6/
Log: Add some more comments about binop dtype result code
diff --git a/pypy/module/micronumpy/interp_ufuncs.py
b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -181,18 +181,22 @@
# Everything promotes to float, and bool promotes to everything.
if dt2.kind == interp_dtype.FLOATINGLTR or dt1.kind ==
interp_dtype.BOOLLTR:
+ # Float32 + 8-bit int = Float64
if dt2.num == 11 and dt1.num_bytes >= 4:
return space.fromcache(interp_dtype.W_Float64Dtype)
return dt2
# for now this means mixing signed and unsigned
if dt2.kind == interp_dtype.SIGNEDLTR:
+ # if dt2 has a greater number of bytes, then just go with it
if dt1.num_bytes < dt2.num_bytes:
return dt2
# we need to promote both dtypes
dtypenum = dt2.num + 2
else:
+ # increase to the next signed type (or to float)
dtypenum = dt2.num + 1
+ # UInt64 + signed = Float64
if dt2.num == 10:
dtypenum += 1
newdtype = interp_dtype.ALL_DTYPES[dtypenum]
@@ -201,6 +205,7 @@
return space.fromcache(newdtype)
else:
# we only promoted to long on 32-bit or to longlong on 64-bit
+ # this is really for dealing with the Long and Ulong dtypes
if LONG_BIT == 32:
dtypenum += 2
else:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit