File indexing completed on 2025-02-21 10:03:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef __GSL_IEEE_UTILS_H__
0021 #define __GSL_IEEE_UTILS_H__
0022 #include <stdio.h>
0023
0024 #undef __BEGIN_DECLS
0025 #undef __END_DECLS
0026 #ifdef __cplusplus
0027 # define __BEGIN_DECLS extern "C" {
0028 # define __END_DECLS }
0029 #else
0030 # define __BEGIN_DECLS
0031 # define __END_DECLS
0032 #endif
0033
0034 __BEGIN_DECLS
0035
0036 enum {
0037 GSL_IEEE_TYPE_NAN = 1,
0038 GSL_IEEE_TYPE_INF = 2,
0039 GSL_IEEE_TYPE_NORMAL = 3,
0040 GSL_IEEE_TYPE_DENORMAL = 4,
0041 GSL_IEEE_TYPE_ZERO = 5
0042 } ;
0043
0044 typedef struct {
0045 int sign ;
0046 char mantissa[24] ;
0047 int exponent ;
0048 int type ;
0049 } gsl_ieee_float_rep ;
0050
0051 typedef struct {
0052 int sign ;
0053 char mantissa[53] ;
0054 int exponent ;
0055 int type ;
0056 } gsl_ieee_double_rep ;
0057
0058
0059 void gsl_ieee_printf_float (const float * x) ;
0060 void gsl_ieee_printf_double (const double * x) ;
0061
0062 void gsl_ieee_fprintf_float (FILE * stream, const float * x) ;
0063 void gsl_ieee_fprintf_double (FILE * stream, const double * x) ;
0064
0065 void gsl_ieee_float_to_rep (const float * x, gsl_ieee_float_rep * r) ;
0066 void gsl_ieee_double_to_rep (const double * x, gsl_ieee_double_rep * r) ;
0067
0068 enum {
0069 GSL_IEEE_SINGLE_PRECISION = 1,
0070 GSL_IEEE_DOUBLE_PRECISION = 2,
0071 GSL_IEEE_EXTENDED_PRECISION = 3
0072 } ;
0073
0074 enum {
0075 GSL_IEEE_ROUND_TO_NEAREST = 1,
0076 GSL_IEEE_ROUND_DOWN = 2,
0077 GSL_IEEE_ROUND_UP = 3,
0078 GSL_IEEE_ROUND_TO_ZERO = 4
0079 } ;
0080
0081 enum {
0082 GSL_IEEE_MASK_INVALID = 1,
0083 GSL_IEEE_MASK_DENORMALIZED = 2,
0084 GSL_IEEE_MASK_DIVISION_BY_ZERO = 4,
0085 GSL_IEEE_MASK_OVERFLOW = 8,
0086 GSL_IEEE_MASK_UNDERFLOW = 16,
0087 GSL_IEEE_MASK_ALL = 31,
0088 GSL_IEEE_TRAP_INEXACT = 32
0089 } ;
0090
0091 void gsl_ieee_env_setup (void) ;
0092 int gsl_ieee_read_mode_string (const char * description, int * precision,
0093 int * rounding, int * exception_mask) ;
0094 int gsl_ieee_set_mode (int precision, int rounding, int exception_mask) ;
0095
0096 __END_DECLS
0097
0098 #endif
0099