Fast logarithm. More...
#include <SgFastLog.h>
Classes | |
union | IntFloat |
Public Member Functions | |
SgFastLog (int mantissaBits) | |
~SgFastLog () | |
float | Log (float val) const |
Get natural logarithm. | |
Private Member Functions | |
SgFastLog (const SgFastLog &) | |
Not implemented. | |
SgFastLog & | operator= (const SgFastLog &) |
Not implemented. | |
Private Attributes | |
const int | m_mantissaBitsDiff |
float * | m_lookupTable |
Static Private Attributes | |
static const int | MAX_MANTISSA_BITS = 23 |
Fast logarithm.
Computes a fast single precision logarithm based on a lookup table.
O. Vinyals, G. Friedland, N. Mirghafori: Revisiting a basic function on current CPUs: A fast logarithm implementation with adjustable accuracy. http://www.icsi.berkeley.edu/pubs/techreports/TR-07-002.pdf
The implementation assumes that the platform uses IEEE 754 floats.
Definition at line 19 of file SgFastLog.h.
SgFastLog::SgFastLog | ( | int | mantissaBits | ) |
Definition at line 28 of file SgFastLog.cpp.
References SgFastLog::IntFloat::m_float, SgFastLog::IntFloat::m_int, m_lookupTable, and m_mantissaBitsDiff.
SgFastLog::~SgFastLog | ( | ) |
Definition at line 44 of file SgFastLog.cpp.
References m_lookupTable.
SgFastLog::SgFastLog | ( | const SgFastLog & | ) | [private] |
Not implemented.
float SgFastLog::Log | ( | float | val | ) | const |
Get natural logarithm.
Definition at line 50 of file SgFastLog.h.
References SgFastLog::IntFloat::m_float, SgFastLog::IntFloat::m_int, m_lookupTable, m_mantissaBitsDiff, and MAX_MANTISSA_BITS.
Referenced by SgUctSearch::Log().
float* SgFastLog::m_lookupTable [private] |
Definition at line 41 of file SgFastLog.h.
Referenced by Log(), SgFastLog(), and ~SgFastLog().
const int SgFastLog::m_mantissaBitsDiff [private] |
Definition at line 39 of file SgFastLog.h.
Referenced by Log(), and SgFastLog().
const int SgFastLog::MAX_MANTISSA_BITS = 23 [static, private] |
Definition at line 37 of file SgFastLog.h.
Referenced by Log().