No subject

Zane Motteler zcm@llnl.gov
Fri, 16 Jan 1998 13:03:32 -0800


Carlos Maltzahn wrote:

>Assuming n is an integer matrix. If you expect float results from matrix
>operations you should have the matrices typed as float in the first
>place. This would ensure that all operations result in floats.

He's right. It is important to understand the distinction between what
is a float and what is an int. At the hardware level, ints and floats
have different representation and different operations--and the result
of an int-on-int operation is always an int.

Furthermore, I have reams and reams of code (graphics stuff) where I
do very heavy computation of subscripts and subscript arrays, computation
which frequently involves divides and mods. Subscripts have to be ints.
Which brings us to Carlos's second point:

>Also, I've come across plenty of situations where I want integer division
>with integer results. In these cases I would pay a big performance penalty
>if Python would do float operations with results that I would have to
>convert back to integers.

Precisely.

--Zane


-----------------------------------------------------------------
                      Zane C. Motteler, Ph. D.
Computer Scientist             | Professor Emeritus of
Lawrence Livermore National    |    Computer Science and Engineering
   Laboratory                  | California Polytechnic
P. O. Box 808, L-472           |    State University
(7000 East Avenue, zip 94550)  | San Luis Obispo, CA 93407
Livermore, CA 94551-9900       | zmottel@phoenix.csc.calpoly.edu
510/423-2143, FAX 423-9969 (Area code 925 after March 14, 1998)
zcm@llnl.gov



_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________