You are here: Home > Fastcode project > ArcCos Challenge

The Fastcode Project

ArcCos Challenge

The objective is to build the fastest replacement for RTL ArcCos.

ArcCos returns the inverse cosine of X. X must be between -1 and 1. The return value will be in the range [-Pi/2..Pi/2], in radians.

There are three overloaded functions differing in the input and output datatype.

function ArcCos(const X: Extended): Extended; overload;
function ArcCos(const X: Double): Double; overload;
function ArcCos(const X: Single): Single; overload;

Validation and Benchmark Tool:
Tables of results

 Extended

Target Function Author Speed up over RTL
P4 Prescott ArcCosJOH John O'Harrow 1,36
P4 Northwood ArcCosNJ1 Norbert Juffa 1,34
Pentium M Dothan ArcCosDKC1 Dennis Christensen 1,15
Pentium M Banias ArcCosNJ1 Norbert Juffa 1,16
AMD 64 ArcCosJOH John O'Harrow 1,23
Athlon XP ArcCosJOH John O'Harrow 1,22
Blended ArcCosJOH John O'Harrow 1,21
RTL Replacement ArcCosNJ1 Norbert Juffa 1,21
Pascal ArcCosRTL Borland 1,00

Double

Target Function Author Speed up over RTL
P4 Prescott ArcCosJOH John O'Harrow 1,18
P4 Northwood ArcCosNJ1 Norbert Juffa 1,17
Pentium M Dothan ArcCosDKC1 Dennis Christensen 1,17
Pentium M Banias ArcCosDKC1 Dennis Christensen 1,16
AMD 64 ArcCosJOH John O'Harrow 1,24
Athlon XP ArcCosJOH John O'Harrow 1,28
Blended ArcCosNJ1 Norbert Juffa 1,17
RTL Replacement ArcCosNJ1 Norbert Juffa 1,17
Pascal ArcCosRTL Borland 1,00

Single

Target Function Author Speed up over RTL
P4 Prescott ArcCosJOH John O'Harrow 1,72
P4 Northwood ArcCosJOH John O'Harrow 1,40
Pentium M Dothan ArcCosDKC1 Dennis Christensen 1,25
Pentium M Banias ArcCosJOH John O'Harrow 1,16
AMD 64 ArcCosJOH John O'Harrow 1,28
Athlon XP ArcCosJOH John O'Harrow 1,33
Blended ArcCosJOH John O'Harrow 1,29
RTL Replacement ArcCosJOH John O'Harrow 1,29
Pascal ArcCosRTL Borland 1,00