cvsuser 04/09/21 11:26:13
Modified: classes complex.pmc
Log:
complex algorithm remarks
Revision Changes Path
1.10 +20 -1 parrot/classes/complex.pmc
Index: complex.pmc
===================================================================
RCS file: /cvs/public/parrot/classes/complex.pmc,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -r1.9 -r1.10
--- complex.pmc 3 Sep 2004 10:25:08 -0000 1.9
+++ complex.pmc 21 Sep 2004 18:26:13 -0000 1.10
@@ -1,6 +1,6 @@
/*
Copyright: 2004 The Perl Foundation. All Rights Reserved.
-$Id: complex.pmc,v 1.9 2004/09/03 10:25:08 leo Exp $
+$Id: complex.pmc,v 1.10 2004/09/21 18:26:13 leo Exp $
=head1 NAME
@@ -660,6 +660,13 @@
*/
+/*
+
+ TODO for better precision:
+
+ (a+ib)(c+id)=(ac-bd)+i((a+b)(c+d)-ac-bd).
+
+*/
void multiply (PMC* value, PMC* dest) {
MMD_PerlInt: {
FLOATVAL re = RE(SELF) * PMC_int_val(value);
@@ -769,6 +776,18 @@
*/
+/*
+
+ TODO for better precision: hinted by vaxman according to "Numerival Recipes
+ in Fortran 77", 2nd edition, Press, Vetterling, Teukolsky, Flannery,
+ Cambridge University Press, 2001, pp. 171ff:
+
+
+|a+ib|=|a|*sqrt(1+(b/a)**2), if |a|>=|b|,
+ |b|*sqrt(1+(a/b)**2) else.
+
+*/
+
void absolute(PMC *dest) {
FLOATVAL d = sqrt(RE(SELF)*RE(SELF) + IM(SELF)*IM(SELF));
VTABLE_set_number_native(INTERP, dest, d);