Re: how to specify power of number
- From: "Dann Corbit" <dcorbit@xxxxxxxxx>
- Date: Fri, 18 Apr 2008 15:34:17 -0700
"Dann Corbit" <dcorbit@xxxxxxxxx> wrote in message
news:14653$480920eb$8464@xxxxxxxxxxxxxxxxxxxx
[snip]
Because math coprocessors are awfully fast now, I guess that pow(2.0,k) is
nearly as fast as bit shifts and additions, but there is a bigger problem
with using pow(2,x) to find exact powers of 2. It should not be
unexpected for pow(2.0,24) to return 16777215.999999999 and if you assign
that to an integer, it probably won't be what is wanted unless you are
clever enough to round it -- ceil() won't help either because we might
also have seen 16777215.0000001 or something like that. The Cephes
collection of math
Of course I meant 16777216.0000001 -- I would be pretty upset with a double
math library that can't even give me back 8 significant digits of precision.
functions {for instance} uses a ratio of a cubic polynomial divided by a[snip]
quartic polynomial to form the approximation.
** Posted from http://www.teranews.com **
.
- References:
- how to specify power of number
- From: Yanb
- Re: how to specify power of number
- From: Bartc
- Re: how to specify power of number
- From: Antoninus Twink
- Re: how to specify power of number
- From: Yanb
- Re: how to specify power of number
- From: Antoninus Twink
- Re: how to specify power of number
- From: user923005
- Re: how to specify power of number
- From: Antoninus Twink
- Re: how to specify power of number
- From: Dann Corbit
- how to specify power of number
- Prev by Date: Re: how to specify power of number
- Next by Date: Re: Can a double be 32 bits?
- Previous by thread: Re: how to specify power of number
- Next by thread: Re: how to specify power of number
- Index(es):
Relevant Pages
|