🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #541

Re: pow(3M) may have a bug or undocumented limitation

#541
From: John Worley
Date: Tue, 19 May 1987 01:48
21 lines
1281 bytes
> 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).
> 
> Any ideas why this is happening?  Have I made some fundamental blunder?
> Has pow(3M) made some fundamental blunder?

    You have made two fundamental blunders.  First, the arguments to pow() are
doubles, so the correct way to all the function is:

	pow(2.0, -12.0);

   The second blunder is that 2 ^ -12 == 1 / (2 ^ 12), NOT 12th-root 2!  The
code for that would be:

	pow(2.0, 1.0 / 12.0);

    I suggest using 2^-12 would generate a useless musical scale (the only
practical application of 12-th root 2 I know about).

					John Worley
					hplabs!dana!worley
Technical Details
Message-ID: <163@dana.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!husc6!think!ames!amdahl!dlb!dana!worley
References: <226@cogent.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!husc6!think!ames!amdahl!dlb!dana!worley
From: worley@dana.UUCP (John Worley)
Newsgroups: comp.bugs.sys5,comp.sys.hp
Subject: Re: pow(3M) may have a bug or undocumented limitation
Message-ID: <163@dana.UUCP>
Date: Mon, 18-May-87 21:48:19 EDT
Article-I.D.: dana.163
Posted: Mon May 18 21:48:19 1987
Date-Received: Wed, 20-May-87 01:39:20 EDT
References: <226@cogent.UUCP>
Organization: Dana Computer, Inc., Sunnyvale, CA
Lines: 21