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