Download Latest Version PS Linux Live DVD v3 (1.1 GB)
Email in envelope

Get an email when there's a new version of Kernelloader

Name Modified Size InfoDownloads / Week
Parent folder
Adam.tar.gz 2011-04-09 131.2 kB
pow.vcl 2011-04-09 1.1 kB
power.README 2011-04-09 1.1 kB
power.c 2011-04-09 1.0 kB
Totals: 4 Items   134.4 kB 0
Fast approximations to the power function.
for PS2 Vector Units.

(C) Ian Stephenson
ian@dctsystems.freeserve.co.uk


These functions implement very fast approximations to the function pow().
The opperate by relying on the format of foating point number, which is
basicaly a log 2 representation. We can therefore cast a float to an int, then simply treat it as if its still a float, and we're nearly there!

The C implementation is for reference only, but is still slightly faster than the built in powf() function. The VU version uses about 12 instructions to calculate 4 powers simulataneously!

The VU implementation comes in two versions - fast and very fast! In order to increase accuracy I calcualte a rough result, and then approzimate the error with a quadratic. This places the error within 1% for most sensible (>0) values. In the very fast version, I skipped this correction, but for a lot of graphics work, I can't see any difference - take your pick.


This code may be freely used and distributed, provided the relevant copyright notices are kept in place.


$an
Source: power.README, updated 2011-04-09