Print this page
10882 math headers should stop supporting K&R C


  31 
  32 #ifndef _FLOATINGPOINT_H
  33 #define _FLOATINGPOINT_H
  34 
  35 #ifdef __STDC__
  36 #include <stdio_tag.h>
  37 #endif
  38 #include <sys/ieeefp.h>
  39 
  40 #ifdef __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*
  45  * <floatingpoint.h> contains definitions for constants, types, variables,
  46  * and functions for:
  47  *      IEEE floating-point arithmetic base conversion;
  48  *      IEEE floating-point arithmetic modes;
  49  *      IEEE floating-point arithmetic exception handling.
  50  */
  51 
  52 #ifndef __P
  53 #ifdef __STDC__
  54 #define __P(p)  p
  55 #else
  56 #define __P(p)  ()
  57 #endif
  58 #endif  /* !defined(__P) */
  59 
  60 #if defined(__STDC__) && !defined(_FILEDEFED)
  61 #define _FILEDEFED
  62 typedef __FILE FILE;
  63 #endif
  64 
  65 typedef int sigfpe_code_type;   /* Type of SIGFPE code. */
  66 
  67 typedef void (*sigfpe_handler_type)();  /* Pointer to exception handler */
  68 
  69 #define SIGFPE_DEFAULT (void (*)())0    /* default exception handling */
  70 #define SIGFPE_IGNORE  (void (*)())1    /* ignore this exception or code */
  71 #define SIGFPE_ABORT   (void (*)())2    /* force abort on exception */
  72 
  73 extern sigfpe_handler_type sigfpe __P((sigfpe_code_type, sigfpe_handler_type));
  74 
  75 /*
  76  * Types for IEEE floating point.
  77  */
  78 typedef float single;
  79 
  80 #ifndef _EXTENDED
  81 #define _EXTENDED
  82 typedef unsigned extended[3];
  83 #endif
  84 
  85 typedef long double quadruple;  /* Quadruple-precision type. */
  86 
  87 typedef unsigned fp_exception_field_type;
  88                                 /*
  89                                  * A field containing fp_exceptions OR'ed
  90                                  * together.
  91                                  */
  92 /*
  93  * Definitions for base conversion.


 129         int ndigits;            /* Number of digits for conversion. */
 130 } decimal_mode;
 131 
 132 enum decimal_string_form {      /* Valid decimal number string formats. */
 133         invalid_form,           /* Not a valid decimal string format. */
 134         whitespace_form,        /* All white space - valid in Fortran! */
 135         fixed_int_form,         /* <digs>         */
 136         fixed_intdot_form,      /* <digs>.                */
 137         fixed_dotfrac_form,     /* .<digs>                */
 138         fixed_intdotfrac_form,  /* <digs>.<frac>    */
 139         floating_int_form,      /* <digs><exp>              */
 140         floating_intdot_form,   /* <digs>.<exp>             */
 141         floating_dotfrac_form,  /* .<digs><exp>             */
 142         floating_intdotfrac_form, /* <digs>.<digs><exp>       */
 143         inf_form,               /* inf                  */
 144         infinity_form,          /* infinity             */
 145         nan_form,               /* nan                  */
 146         nanstring_form          /* nan(string)          */
 147 };
 148 
 149 extern void single_to_decimal __P((single *, decimal_mode *, decimal_record *,
 150                                 fp_exception_field_type *));
 151 extern void double_to_decimal __P((double *, decimal_mode *, decimal_record *,
 152                                 fp_exception_field_type *));
 153 extern void extended_to_decimal __P((extended *, decimal_mode *,
 154                                 decimal_record *, fp_exception_field_type *));
 155 extern void quadruple_to_decimal __P((quadruple *, decimal_mode *,
 156                                 decimal_record *, fp_exception_field_type *));
 157 
 158 extern void decimal_to_single __P((single *, decimal_mode *, decimal_record *,
 159                                 fp_exception_field_type *));
 160 extern void decimal_to_double __P((double *, decimal_mode *, decimal_record *,
 161                                 fp_exception_field_type *));
 162 extern void decimal_to_extended __P((extended *, decimal_mode *,
 163                                 decimal_record *, fp_exception_field_type *));
 164 extern void decimal_to_quadruple __P((quadruple *, decimal_mode *,
 165                                 decimal_record *, fp_exception_field_type *));
 166 
 167 extern void string_to_decimal __P((char **, int, int, decimal_record *,
 168                                 enum decimal_string_form *, char **));
 169 extern void func_to_decimal __P((char **, int, int, decimal_record *,
 170                                 enum decimal_string_form *, char **,
 171                                 int (*)(void), int *, int (*)(int)));
 172 extern void file_to_decimal __P((char **, int, int, decimal_record *,
 173                                 enum decimal_string_form *, char **,
 174                                 FILE *, int *));
 175 
 176 extern char *seconvert __P((single *, int, int *, int *, char *));
 177 extern char *sfconvert __P((single *, int, int *, int *, char *));
 178 extern char *sgconvert __P((single *, int, int, char *));
 179 extern char *econvert __P((double, int, int *, int *, char *));
 180 extern char *fconvert __P((double, int, int *, int *, char *));
 181 extern char *gconvert __P((double, int, int, char *));
 182 extern char *qeconvert __P((quadruple *, int, int *, int *, char *));
 183 extern char *qfconvert __P((quadruple *, int, int *, int *, char *));
 184 extern char *qgconvert __P((quadruple *, int, int, char *));
 185 
 186 extern char *ecvt __P((double, int, int *, int *));
 187 extern char *fcvt __P((double, int, int *, int *));
 188 extern char *gcvt __P((double, int, char *));
 189 
 190 #if __cplusplus >= 199711L
 191 namespace std {
 192 #endif
 193 /*
 194  * ANSI C Standard says the following entry points should be
 195  * prototyped in <stdlib.h>.  They are now, but weren't before.
 196  */
 197 extern double atof __P((const char *));
 198 extern double strtod __P((const char *, char **));
 199 #if __cplusplus >= 199711L
 200 }
 201 
 202 using std::atof;
 203 using std::strtod;
 204 #endif /* end of namespace std */
 205 
 206 #ifdef __cplusplus
 207 }
 208 #endif
 209 
 210 #endif /* _FLOATINGPOINT_H */


  31 
  32 #ifndef _FLOATINGPOINT_H
  33 #define _FLOATINGPOINT_H
  34 
  35 #ifdef __STDC__
  36 #include <stdio_tag.h>
  37 #endif
  38 #include <sys/ieeefp.h>
  39 
  40 #ifdef __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*
  45  * <floatingpoint.h> contains definitions for constants, types, variables,
  46  * and functions for:
  47  *      IEEE floating-point arithmetic base conversion;
  48  *      IEEE floating-point arithmetic modes;
  49  *      IEEE floating-point arithmetic exception handling.
  50  */









  51 #if defined(__STDC__) && !defined(_FILEDEFED)
  52 #define _FILEDEFED
  53 typedef __FILE FILE;
  54 #endif
  55 
  56 typedef int sigfpe_code_type;   /* Type of SIGFPE code. */
  57 
  58 typedef void (*sigfpe_handler_type)();  /* Pointer to exception handler */
  59 
  60 #define SIGFPE_DEFAULT (void (*)())0    /* default exception handling */
  61 #define SIGFPE_IGNORE  (void (*)())1    /* ignore this exception or code */
  62 #define SIGFPE_ABORT   (void (*)())2    /* force abort on exception */
  63 
  64 extern sigfpe_handler_type sigfpe(sigfpe_code_type, sigfpe_handler_type);
  65 
  66 /*
  67  * Types for IEEE floating point.
  68  */
  69 typedef float single;
  70 
  71 #ifndef _EXTENDED
  72 #define _EXTENDED
  73 typedef unsigned extended[3];
  74 #endif
  75 
  76 typedef long double quadruple;  /* Quadruple-precision type. */
  77 
  78 typedef unsigned fp_exception_field_type;
  79                                 /*
  80                                  * A field containing fp_exceptions OR'ed
  81                                  * together.
  82                                  */
  83 /*
  84  * Definitions for base conversion.


 120         int ndigits;            /* Number of digits for conversion. */
 121 } decimal_mode;
 122 
 123 enum decimal_string_form {      /* Valid decimal number string formats. */
 124         invalid_form,           /* Not a valid decimal string format. */
 125         whitespace_form,        /* All white space - valid in Fortran! */
 126         fixed_int_form,         /* <digs>         */
 127         fixed_intdot_form,      /* <digs>.                */
 128         fixed_dotfrac_form,     /* .<digs>                */
 129         fixed_intdotfrac_form,  /* <digs>.<frac>    */
 130         floating_int_form,      /* <digs><exp>              */
 131         floating_intdot_form,   /* <digs>.<exp>             */
 132         floating_dotfrac_form,  /* .<digs><exp>             */
 133         floating_intdotfrac_form, /* <digs>.<digs><exp>       */
 134         inf_form,               /* inf                  */
 135         infinity_form,          /* infinity             */
 136         nan_form,               /* nan                  */
 137         nanstring_form          /* nan(string)          */
 138 };
 139 
 140 extern void single_to_decimal(single *, decimal_mode *, decimal_record *,
 141     fp_exception_field_type *);
 142 extern void double_to_decimal(double *, decimal_mode *, decimal_record *,
 143     fp_exception_field_type *);
 144 extern void extended_to_decimal(extended *, decimal_mode *,
 145     decimal_record *, fp_exception_field_type *);
 146 extern void quadruple_to_decimal(quadruple *, decimal_mode *,
 147     decimal_record *, fp_exception_field_type *);
 148 
 149 extern void decimal_to_single(single *, decimal_mode *, decimal_record *,
 150     fp_exception_field_type *);
 151 extern void decimal_to_double(double *, decimal_mode *, decimal_record *,
 152     fp_exception_field_type *);
 153 extern void decimal_to_extended(extended *, decimal_mode *,
 154     decimal_record *, fp_exception_field_type *);
 155 extern void decimal_to_quadruple(quadruple *, decimal_mode *,
 156     decimal_record *, fp_exception_field_type *);
 157 
 158 extern void string_to_decimal(char **, int, int, decimal_record *,
 159     enum decimal_string_form *, char **);
 160 extern void func_to_decimal(char **, int, int, decimal_record *,
 161     enum decimal_string_form *, char **,
 162     int (*)(void), int *, int (*)(int));
 163 extern void file_to_decimal(char **, int, int, decimal_record *,
 164     enum decimal_string_form *, char **,
 165     FILE *, int *);
 166 
 167 extern char *seconvert(single *, int, int *, int *, char *);
 168 extern char *sfconvert(single *, int, int *, int *, char *);
 169 extern char *sgconvert(single *, int, int, char *);
 170 extern char *econvert(double, int, int *, int *, char *);
 171 extern char *fconvert(double, int, int *, int *, char *);
 172 extern char *gconvert(double, int, int, char *);
 173 extern char *qeconvert(quadruple *, int, int *, int *, char *);
 174 extern char *qfconvert(quadruple *, int, int *, int *, char *);
 175 extern char *qgconvert(quadruple *, int, int, char *);
 176 
 177 extern char *ecvt(double, int, int *, int *);
 178 extern char *fcvt(double, int, int *, int *);
 179 extern char *gcvt(double, int, char *);
 180 
 181 #if __cplusplus >= 199711L
 182 namespace std {
 183 #endif
 184 /*
 185  * ANSI C Standard says the following entry points should be
 186  * prototyped in <stdlib.h>.  They are now, but weren't before.
 187  */
 188 extern double atof(const char *);
 189 extern double strtod(const char *, char **);
 190 #if __cplusplus >= 199711L
 191 }
 192 
 193 using std::atof;
 194 using std::strtod;
 195 #endif /* end of namespace std */
 196 
 197 #ifdef __cplusplus
 198 }
 199 #endif
 200 
 201 #endif /* _FLOATINGPOINT_H */