| 1 |
/* |
| 2 |
* Copyright (C) 1996-2011 Daniel Waggoner |
| 3 |
* |
| 4 |
* This free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation, either version 3 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* It is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* If you did not received a copy of the GNU General Public License |
| 15 |
* with this software, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
/* |
| 19 |
Defines the precision to be used. Default is double precision. To use single precision |
| 20 |
define DW_SINGLE in the compiler flags. |
| 21 |
*/ |
| 22 |
|
| 23 |
#ifndef __PRECISION_H__ |
| 24 |
#define __PRECISION_H__ |
| 25 |
|
| 26 |
#include <float.h> |
| 27 |
|
| 28 |
#ifdef DW_SINGLE |
| 29 |
|
| 30 |
/********** single precision **********/ |
| 31 |
#define PRECISION float |
| 32 |
#define MACHINE_EPSILON 5.97E-08 |
| 33 |
#define SQRT_MACHINE_EPSILON 2.45E-04 |
| 34 |
#define PRECISION_SIZE 4 |
| 35 |
#define PRECISION_SHIFT 2 |
| 36 |
#define PRECISION_WORD dword |
| 37 |
#define MINUS_INFINITY -FLT_MAX |
| 38 |
#define PLUS_INFINITY FLT_MAX |
| 39 |
|
| 40 |
#else |
| 41 |
|
| 42 |
/********** double precision **********/ |
| 43 |
#define PRECISION double |
| 44 |
#define MACHINE_EPSILON 1.11E-16 |
| 45 |
#define SQRT_MACHINE_EPSILON 1.06E-08 |
| 46 |
#define PRECISION_SIZE 8 |
| 47 |
#define PRECISION_SHIFT 3 |
| 48 |
#define PRECISION_WORD qword |
| 49 |
|
| 50 |
/* Redefined to make compatible with Tao's conventions * |
| 51 |
#define MINUS_INFINITY -DBL_MAX |
| 52 |
#define PLUS_INFINITY DBL_MAX |
| 53 |
**/ |
| 54 |
#define MINUS_INFINITY -1.0E300 |
| 55 |
#define PLUS_INFINITY 1.0E300 |
| 56 |
|
| 57 |
|
| 58 |
#endif |
| 59 |
|
| 60 |
#endif |