Line 1... |
Line 1... |
/* $Id: literate.hh,v 1.2 2008-04-21 11:32:33 sybreon Exp $
|
/* $Id: literate.hh,v 1.3 2008-04-21 12:01:18 sybreon Exp $
|
**
|
**
|
** AEMB Function Verification C++ Testbench
|
** AEMB Function Verification C++ Testbench
|
** Copyright (C) 2004-2008 Shawn Tan
|
** Copyright (C) 2004-2008 Shawn Tan
|
**
|
**
|
** This file is part of AEMB.
|
** This file is part of AEMB.
|
Line 190... |
Line 190... |
int newtonTest (int max) {
|
int newtonTest (int max) {
|
int n;
|
int n;
|
float newt;
|
float newt;
|
// 32-bit LUT in IEEE754 hex representation
|
// 32-bit LUT in IEEE754 hex representation
|
float newt_lut[] = {
|
float newt_lut[] = {
|
0x00000000, //0.000000000000000000000000,
|
0.000000000000000000000000,
|
0x3f800000, //1.000000000000000000000000,
|
1.000000000000000000000000,
|
0x3fb504f3, //1.414213538169860839843750,
|
1.414213538169860839843750,
|
0x3fddb3d7, //1.732050776481628417968750,
|
1.732050776481628417968750,
|
0x40000000, //2.000000000000000000000000,
|
2.000000000000000000000000,
|
0x400f1bbd, //2.236068010330200195312500,
|
2.236068010330200195312500,
|
0x401cc471, //2.449489831924438476562500,
|
2.449489831924438476562500,
|
0x402953fd, //2.645751237869262695312500,
|
2.645751237869262695312500,
|
0x403504f3, //2.828427076339721679687500,
|
2.828427076339721679687500,
|
0x40400000, //3.000000000000000000000000,
|
3.000000000000000000000000,
|
0x404a62c2, //3.162277698516845703125000,
|
3.162277698516845703125000,
|
0x40544394, //3.316624879837036132812500,
|
3.316624879837036132812500,
|
0x405db3d7, //3.464101552963256835937500,
|
3.464101552963256835937500,
|
0x4066c15a, //3.605551242828369140625000,
|
3.605551242828369140625000,
|
0x406F7750 //3.741657495498657226562500
|
3.741657495498657226562500
|
};
|
};
|
|
|
for (n=0;n
|
for (n=0;n
|
{
|
{
|
newt = newtonSqrt(n);
|
newt = newtonSqrt(n);
|