From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Richard B. Kreckel" Subject: Wrong formulae for complex elementary functions Date: Fri, 26 Nov 2010 09:57:27 +0100 Message-ID: <4CEF7677.30500@ginac.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Sender: linux-man-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Andreas Enge , Bill Allombert , Karim Belabas List-Id: linux-man@vger.kernel.org Hi! The man pages for cacos, cacosf, cacosl, catan, catanf, catanl, cacosh, cacoshf, cacoshl, catanh, catanhf, and catanhl contain wrong maths. cacos, cacosf, cacosl: The formula given in the man page cacos(z) = -i clog(z + csqrt(z * z - 1)) gives wrong results in second and fourth quadrant of complex plain. The formula cacos(z) = -i clog(z + I*csqrt(1 - z * z)) gives correct results. catan, catanf, catanl: The formula given in the man page catan(z) = 1 / 2i clog((1 + iz) / (1 - iz)) gives wrong results on the negative imaginary axis beginning at -I (along one of the two branch cuts). Besides, the formula is written in an ambiguous way. The formula catan(z) = (clog(1 + iz) - clog(1 - iz)) / 2i gives correct results. cacosh, cacoshf, cacoshl: The formula given in the man page cacosh(z) = (0.5) * clog((1 + z) / (1 - z)) gives wrong results everywhere in the complex plain. (The formula seems to be copied from the one for catanh, where it is sometimes correct.) The formula cacosh(z) = 2 * clog(csqrt((z + 1)/2) + csqrt((z - 1)/2)) gives correct results. catanh, catanhf, catanhl: The formula given in the man page catanh(z) = 0.5 * clog((1 + z) / (1 - z)) gives wrong results on the positive real axis beginning at 1 (along one of the two branch cuts). The formula catanh(z) = 0.5 * (clog(1 + z) - clog(1 - z)) gives correct results. I've also checked casin, casinf, casinl, casinh, casinhf, and casinhl and the formulae given there casin(z) = -i clog(iz + csqrt(1 - z * z)) casinh(z) = clog(z + csqrt(z * z + 1)) are actually correct. I suspect that some of these errors are due to somebody trying to "simplify" these formulae. Since this can ruin the behavior, I recommend to add a comment to the upstream sources that warns against attempt of simplification. For the sake of reference, I am looking at manpages-dev 3.25-1 on Debian/squeeze. Bye! -richy. -- Richard B. Kreckel -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html