Commit 60870ae9 authored by Marius Gerbershagen's avatar Marius Gerbershagen

use correct unnormalized values for minimum float constants

    Fixes #470.
parent 19c6635f
Pipeline #47412149 (#215) failed with stage
......@@ -15,41 +15,57 @@
ecl_def_ct_single_float(flt_max,FLT_MAX,static,const);
ecl_def_ct_single_float(flt_max_neg,-FLT_MAX,static,const);
ecl_def_ct_single_float(flt_min,FLT_MIN,static,const);
ecl_def_ct_single_float(flt_min_neg,-FLT_MIN,static,const);
ecl_def_ct_single_float(flt_min,FLT_TRUE_MIN,static,const);
ecl_def_ct_single_float(flt_min_neg,-FLT_TRUE_MIN,static,const);
ecl_def_ct_single_float(flt_min_norm,FLT_MIN,static,const);
ecl_def_ct_single_float(flt_min_neg_norm,-FLT_MIN,static,const);
#define ECL_LEAST_POSITIVE_SINGLE_FLOAT (cl_object)(&flt_min_data)
#define ECL_LEAST_NEGATIVE_SINGLE_FLOAT (cl_object)(&flt_min_neg_data)
#define ECL_LEAST_POSITIVE_NORMALIZED_SINGLE_FLOAT (cl_object)(&flt_min_norm_data)
#define ECL_LEAST_NEGATIVE_NORMALIZED_SINGLE_FLOAT (cl_object)(&flt_min_neg_norm_data)
#define ECL_MOST_POSITIVE_SINGLE_FLOAT (cl_object)(&flt_max_data)
#define ECL_MOST_NEGATIVE_SINGLE_FLOAT (cl_object)(&flt_max_neg_data)
#define ECL_LEAST_POSITIVE_SHORT_FLOAT (cl_object)(&flt_min_data)
#define ECL_LEAST_NEGATIVE_SHORT_FLOAT (cl_object)(&flt_min_neg_data)
#define ECL_LEAST_POSITIVE_NORMALIZED_SHORT_FLOAT (cl_object)(&flt_min_norm_data)
#define ECL_LEAST_NEGATIVE_NORMALIZED_SHORT_FLOAT (cl_object)(&flt_min_neg_norm_data)
#define ECL_MOST_POSITIVE_SHORT_FLOAT (cl_object)(&flt_max_data)
#define ECL_MOST_NEGATIVE_SHORT_FLOAT (cl_object)(&flt_max_neg_data)
ecl_def_ct_double_float(dbl_max,DBL_MAX,static,const);
ecl_def_ct_double_float(dbl_max_neg,-DBL_MAX,static,const);
ecl_def_ct_double_float(dbl_min,DBL_MIN,static,const);
ecl_def_ct_double_float(dbl_min_neg,-DBL_MIN,static,const);
ecl_def_ct_double_float(dbl_min,DBL_TRUE_MIN,static,const);
ecl_def_ct_double_float(dbl_min_neg,-DBL_TRUE_MIN,static,const);
ecl_def_ct_double_float(dbl_min_norm,DBL_MIN,static,const);
ecl_def_ct_double_float(dbl_min_neg_norm,-DBL_MIN,static,const);
#define ECL_LEAST_POSITIVE_DOUBLE_FLOAT (cl_object)(&dbl_min_data)
#define ECL_LEAST_NEGATIVE_DOUBLE_FLOAT (cl_object)(&dbl_min_neg_data)
#define ECL_LEAST_POSITIVE_NORMALIZED_DOUBLE_FLOAT (cl_object)(&dbl_min_norm_data)
#define ECL_LEAST_NEGATIVE_NORMALIZED_DOUBLE_FLOAT (cl_object)(&dbl_min_neg_norm_data)
#define ECL_MOST_POSITIVE_DOUBLE_FLOAT (cl_object)(&dbl_max_data)
#define ECL_MOST_NEGATIVE_DOUBLE_FLOAT (cl_object)(&dbl_max_neg_data)
#ifdef ECL_LONG_FLOAT
ecl_def_ct_long_float(ldbl_max,LDBL_MAX,static,const);
ecl_def_ct_long_float(ldbl_max_neg,-LDBL_MAX,static,const);
ecl_def_ct_long_float(ldbl_min,LDBL_MIN,static,const);
ecl_def_ct_long_float(ldbl_min_neg,-LDBL_MIN,static,const);
ecl_def_ct_long_float(ldbl_min,LDBL_TRUE_MIN,static,const);
ecl_def_ct_long_float(ldbl_min_neg,-LDBL_TRUE_MIN,static,const);
ecl_def_ct_long_float(ldbl_min_norm,LDBL_MIN,static,const);
ecl_def_ct_long_float(ldbl_min_neg_norm,-LDBL_MIN,static,const);
#define ECL_LEAST_POSITIVE_LONG_FLOAT (cl_object)(&ldbl_min_data)
#define ECL_LEAST_NEGATIVE_LONG_FLOAT (cl_object)(&ldbl_min_neg_data)
#define ECL_LEAST_POSITIVE_NORMALIZED_LONG_FLOAT (cl_object)(&ldbl_min_norm_data)
#define ECL_LEAST_NEGATIVE_NORMALIZED_LONG_FLOAT (cl_object)(&ldbl_min_neg_norm_data)
#define ECL_MOST_POSITIVE_LONG_FLOAT (cl_object)(&ldbl_max_data)
#define ECL_MOST_NEGATIVE_LONG_FLOAT (cl_object)(&ldbl_max_neg_data)
#else
#define ECL_LEAST_POSITIVE_LONG_FLOAT (cl_object)(&dbl_min_data)
#define ECL_LEAST_NEGATIVE_LONG_FLOAT (cl_object)(&dbl_min_neg_data)
#define ECL_LEAST_POSITIVE_NORMALIZED_LONG_FLOAT (cl_object)(&dbl_min_norm_data)
#define ECL_LEAST_NEGATIVE_NORMALIZED_LONG_FLOAT (cl_object)(&dbl_min_neg_norm_data)
#define ECL_MOST_POSITIVE_LONG_FLOAT (cl_object)(&dbl_max_data)
#define ECL_MOST_NEGATIVE_LONG_FLOAT (cl_object)(&dbl_max_neg_data)
#endif
......
......@@ -545,18 +545,18 @@ cl_symbols[] = {
{"LDIFF", CL_ORDINARY, cl_ldiff, 2, OBJNULL},
{"LEAST-NEGATIVE-DOUBLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_DOUBLE_FLOAT},
{"LEAST-NEGATIVE-LONG-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_LONG_FLOAT},
{"LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_DOUBLE_FLOAT},
{"LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_LONG_FLOAT},
{"LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_SHORT_FLOAT},
{"LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_SINGLE_FLOAT},
{"LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_NORMALIZED_DOUBLE_FLOAT},
{"LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_NORMALIZED_LONG_FLOAT},
{"LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_NORMALIZED_SHORT_FLOAT},
{"LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_NORMALIZED_SINGLE_FLOAT},
{"LEAST-NEGATIVE-SHORT-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_SHORT_FLOAT},
{"LEAST-NEGATIVE-SINGLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_NEGATIVE_SINGLE_FLOAT},
{"LEAST-POSITIVE-DOUBLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_DOUBLE_FLOAT},
{"LEAST-POSITIVE-LONG-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_LONG_FLOAT},
{"LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_DOUBLE_FLOAT},
{"LEAST-POSITIVE-NORMALIZED-LONG-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_LONG_FLOAT},
{"LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_SHORT_FLOAT},
{"LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_SINGLE_FLOAT},
{"LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_NORMALIZED_DOUBLE_FLOAT},
{"LEAST-POSITIVE-NORMALIZED-LONG-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_NORMALIZED_LONG_FLOAT},
{"LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_NORMALIZED_SHORT_FLOAT},
{"LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_NORMALIZED_SINGLE_FLOAT},
{"LEAST-POSITIVE-SHORT-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_SHORT_FLOAT},
{"LEAST-POSITIVE-SINGLE-FLOAT", CL_CONSTANT, NULL, -1, ECL_LEAST_POSITIVE_SINGLE_FLOAT},
{"LENGTH", CL_ORDINARY, cl_length, 1, OBJNULL},
......
......@@ -135,21 +135,21 @@
(MOST-NEGATIVE-SHORT-FLOAT "-FLT_MAX")
(MOST-NEGATIVE-SINGLE-FLOAT "-FLT_MAX")
(LEAST-POSITIVE-SHORT-FLOAT "FLT_MIN")
(LEAST-POSITIVE-SINGLE-FLOAT "FLT_MIN")
(LEAST-POSITIVE-SHORT-FLOAT "FLT_TRUE_MIN")
(LEAST-POSITIVE-SINGLE-FLOAT "FLT_TRUE_MIN")
(LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT "FLT_MIN")
(LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT" FLT_MIN")
(LEAST-NEGATIVE-SHORT-FLOAT "-FLT_MIN")
(LEAST-NEGATIVE-SINGLE-FLOAT "-FLT_MIN")
(LEAST-NEGATIVE-SHORT-FLOAT "-FLT_TRUE_MIN")
(LEAST-NEGATIVE-SINGLE-FLOAT "-FLT_TRUE_MIN")
(LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT "-FLT_MIN")
(LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT "-FLT_MIN")
(MOST-POSITIVE-DOUBLE-FLOAT "DBL_MAX")
(MOST-NEGATIVE-DOUBLE-FLOAT "-DBL_MAX")
(LEAST-POSITIVE-DOUBLE-FLOAT "DBL_MIN")
(LEAST-POSITIVE-DOUBLE-FLOAT "DBL_TRUE_MIN")
(LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT "DBL_MIN")
(LEAST-NEGATIVE-DOUBLE-FLOAT "-DBL_MIN")
(LEAST-NEGATIVE-DOUBLE-FLOAT "-DBL_TRUE_MIN")
(LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT "-DBL_MIN")
#+ieee-floating-point
......@@ -164,9 +164,9 @@
#+long-float
,@'((MOST-POSITIVE-LONG-FLOAT "LDBL_MAX")
(MOST-NEGATIVE-LONG-FLOAT "-LDBL_MAX")
(LEAST-POSITIVE-LONG-FLOAT "LDBL_MIN")
(LEAST-POSITIVE-LONG-FLOAT "LDBL_TRUE_MIN")
(LEAST-POSITIVE-NORMALIZED-LONG-FLOAT" LDBL_MIN")
(LEAST-NEGATIVE-LONG-FLOAT "-LDBL_MIN")
(LEAST-NEGATIVE-LONG-FLOAT "-LDBL_TRUE_MIN")
(LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT "-LDBL_MIN")
#+ieee-floating-point
(LONG-FLOAT-POSITIVE-INFINITY "INFINITY")
......
......@@ -669,6 +669,23 @@ static union {
# endif /* _MSC_VER == 1600 */
#endif /* ~NAN */
/*
* If minimum unnormalized floating point values defined in ISO C11
* are not declared, we use the normalized ones as the next best
* portable approximation.
*/
#include <float.h>
#ifndef FLT_TRUE_MIN
# define FLT_TRUE_MIN FLT_MIN
#endif
#ifndef DBL_TRUE_MIN
# define DBL_TRUE_MIN DBL_MIN
#endif
#ifndef LDBL_TRUE_MIN
# define LDBL_TRUE_MIN LDBL_MIN
#endif
#ifdef __cplusplus
}
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment