Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-unix!ubi From: ubi@sri-unix.ARPA (Ron Ueberschaer) Newsgroups: comp.bugs.sys5,comp.sys.hp Subject: Re: pow(3M) may have a bug or undocumented limitation Message-ID: <2510@sri-unix.ARPA> Date: Mon, 18-May-87 00:35:09 EDT Article-I.D.: sri-unix.2510 Posted: Mon May 18 00:35:09 1987 Date-Received: Mon, 18-May-87 04:02:27 EDT References: <226@cogent.UUCP> Reply-To: ubi@sri-unix.UUCP (Ron Ueberschaer) Distribution: world Organization: SRI, Menlo Park, CA. Lines: 26 Keywords: x^y y<0 DOMAIN error Xref: mnetor comp.bugs.sys5:120 comp.sys.hp:148 > [problem with doing] pow(2, -12) When passing integer arguments to pow(), or any other math function requiring floating points (double, actually), be sure that you either cast the variable, e.g. pow((double) i, (double) j) , or explicitely type the decimal point, e.g. pow(2., -12.) . While most compilers handle implicit type conversion in *expressions*, arguments to *functions* require more care. The particular problem you are having bit me once before, although I didn't get a useful runtime error message, just the old "(core dumped)." I don't think the negative exponent is the problem. A negative mantissa, however, will not work, even if the exponent is integer. Hope this helps, Ron Ueberschaer SRI International Menlo Park, CA ...!{hplabs,rutgers}!sri-unix!ubi ubi@sri-unix.UUCP