Hello,

I would like to discuss the following code:

#***start***
import numpy as N

a = N.array((200), dtype = N.uint8)
print (a * 100) / 100

b = N.array((200, 200), dtype = N.uint8)
print (b * 100) / 100
#***stop***

The first print statement will print "200" because the uint8-value is
cast "upwards", I suppose. The second statement prints "[0 0]". I
suppose this is due to overflows during the calculation.

How can I tell numpy to do the upcast also in the second case, returning
"[200 200]"? I am interested in the fastest solution regarding execution
time. In my application I would like to store the result in an
Numeric.UInt8-array.

Thanks for every comment

Lars


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to