OpenWareLaboratory
fastpow.c File Reference
Include dependency graph for fastpow.c:

Go to the source code of this file.

Functions

float powFastLookup (const float val, const float ilog2, const uint32_t *pTable, const uint32_t precision)
 Get pow (fast!). More...
 
void powFastSetTable (uint32_t *const pTable, const uint32_t precision)
 

Variables

static const float _2p23 = 8388608.0f
 http://www.hxa.name/articles/content/fast-pow-adjustable_hxa7241_2007.html More...
 

Function Documentation

◆ powFastLookup()

float powFastLookup ( const float  val,
const float  ilog2,
const uint32_t *  pTable,
const uint32_t  precision 
)

Get pow (fast!).

@val power to raise radix to @ilog2 one over log, to required radix, of two @pTable length must be 2 ^ precision @precision number of mantissa bits used, >= 0 and <= 18

Definition at line 45 of file fastpow.c.

References _2p23.

Referenced by fast_exp10f(), fast_exp2f(), fast_expf(), and fast_powf().

◆ powFastSetTable()

void powFastSetTable ( uint32_t *const  pTable,
const uint32_t  precision 
)

Definition at line 19 of file fastpow.c.

References _2p23.

Variable Documentation

◆ _2p23

const float _2p23 = 8388608.0f
static

http://www.hxa.name/articles/content/fast-pow-adjustable_hxa7241_2007.html

Copyright (c) 2007, Harrison Ainsworth / HXA7241.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition at line 17 of file fastpow.c.

Referenced by powFastLookup(), and powFastSetTable().