[Numpy-discussion] Re: numpy, overflow, inf, ieee, and rich comparison
Charles Boncelet
boncelet at udel.edu
Fri Oct 27 13:59:57 EDT 2000
More information about the Python-list mailing list
Fri Oct 27 13:59:57 EDT 2000
- Previous message (by thread): [Numpy-discussion] Re: numpy, overflow, inf, ieee, and rich comparison
- Next message (by thread): Importing a module with dashes.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Ewing wrote: > > As a serious programmer, what I want is a straightforward > and efficient way to specify the operation I want performed. > You have phrased it quite clearly. I can't agree more. > Truncating and non-truncating division are very different > operations, used for very different purposes. Which one > I want depends on the algorithm I'm implementing. Whenever > I write a division in my code, I know which one I want. > But the only way I can tell Python which one to use > is indirectly, by manipulating the types of operands > I feed to the / operator. In my programs, I manage this issue by trying to never mix integer and floating point arithmetic. In C or Fortran, one can declare a variable to hold an integer or a float. Then a single division symbol (/) is sufficient. This thread started with the observation that Guido thinks that 2/3=0 was an incorrect design decision. Let me propose that 2/3=0 is a correct design decision. The *incorrect* decision was to leave the behavior of A/2 undetermined until the type of A is determined. If we need a second division symbol, let me suggest "//", i.e., 2//3 = 0.666... > > To me, this is so obviously wrong that I can't understand > how any serious programmer could think it was right. Well, since you put it that way, I have no option but to agree. :-) Charlie Boncelet -- Charles Boncelet 302-831-8008 Dept of Electrical and Computer Engineering 302-831-4316 (fax) University of Delaware boncelet at eecis.udel.edu http://www.eecis.udel.edu/~boncelet/
- Previous message (by thread): [Numpy-discussion] Re: numpy, overflow, inf, ieee, and rich comparison
- Next message (by thread): Importing a module with dashes.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list