Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #855

Re: calculating the power of a fixed point

From glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups comp.programming, comp.lang.pl1
Subject Re: calculating the power of a fixed point
Date 2011-09-23 17:07 +0000
Organization Aioe.org NNTP Server
Message-ID <j5iedb$6pp$1@speranza.aioe.org> (permalink)
References <2d2836aa-2443-4e56-9fef-d38e12c60dcf@z41g2000yqb.googlegroups.com> <881091c4-8dd2-47a1-b81f-f98e68a9bb12@s2g2000prm.googlegroups.com> <j5hule$sfb$1@speranza.aioe.org> <c9e950c8-c627-4b46-a487-8beaaaab86a7@a10g2000prn.googlegroups.com>

Cross-posted to 2 groups.

Show all headers | View raw


In comp.lang.pl1 Robin Vowels <robin.vowels@gmail.com> wrote:

(snip, I wrote)
>> Fortran and PL/I explicitly allow for an integer second argument
>> with integer or real (or complex) first argument. 

>> One could imagine, for example,
>> with a FIXED BINARY(31,1) second argument a power routine that
>> computed the square root of the first argument in cases where the
>> least significant bit was one.

> I assume that you mean when all the other bits are zero.

No, I assumed that one would then multiply by the power computed
with the usual multplication algorithm from the other bits.

> In any case, a power routine would not be used.  Newton's
> method or some such would be used for square root.

One could extend it for other negative powers of two with
additional calls to the square root routine.

>>  have never known such an implementation.

Reminds me of a chapter in "Feynman Lectures on Physics" explaining
how the first log tables would have been computed.  (I don't know
that it is historically accurate, but it seems right.)

First you take the square root of 10, or 10**0.5.
Now take the square root of that, for 10**0.25.
After 10 such square roots you have powers of 10 down to 1/1024.
By multiplying, you can make a table of all powers of 10 from
1/1024 to 1023/1024 in 1/1024 steps.  Inverting the table and
interpolating, you make a log10 table.  The chapter then continues
on to derive imaginary powers of 10.

-- glen

Back to comp.programming | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

calculating the power of a fixed point Keren Davidpur <kerenpur@gmail.com> - 2011-09-20 02:00 -0700
  Re: calculating the power of a fixed point "BartC" <bc@freeuk.com> - 2011-09-20 12:01 +0100
    Re: calculating the power of a fixed point "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2011-09-20 14:36 +0200
      Re: calculating the power of a fixed point Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-21 03:52 +0100
        Re: calculating the power of a fixed point "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> - 2011-09-21 10:36 +0200
      Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-09-23 04:03 -0700
        Re: calculating the power of a fixed point Ike Naar <ike@sverige.freeshell.org> - 2011-09-23 11:52 +0000
          Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-09-23 08:59 -0700
            Re: calculating the power of a fixed point Ike Naar <ike@sverige.freeshell.org> - 2011-09-23 22:46 +0000
              Re: calculating the power of a fixed point Patricia Shanahan <pats@acm.org> - 2011-09-23 16:58 -0700
                Re: calculating the power of a fixed point "BartC" <bc@freeuk.com> - 2011-09-24 12:58 +0100
                Re: calculating the power of a fixed point Patricia Shanahan <pats@acm.org> - 2011-09-24 07:18 -0700
                Re: calculating the power of a fixed point Jongware <jongware@no-spam.plz> - 2011-09-26 11:03 +0200
                Re: calculating the power of a fixed point "BartC" <bc@freeuk.com> - 2011-09-26 10:40 +0100
                Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-10-01 03:51 -0700
                Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-10-01 03:44 -0700
                Re: calculating the power of a fixed point glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-10-01 10:56 +0000
                Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-10-01 07:00 -0700
                Re: calculating the power of a fixed point glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-10-01 18:04 +0000
                Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-10-01 16:27 -0700
                Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-10-02 00:19 -0700
                Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-10-02 00:24 -0700
  Re: calculating the power of a fixed point Dann Corbit <dcorbit@connx.com> - 2011-09-20 12:09 -0700
  Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-09-22 03:21 -0700
  Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-09-23 04:07 -0700
    Re: calculating the power of a fixed point Peter Flass <Peter_Flass@Yahoo.com> - 2011-09-23 08:17 -0400
      Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-09-23 08:30 -0700
    Re: calculating the power of a fixed point glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-09-23 12:39 +0000
      Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-09-23 08:44 -0700
        Re: calculating the power of a fixed point glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2011-09-23 17:07 +0000
          Re: calculating the power of a fixed point Robin Vowels <robin.vowels@gmail.com> - 2011-09-23 19:17 -0700

csiph-web