Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #853
| From | Robin Vowels <robin.vowels@gmail.com> |
|---|---|
| Newsgroups | comp.programming, comp.lang.pl1 |
| Subject | Re: calculating the power of a fixed point |
| Date | 2011-09-23 08:44 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <c9e950c8-c627-4b46-a487-8beaaaab86a7@a10g2000prn.googlegroups.com> (permalink) |
| References | <2d2836aa-2443-4e56-9fef-d38e12c60dcf@z41g2000yqb.googlegroups.com> <881091c4-8dd2-47a1-b81f-f98e68a9bb12@s2g2000prm.googlegroups.com> <j5hule$sfb$1@speranza.aioe.org> |
Cross-posted to 2 groups.
On Sep 23, 10:39 pm, glen herrmannsfeldt <g...@ugcs.caltech.edu> wrote: > In comp.lang.pl1 Robin Vowels <robin.vow...@gmail.com> wrote: > > > On Sep 20, 7:00 pm, Keren Davidpur <keren...@gmail.com> wrote: > >> I want to represent x and y, both non-integers as a fixed point > >> data type. I am having trouble calculating x^y without using the > >> float library in C++ because the standard library includes only > >> a floating point implementation of the power function. > > C, C++, and Java have a pow() function/method with two floating > point arguments. I believe it is usual, though maybe not required, > that if the second argument has an integer value to use an > algorithm that doesn't use log and exp. When the second argument is integer-valued, it is far more efficient to compute the result using only a few multiplications. > Fortran and PL/I explicitly allow for an integer second argument > with integer or real (or complex) first argument. For cases where > the second argument is a floating point type or, for PL/I, > a fixed point type with a scaling factor greater than zero, > to use the log/exp algorithm. 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. In any case, a power routine would not be used. Newton's method or some such would be used for square root. > I have never known such an > implementation.
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar
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