Publication Details

Title: Revisiting a Basic Function on Current CPUs: A Fast Logarithm Implementation with Adjustable Accuracy
Author: O. Vinyals, G. Friedland, and N. Mirghafori
Bibliographic Information: ICSI Technical Report TR-07-002
Date: June 2007
Research Area: Speech, Audio and Multimedia
Type: Technical Reports
PDF: http://www.icsi.berkeley.edu/pubs/techreports/TR-07-002.pdf

Overview:
In this report, we present an implementation of the logarithm function that takes better advantage of the architecture of current processors than previous implementations. The proposed C-language function is a fast single precision approximation of the natural logarithm with adjustable accuracy. Given an IEEE 754 floating point number, the main idea is to use a quantized version of the mantissa as a pointer into a lookup table. The amount of quantization of the mantissa determines the table size and therefore the accuracy. Current processors are able to store relatively large lookup tables in cache memory. Therefore an acceptable accuracy can be reached without too many main memory accesses. We measured a speed up of about factor 6 with respect to the standard C-library implementation while keeping the absolute error as low as 10e−6. This article presents and discusses our proposed implementation with respect to other logarithm realizations on different platforms. Measurements are performed using a dedicated benchmark and by testing the performance of the function as part of a real application.

Bibliographic Reference:
O. Vinyals, G. Friedland, and N. Mirghafori. Revisiting a Basic Function on Current CPUs: A Fast Logarithm Implementation with Adjustable Accuracy. ICSI Technical Report TR-07-002, June 2007