Re: mod/div

2005-05-30 Thread TSa (Thomas Sandlaß)
Mark Reed wrote: I would really like to see ($x div $y) be (floor($x/$y)) That is: floor( 8 / (-3) ) == floor( -2. ) == -3 Or do you want -2? and ($x mod $y) be ($x - $x div $y). Hmm, since 8 - (-3) == 11 this definition hardly works. But even with $q = floor( $x / $y ) and $r = $x

Re: mod/div

2005-05-31 Thread Mark Reed
On 2005-05-30 05:15, "TSa (Thomas Sandlaß)" <[EMAIL PROTECTED]> wrote: > Mark Reed wrote: >> I would really like to see ($x div $y) be (floor($x/$y)) > > That is: floor( 8 / (-3) ) == floor( -2. ) == -3 > Or do you want -2? > >> and ($x mod $y) be ($x - $x div $y). > > Hmm, since 8 - (

Re: mod/div

2005-06-01 Thread TSa (Thomas Sandlaß)
Mark Reed wrote: At least, not in cases where the intended result is consistent across 0. Lots of date arithmetic falls into this category, and works beautifully with the definitions above. Does it? If you have a year 0, what is the number corresponding to the middle of that year? Is it 0.5? Is

Re: mod/div

2005-06-06 Thread Roger Hale
Just a nit, for the record, with no great perl relevance: "TSa (Thomas Sandlaß)" wrote: But what is the first quarter of year 0? 0.25? Sure (of course if there were a year 0 instead of becoming 1 BCE) > And the last quarter of year -1? -0.25? Sure > That works numerically, but March of a year

mod/div (was: reduce metaoperator on an empty list)

2005-05-23 Thread TSa (Thomas Sandlaß)
[EMAIL PROTECTED] wrote: There are actuall two usefull definition for %. The first which Ada calls 'mod' always returns a value 0<=XSigned integer division and remainder are defined by the relation: A = (A/B)*B + (A rem B) where (A rem B) has the sign of A and an absolute value less than

Re: mod/div (was: reduce metaoperator on an empty list)

2005-05-23 Thread Mark Reed
I would really like to see ($x div $y) be (floor($x/$y)) and ($x mod $y) be ($x - $x div $y). If the divisor is positive the modulus should be positive, no matter what the sign of the dividend. Avoids lots of special case code across 0 boundaries. On 2005-05-23 18:49, "TSa (Thomas Sandlaß)" <[