Exactly why I suggested asking the experts. The difference between Modulus and Remainder (for non-complex numbers) is that the latter preserves sign whereas the former ignores sign (and always returns a positive -- not very useful in practical cases).
Mike > -----Original Message----- > From: Chip Davis [mailto:[email protected]] > Sent: 10 June 2014 18:57 > To: Open Object Rexx Developer Mailing List > Subject: Re: [Oorexx-devel] Remainder operation for complex numbers > > Mike, > > All the definitions I can find for "remaindering" are > essentially variants of "modulus/modulo". The modulus of a > complex number is pretty well defined as simply the length of > the vector. > > It's not clear to me what sort of value one would expect to > get from a "remainder of the quotient of the integer division > of two imaginary numbers"; an integer modulus and an integer > angle, maybe? > > -Chip- > > On 6/10/2014 1:33 PM Mike Cowlishaw said: > > Worth doing right, I'd say. The place to ask is the IEEE > 754 mailing > > list (open to all), which is (a) very quiet at the moment and (b) > > followed by all the best people in the world to answer such a > > question. Be clear that you want the Remainder rather than > the Modulus. > > Mike > > > > > ---------------------------------------------------------------------- > > *From:* Rick McGuire [mailto:[email protected]] > > *Sent:* 10 June 2014 16:25 > > *To:* Open Object Rexx Developer Mailing List > > *Subject:* [Oorexx-devel] Remainder operation for > complex numbers > > > > This is a challenge for the mathematically inclined > members of our > > audience: Now would you define a remainder operation on complex > > numbers? > > > > I decided I would update some of the ooRexx samples for some of > > the newer language features, since many of these samples are are > > 20+ years old. I started with the complex number one, > and during > > my ad hoc testing, I was surprised to see that > > > > 5+0i // 2+0i was giving a result of 2+0i. This is > clearly wrong. > > The method implementing // just took the algorithm > for division > > and changed the operator to //. This worked for the % > operation, > > but fails badly for //. The code is this: > > > > a=real/* get real and imaginaries for */ > > b=imaginary/* both numbers */ > > c=divisor~real > > d=divisor~imaginary > > qr=((b*d)+(a*c))//(c**2+d**2)/* generate the new > result values > > */ > > > > qi=((b*c)-(a*d))//(c**2+d**2) > > > > For both imaginary values zero, this results in a*c//c**2, or in > > my example 10//4, which is off by a factor of 2. I'm > inclined to > > just delete this method, but if somebody can come up with a > > reliable algorithm, I'd consider putting it in. > > > > Rick > > > > > > > > > ---------------------------------------------------------------------- > > -------- HPCC Systems Open Source Big Data Platform from LexisNexis > > Risk Solutions Find What Matters Most in Your Big Data with HPCC > > Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. > > Leverages Graph Analysis for Fast Processing & Easy Data > Exploration > > http://p.sf.net/sfu/hpccsystems > > > > > > > > _______________________________________________ > > Oorexx-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > > > > -------------------------------------------------------------- > ---------------- > HPCC Systems Open Source Big Data Platform from LexisNexis > Risk Solutions Find What Matters Most in Your Big Data with > HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for > Dirty Data. > Leverages Graph Analysis for Fast Processing & Easy Data > Exploration http://p.sf.net/sfu/hpccsystems > _______________________________________________ > Oorexx-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/oorexx-devel > ------------------------------------------------------------------------------ HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing & Easy Data Exploration http://p.sf.net/sfu/hpccsystems _______________________________________________ Oorexx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oorexx-devel
