Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!ut-sally!seismo!brl-adm!brl-smoke!smoke!gwyn@BRL.ARPA From: gwyn@BRL.ARPA (VLD/VMB) Newsgroups: net.lang.c Subject: LPow correction Message-ID: <1604@brl-smoke.ARPA> Date: Mon, 23-Jun-86 21:48:42 EDT Article-I.D.: brl-smok.1604 Posted: Mon Jun 23 21:48:42 1986 Date-Received: Sat, 28-Jun-86 07:44:29 EDT Sender: news@brl-smoke.ARPA Lines: 16 Jim Cottrell pointed out to me that 0^0 should be 1, not 0 as I had it in my posted LPow() function. I thought I had a reason for making it 0, but since I'm unable to reconstruct that line of reasoning, and *especially* since I can show (using l'Hospital's rule) that limit of x^x as x->0+ is precisely 1, I am amending our master copy of LPow() to handle exponent 0 as another special case. Just insert if ( exponent == 0 ) return 1; in front of the other special cases. This will make 0^n zero for n > 0, 1 for n == 0, and 0 (should be infinite) for n < 0. The latter is the only known inaccuracy and is due entirely to not wanting to clutter the algorithm with error handling; if you want to add error handling this is the place (recommend setting EDOM and returning MAX_LONG).