From 1755b59a8885757e3ceab7da3a35f7803905694c Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Fri, 17 Aug 2012 00:13:35 +0100 Subject: [PATCH] is now implemented in the platform independent portion. It is based upon a macro family defined in _PDCLIB_float.h, which is similar in structore to the existing _PDCLIB_int.h. It is controlled by three definitions in _PDCLIB_config.h, which define which IEEE 754 format the floating point types are in. This removes a GCC dependency from all of the targets, and should help in making PDCLib support other compilers --- .../example/includes => includes}/float.h | 152 +++++++++--------- internals/_PDCLIB_aux.h | 1 + internals/_PDCLIB_float.h | 93 +++++++++++ platform/posix/includes/float.h | 76 --------- platform/win32/includes/float.h | 76 --------- platform/win32/internals/_PDCLIB_config.h | 12 ++ 6 files changed, 182 insertions(+), 228 deletions(-) rename {platform/example/includes => includes}/float.h (61%) create mode 100644 internals/_PDCLIB_float.h delete mode 100644 platform/posix/includes/float.h delete mode 100644 platform/win32/includes/float.h diff --git a/platform/example/includes/float.h b/includes/float.h similarity index 61% rename from platform/example/includes/float.h rename to includes/float.h index 6590539..e72a31e 100644 --- a/platform/example/includes/float.h +++ b/includes/float.h @@ -1,76 +1,76 @@ -/* $Id$ */ - -/* 7.7 Characteristics of floating types - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -#ifndef _PDCLIB_FLOAT_H -#define _PDCLIB_FLOAT_H _PDCLIB_FLOAT_H -#include <_PDCLIB_config.h> - -#define FLT_ROUNDS _PDCLIB_FLT_ROUNDS -#define FLT_EVAL_METHOD _PDCLIB_FLT_EVAL_METHOD -#define DECIMAL_DIG _PDCLIB_DECIMAL_DIG - - /* Radix of exponent representation */ -#define FLT_RADIX __FLT_RADIX__ - /* Number of base-FLT_RADIX digits in the significand of a float */ -#define FLT_MANT_DIG __FLT_MANT_DIG__ - /* Number of decimal digits of precision in a float */ -#define FLT_DIG __FLT_DIG__ - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#define FLT_EPSILON __FLT_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#define FLT_MIN_EXP __FLT_MIN_EXP__ - /* Minimum normalised float */ -#define FLT_MIN __FLT_MIN__ - /* Minimum int x such that 10**x is a normalised float */ -#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#define FLT_MAX_EXP __FLT_MAX_EXP__ - /* Maximum float */ -#define FLT_MAX __FLT_MAX__ - /* Maximum int x such that 10**x is a representable float */ -#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#define DBL_MANT_DIG __DBL_MANT_DIG__ - /* Number of decimal digits of precision in a double */ -#define DBL_DIG __DBL_DIG__ - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#define DBL_EPSILON __DBL_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#define DBL_MIN_EXP __DBL_MIN_EXP__ - /* Minimum normalised double */ -#define DBL_MIN __DBL_MIN__ - /* Minimum int x such that 10**x is a normalised double */ -#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#define DBL_MAX_EXP __DBL_MAX_EXP__ - /* Maximum double */ -#define DBL_MAX __DBL_MAX__ - /* Maximum int x such that 10**x is a representable double */ -#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#define LDBL_MANT_DIG __LDBL_MANT_DIG__ - /* Number of decimal digits of precision in a long double */ -#define LDBL_DIG __LDBL_DIG__ - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#define LDBL_EPSILON __LDBL_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#define LDBL_MIN_EXP __LDBL_MIN_EXP__ - /* Minimum normalised long double */ -#define LDBL_MIN __LDBL_MIN__ - /* Minimum int x such that 10**x is a normalised long double */ -#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#define LDBL_MAX_EXP __LDBL_MAX_EXP__ - /* Maximum long double */ -#define LDBL_MAX __LDBL_MAX__ - /* Maximum int x such that 10**x is a representable long double */ -#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ - -#endif +/* $Id$ */ + +/* 7.7 Characteristics of floating types + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#ifndef _PDCLIB_FLOAT_H +#define _PDCLIB_FLOAT_H _PDCLIB_FLOAT_H +#include <_PDCLIB_float.h> + +#define FLT_ROUNDS _PDCLIB_FLT_ROUNDS +#define FLT_EVAL_METHOD _PDCLIB_FLT_EVAL_METHOD +#define DECIMAL_DIG _PDCLIB_DECIMAL_DIG + + /* Radix of exponent representation */ +#define FLT_RADIX _PDCLIB_FLT_RADIX + /* Number of base-FLT_RADIX digits in the significand of a float */ +#define FLT_MANT_DIG _PDCLIB_FLT_MANT_DIG + /* Number of decimal digits of precision in a float */ +#define FLT_DIG _PDCLIB_FLT_DIG + /* Difference between 1.0 and the minimum float greater than 1.0 */ +#define FLT_EPSILON _PDCLIB_FLT_EPSILON + /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ +#define FLT_MIN_EXP _PDCLIB_FLT_MIN_EXP + /* Minimum normalised float */ +#define FLT_MIN _PDCLIB_FLT_MIN + /* Minimum int x such that 10**x is a normalised float */ +#define FLT_MIN_10_EXP _PDCLIB_FLT_MIN_10_EXP + /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ +#define FLT_MAX_EXP _PDCLIB_FLT_MAX_EXP + /* Maximum float */ +#define FLT_MAX _PDCLIB_FLT_MAX + /* Maximum int x such that 10**x is a representable float */ +#define FLT_MAX_10_EXP _PDCLIB_FLT_MAX_10_EXP + + /* Number of base-FLT_RADIX digits in the significand of a double */ +#define DBL_MANT_DIG _PDCLIB_DBL_MANT_DIG + /* Number of decimal digits of precision in a double */ +#define DBL_DIG _PDCLIB_DBL_DIG + /* Difference between 1.0 and the minimum double greater than 1.0 */ +#define DBL_EPSILON _PDCLIB_DBL_EPSILON + /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ +#define DBL_MIN_EXP _PDCLIB_DBL_MIN_EXP + /* Minimum normalised double */ +#define DBL_MIN _PDCLIB_DBL_MIN + /* Minimum int x such that 10**x is a normalised double */ +#define DBL_MIN_10_EXP _PDCLIB_DBL_MIN_10_EXP + /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ +#define DBL_MAX_EXP _PDCLIB_DBL_MAX_EXP + /* Maximum double */ +#define DBL_MAX _PDCLIB_DBL_MAX + /* Maximum int x such that 10**x is a representable double */ +#define DBL_MAX_10_EXP _PDCLIB_DBL_MAX_10_EXP + + /* Number of base-FLT_RADIX digits in the significand of a long double */ +#define LDBL_MANT_DIG _PDCLIB_LDBL_MANT_DIG + /* Number of decimal digits of precision in a long double */ +#define LDBL_DIG _PDCLIB_LDBL_DIG + /* Difference between 1.0 and the minimum long double greater than 1.0 */ +#define LDBL_EPSILON _PDCLIB_LDBL_EPSILON + /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ +#define LDBL_MIN_EXP _PDCLIB_LDBL_MIN_EXP + /* Minimum normalised long double */ +#define LDBL_MIN _PDCLIB_LDBL_MIN + /* Minimum int x such that 10**x is a normalised long double */ +#define LDBL_MIN_10_EXP _PDCLIB_LDBL_MIN_10_EXP + /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ +#define LDBL_MAX_EXP _PDCLIB_LDBL_MAX_EXP + /* Maximum long double */ +#define LDBL_MAX _PDCLIB_LDBL_MAX + /* Maximum int x such that 10**x is a representable long double */ +#define LDBL_MAX_10_EXP _PDCLIB_LDBL_MAX_10_EXP + +#endif diff --git a/internals/_PDCLIB_aux.h b/internals/_PDCLIB_aux.h index 5183c9f..3de8d4a 100644 --- a/internals/_PDCLIB_aux.h +++ b/internals/_PDCLIB_aux.h @@ -177,6 +177,7 @@ #define _PDCLIB_cc( x, y ) x ## y #define _PDCLIB_concat( x, y ) _PDCLIB_cc( x, y ) +#define _PDCLIB_concat3( x, y, z ) _PDCLIB_concat( _PDCLIB_concat( x, y ), z ) #define _PDCLIB_symbol2value( x ) #x #define _PDCLIB_symbol2string( x ) _PDCLIB_symbol2value( x ) diff --git a/internals/_PDCLIB_float.h b/internals/_PDCLIB_float.h new file mode 100644 index 0000000..62051e0 --- /dev/null +++ b/internals/_PDCLIB_float.h @@ -0,0 +1,93 @@ +#ifndef _PDCLIB_PDCLIB_FLOAT_H +#define _PDCLIB_PDCLIB_FLOAT_H _PDCLIB_PDCLIB_FLOAT_H + +/* PDCLib internal floating point logic <_PDCLIB_float.h> + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +/* IEEE 754 single precision */ +#define _PDCLIB_FP_SINGLE_MIN 1.17549435082228750797e-38 +#define _PDCLIB_FP_SINGLE_EPSILON 1.19209289550781250000e-7 +#define _PDCLIB_FP_SINGLE_HAS_DENORM 1 +#define _PDCLIB_FP_SINGLE_MIN_EXP -125 +#define _PDCLIB_FP_SINGLE_MANT_DIG 24 +#define _PDCLIB_FP_SINGLE_RADIX 2 +#define _PDCLIB_FP_SINGLE_HAS_QUIET_NAN 1 +#define _PDCLIB_FP_SINGLE_MAX_10_EXP 38 +#define _PDCLIB_FP_SINGLE_HAS_INFINITY 1 +#define _PDCLIB_FP_SINGLE_DIG 6 +#define _PDCLIB_FP_SINGLE_MAX_EXP 128 +#define _PDCLIB_FP_SINGLE_DENORM_MIN 1.40129846432481707092e-45 +#define _PDCLIB_FP_SINGLE_MAX 3.40282346638528859812e+38 +#define _PDCLIB_FP_SINGLE_MIN_10_EXP -37 + +/* IEEE 754 double precision */ +#define _PDCLIB_FP_DOUBLE_MIN_EXP -1021 +#define _PDCLIB_FP_DOUBLE_DENORM_MIN 4.94065645841246544177e-324 +#define _PDCLIB_FP_DOUBLE_MIN_10_EXP -307 +#define _PDCLIB_FP_DOUBLE_DIG 15 +#define _PDCLIB_FP_DOUBLE_MAX 1.79769313486231570815e+308 +#define _PDCLIB_FP_DOUBLE_HAS_INFINITY 1 +#define _PDCLIB_FP_DOUBLE_MAX_EXP 1024 +#define _PDCLIB_FP_DOUBLE_MIN 2.22507385850720138309e-308 +#define _PDCLIB_FP_DOUBLE_HAS_DENORM 1 +#define _PDCLIB_FP_DOUBLE_HAS_QUIET_NAN 1 +#define _PDCLIB_FP_DOUBLE_MANT_DIG 53 +#define _PDCLIB_FP_DOUBLE_EPSILON 2.22044604925031308085e-16 +#define _PDCLIB_FP_DOUBLE_MAX_10_EXP 308 + +/* IEEE 754 80-bit extended precision */ +#define _PDCLIB_FP_EXTENDED_MAX 1.18973149535723176502e+4932 +#define _PDCLIB_FP_EXTENDED_MAX_EXP 16384 +#define _PDCLIB_FP_EXTENDED_HAS_INFINITY 1 +#define _PDCLIB_FP_EXTENDED_MIN 3.36210314311209350626e-4932 +#define _PDCLIB_FP_EXTENDED_HAS_QUIET_NAN 1 +#define _PDCLIB_FP_EXTENDED_HAS_DENORM 1 +#define _PDCLIB_FP_EXTENDED_EPSILON 1.08420217248550443401e-19 +#define _PDCLIB_FP_EXTENDED_MANT_DIG 64 +#define _PDCLIB_FP_EXTENDED_MIN_EXP (-16381) +#define _PDCLIB_FP_EXTENDED_MAX_10_EXP 4932 +#define _PDCLIB_FP_EXTENDED_DENORM_MIN 3.64519953188247460253e-4951 +#define _PDCLIB_FP_EXTENDED_MIN_10_EXP (-4931) +#define _PDCLIB_FP_EXTENDED_DIG 18 + +/* TODO: IEEE754 quadruple precision (_PDCLIB_FP_QUADRUPLE_*) and + "double-double" math + */ + +#define _PDCLIB_FLT_RADIX ((float) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _RADIX )) +#define _PDCLIB_FLT_MANT_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MANT_DIG ) +#define _PDCLIB_FLT_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _DIG ) +#define _PDCLIB_FLT_EPSILON ((float) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _EPSILON )) +#define _PDCLIB_FLT_MIN_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MIN_EXP ) +#define _PDCLIB_FLT_MIN ((float) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MIN )) +#define _PDCLIB_FLT_MIN_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MIN_10_EXP ) +#define _PDCLIB_FLT_MAX_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MAX_EXP ) +#define _PDCLIB_FLT_MAX ((float) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MAX )) +#define _PDCLIB_FLT_MAX_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_FLOAT_TYPE, _MAX_10_EXP ) + +#define _PDCLIB_DBL_RADIX ((double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _RADIX )) +#define _PDCLIB_DBL_MANT_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MANT_DIG ) +#define _PDCLIB_DBL_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _DIG ) +#define _PDCLIB_DBL_EPSILON ((double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _EPSILON )) +#define _PDCLIB_DBL_MIN_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MIN_EXP ) +#define _PDCLIB_DBL_MIN ((double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MIN )) +#define _PDCLIB_DBL_MIN_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MIN_10_EXP ) +#define _PDCLIB_DBL_MAX_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MAX_EXP ) +#define _PDCLIB_DBL_MAX ((double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MAX )) +#define _PDCLIB_DBL_MAX_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_DOUBLE_TYPE, _MAX_10_EXP ) + +#define _PDCLIB_LDBL_RADIX ((long double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _RADIX )) +#define _PDCLIB_LDBL_MANT_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MANT_DIG ) +#define _PDCLIB_LDBL_DIG _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _DIG ) +#define _PDCLIB_LDBL_EPSILON ((long double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _EPSILON )) +#define _PDCLIB_LDBL_MIN_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MIN_EXP ) +#define _PDCLIB_LDBL_MIN ((long double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MIN )) +#define _PDCLIB_LDBL_MIN_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MIN_10_EXP ) +#define _PDCLIB_LDBL_MAX_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MAX_EXP ) +#define _PDCLIB_LDBL_MAX ((long double) _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MAX )) +#define _PDCLIB_LDBL_MAX_10_EXP _PDCLIB_concat3( _PDCLIB_FP_, _PDCLIB_LDOUBLE_TYPE, _MAX_10_EXP ) + +#endif \ No newline at end of file diff --git a/platform/posix/includes/float.h b/platform/posix/includes/float.h deleted file mode 100644 index 6590539..0000000 --- a/platform/posix/includes/float.h +++ /dev/null @@ -1,76 +0,0 @@ -/* $Id$ */ - -/* 7.7 Characteristics of floating types - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -#ifndef _PDCLIB_FLOAT_H -#define _PDCLIB_FLOAT_H _PDCLIB_FLOAT_H -#include <_PDCLIB_config.h> - -#define FLT_ROUNDS _PDCLIB_FLT_ROUNDS -#define FLT_EVAL_METHOD _PDCLIB_FLT_EVAL_METHOD -#define DECIMAL_DIG _PDCLIB_DECIMAL_DIG - - /* Radix of exponent representation */ -#define FLT_RADIX __FLT_RADIX__ - /* Number of base-FLT_RADIX digits in the significand of a float */ -#define FLT_MANT_DIG __FLT_MANT_DIG__ - /* Number of decimal digits of precision in a float */ -#define FLT_DIG __FLT_DIG__ - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#define FLT_EPSILON __FLT_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#define FLT_MIN_EXP __FLT_MIN_EXP__ - /* Minimum normalised float */ -#define FLT_MIN __FLT_MIN__ - /* Minimum int x such that 10**x is a normalised float */ -#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#define FLT_MAX_EXP __FLT_MAX_EXP__ - /* Maximum float */ -#define FLT_MAX __FLT_MAX__ - /* Maximum int x such that 10**x is a representable float */ -#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#define DBL_MANT_DIG __DBL_MANT_DIG__ - /* Number of decimal digits of precision in a double */ -#define DBL_DIG __DBL_DIG__ - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#define DBL_EPSILON __DBL_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#define DBL_MIN_EXP __DBL_MIN_EXP__ - /* Minimum normalised double */ -#define DBL_MIN __DBL_MIN__ - /* Minimum int x such that 10**x is a normalised double */ -#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#define DBL_MAX_EXP __DBL_MAX_EXP__ - /* Maximum double */ -#define DBL_MAX __DBL_MAX__ - /* Maximum int x such that 10**x is a representable double */ -#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#define LDBL_MANT_DIG __LDBL_MANT_DIG__ - /* Number of decimal digits of precision in a long double */ -#define LDBL_DIG __LDBL_DIG__ - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#define LDBL_EPSILON __LDBL_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#define LDBL_MIN_EXP __LDBL_MIN_EXP__ - /* Minimum normalised long double */ -#define LDBL_MIN __LDBL_MIN__ - /* Minimum int x such that 10**x is a normalised long double */ -#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#define LDBL_MAX_EXP __LDBL_MAX_EXP__ - /* Maximum long double */ -#define LDBL_MAX __LDBL_MAX__ - /* Maximum int x such that 10**x is a representable long double */ -#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ - -#endif diff --git a/platform/win32/includes/float.h b/platform/win32/includes/float.h deleted file mode 100644 index 6590539..0000000 --- a/platform/win32/includes/float.h +++ /dev/null @@ -1,76 +0,0 @@ -/* $Id$ */ - -/* 7.7 Characteristics of floating types - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -#ifndef _PDCLIB_FLOAT_H -#define _PDCLIB_FLOAT_H _PDCLIB_FLOAT_H -#include <_PDCLIB_config.h> - -#define FLT_ROUNDS _PDCLIB_FLT_ROUNDS -#define FLT_EVAL_METHOD _PDCLIB_FLT_EVAL_METHOD -#define DECIMAL_DIG _PDCLIB_DECIMAL_DIG - - /* Radix of exponent representation */ -#define FLT_RADIX __FLT_RADIX__ - /* Number of base-FLT_RADIX digits in the significand of a float */ -#define FLT_MANT_DIG __FLT_MANT_DIG__ - /* Number of decimal digits of precision in a float */ -#define FLT_DIG __FLT_DIG__ - /* Difference between 1.0 and the minimum float greater than 1.0 */ -#define FLT_EPSILON __FLT_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */ -#define FLT_MIN_EXP __FLT_MIN_EXP__ - /* Minimum normalised float */ -#define FLT_MIN __FLT_MIN__ - /* Minimum int x such that 10**x is a normalised float */ -#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */ -#define FLT_MAX_EXP __FLT_MAX_EXP__ - /* Maximum float */ -#define FLT_MAX __FLT_MAX__ - /* Maximum int x such that 10**x is a representable float */ -#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__ - - /* Number of base-FLT_RADIX digits in the significand of a double */ -#define DBL_MANT_DIG __DBL_MANT_DIG__ - /* Number of decimal digits of precision in a double */ -#define DBL_DIG __DBL_DIG__ - /* Difference between 1.0 and the minimum double greater than 1.0 */ -#define DBL_EPSILON __DBL_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */ -#define DBL_MIN_EXP __DBL_MIN_EXP__ - /* Minimum normalised double */ -#define DBL_MIN __DBL_MIN__ - /* Minimum int x such that 10**x is a normalised double */ -#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */ -#define DBL_MAX_EXP __DBL_MAX_EXP__ - /* Maximum double */ -#define DBL_MAX __DBL_MAX__ - /* Maximum int x such that 10**x is a representable double */ -#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__ - - /* Number of base-FLT_RADIX digits in the significand of a long double */ -#define LDBL_MANT_DIG __LDBL_MANT_DIG__ - /* Number of decimal digits of precision in a long double */ -#define LDBL_DIG __LDBL_DIG__ - /* Difference between 1.0 and the minimum long double greater than 1.0 */ -#define LDBL_EPSILON __LDBL_EPSILON__ - /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */ -#define LDBL_MIN_EXP __LDBL_MIN_EXP__ - /* Minimum normalised long double */ -#define LDBL_MIN __LDBL_MIN__ - /* Minimum int x such that 10**x is a normalised long double */ -#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__ - /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */ -#define LDBL_MAX_EXP __LDBL_MAX_EXP__ - /* Maximum long double */ -#define LDBL_MAX __LDBL_MAX__ - /* Maximum int x such that 10**x is a representable long double */ -#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__ - -#endif diff --git a/platform/win32/internals/_PDCLIB_config.h b/platform/win32/internals/_PDCLIB_config.h index 17c8ff4..81e13a6 100644 --- a/platform/win32/internals/_PDCLIB_config.h +++ b/platform/win32/internals/_PDCLIB_config.h @@ -246,6 +246,18 @@ struct _PDCLIB_imaxdiv_t */ #define _PDCLIB_DECIMAL_DIG 17 +/* Floating point types + * + * PDCLib (at present) assumes IEEE 754 floating point formats + * The following names are used: + * SINGLE: IEEE 754 single precision (32-bit) + * DOUBLE: IEEE 754 double precision (64-bit) + * EXTENDED: IEEE 754 extended precision (80-bit, as x87) + */ +#define _PDCLIB_FLOAT_TYPE SINGLE +#define _PDCLIB_DOUBLE_TYPE DOUBLE +#define _PDCLIB_LDOUBLE_TYPE EXTENDED + /* -------------------------------------------------------------------------- */ /* Platform-dependent macros defined by the standard headers. */ /* -------------------------------------------------------------------------- */ -- 2.40.0