[Python-checkins] CVS: python/dist/src/Modules cmathmodule.c,2.12,2.13

Guido van Rossum python-dev@python.org
Thu, 29 Jun 2000 19:29:24 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9169

Modified Files:
	cmathmodule.c 
Log Message:
Patch by Nadav Horesh to make acosh and asinh better.

Tim posted a long comment to python-dev (subject: "Controversial patch
(cmath)"; date: 6/29/00).  The conclusion is that this whole module
stinks and this patch isn't perfect, but it's better than the acosh
and asinh we had, so let's check it in.


Index: cmathmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cmathmodule.c,v
retrieving revision 2.12
retrieving revision 2.13
diff -C2 -r2.12 -r2.13
*** cmathmodule.c	1999/03/16 14:17:48	2.12
--- cmathmodule.c	2000/06/30 02:29:22	2.13
***************
*** 58,63 ****
  	Py_complex x;
  {
! 	return c_log(c_sum(x,c_prod(c_i,
! 		    c_sqrt(c_diff(c_1,c_prod(x,x))))));
  }
  
--- 58,66 ----
  	Py_complex x;
  {
! 	Py_complex z;
! 	z = c_sqrt(c_half);
! 	z = c_log(c_prod(z, c_sum(c_sqrt(c_sum(x,c_1)),
! 				  c_sqrt(c_diff(x,c_1)))));
! 	return c_sum(z, z);
  }
  
***************
*** 71,76 ****
  	Py_complex x;
  {
! 	return c_neg(c_prodi(c_log(c_sum(c_prod(c_i,x),
! 		    c_sqrt(c_diff(c_1,c_prod(x,x)))))));
  }
  
--- 74,82 ----
  	Py_complex x;
  {
! 	Py_complex z;
! 	z = c_sqrt(c_half);
! 	z = c_log(c_prod(z, c_sum(c_sqrt(c_sum(x,c_i)),
! 				  c_sqrt(c_diff(x,c_i)))));
! 	return c_sum(z, z);
  }
  
***************
*** 86,92 ****
  	/* Break up long expression for WATCOM */
  	Py_complex z;
! 	z = c_sum(c_1,c_prod(x,x));
! 	z = c_diff(c_sqrt(z),x);
! 	return c_neg(c_log(z));
  }
  
--- 92,97 ----
  	/* Break up long expression for WATCOM */
  	Py_complex z;
! 	z = c_sum(c_1,c_prod(x, x));
! 	return c_log(c_sum(c_sqrt(z), x));
  }