From: Paul Eggert Date: Sat, 8 Sep 2012 19:57:32 +0000 (-0700) Subject: * floatfns.c (Ftan): Use tan (x), not (sin (x) / cos (x)). X-Git-Tag: emacs-24.2.90~358 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eabf0404414f2828c08d1d5d8fab4740670e7541;p=emacs.git * floatfns.c (Ftan): Use tan (x), not (sin (x) / cos (x)). This produces more-accurate results. --- diff --git a/src/ChangeLog b/src/ChangeLog index dd4719e25c6..0316e7708af 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2012-09-08 Paul Eggert + + * floatfns.c (Ftan): Use tan (x), not (sin (x) / cos (x)). + This produces more-accurate results. + 2012-09-08 Jan Djärv * nsterm.m (updateFrameSize): Call setFrame: on the view when size diff --git a/src/floatfns.c b/src/floatfns.c index 3a95d828c0c..dfe063b152f 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -265,12 +265,12 @@ DEFUN ("tan", Ftan, Stan, 1, 1, 0, (register Lisp_Object arg) { double d = extract_float (arg); - double c = cos (d); #ifdef FLOAT_CHECK_DOMAIN + double c = cos (d); if (c == 0.0) domain_error ("tan", arg); #endif - IN_FLOAT (d = sin (d) / c, "tan", arg); + IN_FLOAT (d = tan (d), "tan", arg); return make_float (d); }