Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!mks!tj From: tj@mks.UUCP Newsgroups: comp.bugs.sys5,comp.sys.hp Subject: Re: pow(3M) may have a bug or undocumented limitation Message-ID: <266@mks.UUCP> Date: Mon, 18-May-87 13:33:54 EDT Article-I.D.: mks.266 Posted: Mon May 18 13:33:54 1987 Date-Received: Tue, 19-May-87 01:29:41 EDT References: <226@cogent.UUCP> Organization: Mortice Kern Systems, Waterloo, Ont. Lines: 25 Keywords: x^y y<0 DOMAIN error Xref: utgpu comp.bugs.sys5:118 comp.sys.hp:137 Summary: probable arg type error In article <226@cogent.UUCP>, mark@cogent.UUCP (Captain Neptune) writes: > > I am running an HP 9000/840 running HP-UX and I have a problem doing some math. > I am trying to use pow(3M) to raise a positive integer value to a negative > integer value. For example, the 12th root of 2 --> 2 ^ (-12) --> pow(2,-12). > > I keep getting "DOMAIN error" even though the manual page doesn't seem to > cite this case as an illegal one. It would be illegal if, say, the first > argument was zero, for instance. Pow(3M) is found on the manual page for > "exp(3M)". My guess is that you have neglected ensure that the arguments passed to pow are doubles. try pow(2.0, -12.0); BTW the 12th root of 2 is 2^(1/12) i.e. pow(2.0, 1.0/12.0); V7 and BSD man page say that pow gives domain error when 2nd argument is negative and non-integral. This is wrong. SYSV man page correctly states that domain error results when 1st arg is negative and 2nd is non-integral. -- ll // // ,~/~~\' T. J. Thompson {decvax,ihnp4,seismo}!watmath!mks!tj /ll/// //l' `\\\ Mortice Kern Systems Inc. / l //_// ll\___/ 43 Bridgeport Rd. E., Waterloo, ON, Can. N2J 2J4 O_/ (519)884-2251