Suggestion: minmax operator

2007-01-09 Thread Joe Gottman
Since Perl6 is going to have infix min and max operators, it might be a good idea to have an infix minmax operator, defined by $a minmax $b === ($a min $b), ($a max B); #2-element list This would be especially useful as a reduction operator: my ($min, $max) = [EMAIL PROTECTED]; Joe Gottman

Re: Numeric Semantics

2007-01-09 Thread Jonathan Lang
Mark J. Reed <[EMAIL PROTECTED]> wrote: I believe mod should be defined in the conventional way: x mod y = x - floor(x/y) * y, which does yield 0.8 for 3.2 mod 2.4. However, for 3.2 mod - 2.4 it yields -1.6. To get 0.8 you would have to round toward zero instead of taking the floor, and that co

Re: Numeric Semantics

2007-01-09 Thread Mark J. Reed
I believe mod should be defined in the conventional way: x mod y = x - floor(x/y) * y, which does yield 0.8 for 3.2 mod 2.4. However, for 3.2 mod - 2.4 it yields -1.6. To get 0.8 you would have to round toward zero instead of taking the floor, and that complicates any computation that crosses ze

Re: Numeric Semantics

2007-01-09 Thread Doug McNutt
At 17:35 +0100 1/9/07, TSa wrote: >May I use this to remind the list that I proposed to define the modulus in the >most algebraically pleasing way, i.e. in the Euclidean definition. >(See http://www.cs.uu.nl/~daan/download/papers/divmodnote-letter.pdf) >E.g. this modulus is also defined for Comple

Re: Numeric Semantics

2007-01-09 Thread TSa
HaloO, Darren Duncan wrote: Following from this, I propose that we have distinct-looking operators (not just multis) that users can explicitly choose when they want to do integer division/modulus or non-integer division/modulus. For example, we could have: div - integer division mod - in