1 /* file: libm_error_codes.h */
2 
3 
4 /*
5 // Copyright (c) 2000 - 2004, Intel Corporation
6 // All rights reserved.
7 //
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are
11 // met:
12 //
13 // * Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
15 //
16 // * Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
19 //
20 // * The name of Intel Corporation may not be used to endorse or promote
21 // products derived from this software without specific prior written
22 // permission.
23 
24 //
25 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
33 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Intel Corporation is the author of this code, and requests that all
38 // problem reports or change requests be submitted to it directly at
39 // http://www.intel.com/software/products/opensource/libraries/num.htm.
40 //
41 
42 // Abstract:
43 // ========================================================================
44 // This file contains the interface to the Intel exception dispatcher.
45 //
46 //
47 // History:
48 // ========================================================================
49 // 12/15/2004 Initial version - extracted from libm_support.h
50 //
51 */
52 
53 #if !defined(__LIBM_ERROR_CODES_H__)
54 #define __LIBM_ERROR_CODES_H__
55 
56 typedef enum
57 {
58   logl_zero=0,   logl_negative,                  /*  0,  1 */
59   log_zero,      log_negative,                   /*  2,  3 */
60   logf_zero,     logf_negative,                  /*  4,  5 */
61   log10l_zero,   log10l_negative,                /*  6,  7 */
62   log10_zero,    log10_negative,                 /*  8,  9 */
63   log10f_zero,   log10f_negative,                /* 10, 11 */
64   expl_overflow, expl_underflow,                 /* 12, 13 */
65   exp_overflow,  exp_underflow,                  /* 14, 15 */
66   expf_overflow, expf_underflow,                 /* 16, 17 */
67   powl_overflow, powl_underflow,                 /* 18, 19 */
68   powl_zero_to_zero,                             /* 20     */
69   powl_zero_to_negative,                         /* 21     */
70   powl_neg_to_non_integer,                       /* 22     */
71   powl_nan_to_zero,                              /* 23     */
72   pow_overflow,  pow_underflow,                  /* 24, 25 */
73   pow_zero_to_zero,                              /* 26     */
74   pow_zero_to_negative,                          /* 27     */
75   pow_neg_to_non_integer,                        /* 28     */
76   pow_nan_to_zero,                               /* 29     */
77   powf_overflow, powf_underflow,                 /* 30, 31 */
78   powf_zero_to_zero,                             /* 32     */
79   powf_zero_to_negative,                         /* 33     */
80   powf_neg_to_non_integer,                       /* 34     */
81   powf_nan_to_zero,                              /* 35     */
82   atan2l_zero,                                   /* 36     */
83   atan2_zero,                                    /* 37     */
84   atan2f_zero,                                   /* 38     */
85   expm1l_overflow,                               /* 39     */
86   expm1l_underflow,                              /* 40     */
87   expm1_overflow,                                /* 41     */
88   expm1_underflow,                               /* 42     */
89   expm1f_overflow,                               /* 43     */
90   expm1f_underflow,                              /* 44     */
91   hypotl_overflow,                               /* 45     */
92   hypot_overflow,                                /* 46     */
93   hypotf_overflow,                               /* 47     */
94   sqrtl_negative,                                /* 48     */
95   sqrt_negative,                                 /* 49     */
96   sqrtf_negative,                                /* 50     */
97   scalbl_overflow, scalbl_underflow,             /* 51, 52  */
98   scalb_overflow,  scalb_underflow,              /* 53, 54  */
99   scalbf_overflow, scalbf_underflow,             /* 55, 56  */
100   acosl_gt_one, acos_gt_one, acosf_gt_one,       /* 57, 58, 59 */
101   asinl_gt_one, asin_gt_one, asinf_gt_one,       /* 60, 61, 62 */
102   coshl_overflow, cosh_overflow, coshf_overflow, /* 63, 64, 65 */
103   y0l_zero, y0l_negative,y0l_gt_loss,            /* 66, 67, 68 */
104   y0_zero, y0_negative,y0_gt_loss,               /* 69, 70, 71 */
105   y0f_zero, y0f_negative,y0f_gt_loss,            /* 72, 73, 74 */
106   y1l_zero, y1l_negative,y1l_gt_loss,            /* 75, 76, 77 */
107   y1_zero, y1_negative,y1_gt_loss,               /* 78, 79, 80 */
108   y1f_zero, y1f_negative,y1f_gt_loss,            /* 81, 82, 83 */
109   ynl_zero, ynl_negative,ynl_gt_loss,            /* 84, 85, 86 */
110   yn_zero, yn_negative,yn_gt_loss,               /* 87, 88, 89 */
111   ynf_zero, ynf_negative,ynf_gt_loss,            /* 90, 91, 92 */
112   j0l_gt_loss,                                   /* 93 */
113   j0_gt_loss,                                    /* 94 */
114   j0f_gt_loss,                                   /* 95 */
115   j1l_gt_loss,                                   /* 96 */
116   j1_gt_loss,                                    /* 97 */
117   j1f_gt_loss,                                   /* 98 */
118   jnl_gt_loss,                                   /* 99 */
119   jn_gt_loss,                                    /* 100 */
120   jnf_gt_loss,                                   /* 101 */
121   lgammal_overflow, lgammal_negative,lgammal_reserve, /* 102, 103, 104 */
122   lgamma_overflow, lgamma_negative,lgamma_reserve,    /* 105, 106, 107 */
123   lgammaf_overflow, lgammaf_negative, lgammaf_reserve,/* 108, 109, 110 */
124   gammal_overflow,gammal_negative, gammal_reserve,    /* 111, 112, 113 */
125   gamma_overflow, gamma_negative, gamma_reserve,      /* 114, 115, 116 */
126   gammaf_overflow,gammaf_negative,gammaf_reserve,     /* 117, 118, 119 */
127   fmodl_by_zero,                                 /* 120 */
128   fmod_by_zero,                                  /* 121 */
129   fmodf_by_zero,                                 /* 122 */
130   remainderl_by_zero,                            /* 123 */
131   remainder_by_zero,                             /* 124 */
132   remainderf_by_zero,                            /* 125 */
133   sinhl_overflow, sinh_overflow, sinhf_overflow, /* 126, 127, 128 */
134   atanhl_gt_one, atanhl_eq_one,                  /* 129, 130 */
135   atanh_gt_one, atanh_eq_one,                    /* 131, 132 */
136   atanhf_gt_one, atanhf_eq_one,                  /* 133, 134 */
137   acoshl_lt_one,                                 /* 135 */
138   acosh_lt_one,                                  /* 136 */
139   acoshf_lt_one,                                 /* 137 */
140   log1pl_zero,   log1pl_negative,                /* 138, 139 */
141   log1p_zero,    log1p_negative,                 /* 140, 141 */
142   log1pf_zero,   log1pf_negative,                /* 142, 143 */
143   ldexpl_overflow,   ldexpl_underflow,           /* 144, 145 */
144   ldexp_overflow,    ldexp_underflow,            /* 146, 147 */
145   ldexpf_overflow,   ldexpf_underflow,           /* 148, 149 */
146   logbl_zero,   logb_zero, logbf_zero,           /* 150, 151, 152 */
147   nextafterl_overflow,   nextafter_overflow,
148   nextafterf_overflow,                           /* 153, 154, 155 */
149   ilogbl_zero,  ilogb_zero, ilogbf_zero,         /* 156, 157, 158 */
150   exp2l_overflow, exp2l_underflow,               /* 159, 160 */
151   exp2_overflow,  exp2_underflow,                /* 161, 162 */
152   exp2f_overflow, exp2f_underflow,               /* 163, 164 */
153   exp10l_overflow, exp10_overflow,
154   exp10f_overflow,                               /* 165, 166, 167 */
155   log2l_zero,    log2l_negative,                 /* 168, 169 */
156   log2_zero,     log2_negative,                  /* 170, 171 */
157   log2f_zero,    log2f_negative,                 /* 172, 173 */
158   scalbnl_overflow, scalbnl_underflow,           /* 174, 175 */
159   scalbn_overflow,  scalbn_underflow,            /* 176, 177 */
160   scalbnf_overflow, scalbnf_underflow,           /* 178, 179 */
161   remquol_by_zero,                               /* 180 */
162   remquo_by_zero,                                /* 181 */
163   remquof_by_zero,                               /* 182 */
164   lrintl_large, lrint_large, lrintf_large,       /* 183, 184, 185 */
165   llrintl_large, llrint_large, llrintf_large,    /* 186, 187, 188 */
166   lroundl_large, lround_large, lroundf_large,    /* 189, 190, 191 */
167   llroundl_large, llround_large, llroundf_large, /* 192, 193, 194 */
168   fdiml_overflow, fdim_overflow, fdimf_overflow, /* 195, 196, 197 */
169   nexttowardl_overflow,   nexttoward_overflow,
170   nexttowardf_overflow,                          /* 198, 199, 200 */
171   scalblnl_overflow, scalblnl_underflow,         /* 201, 202 */
172   scalbln_overflow,  scalbln_underflow,          /* 203, 204 */
173   scalblnf_overflow, scalblnf_underflow,         /* 205, 206 */
174   erfcl_underflow, erfc_underflow, erfcf_underflow, /* 207, 208, 209 */
175   acosdl_gt_one, acosd_gt_one, acosdf_gt_one,    /* 210, 211, 212 */
176   asindl_gt_one, asind_gt_one, asindf_gt_one,    /* 213, 214, 215 */
177   atan2dl_zero, atan2d_zero, atan2df_zero,       /* 216, 217, 218 */
178   tandl_overflow, tand_overflow, tandf_overflow, /* 219, 220, 221 */
179   cotdl_overflow, cotd_overflow, cotdf_overflow, /* 222, 223, 224 */
180   cotl_overflow, cot_overflow, cotf_overflow,    /* 225, 226, 227 */
181   sinhcoshl_overflow, sinhcosh_overflow, sinhcoshf_overflow, /* 228, 229, 230 */
182   annuityl_by_zero, annuity_by_zero, annuityf_by_zero, /* 231, 232, 233 */
183   annuityl_less_m1, annuity_less_m1, annuityf_less_m1, /* 234, 235, 236 */
184   annuityl_overflow, annuity_overflow, annuityf_overflow, /* 237, 238, 239 */
185   annuityl_underflow, annuity_underflow, annuityf_underflow, /* 240, 241, 242 */
186   compoundl_by_zero, compound_by_zero, compoundf_by_zero, /* 243, 244, 245 */
187   compoundl_less_m1, compound_less_m1, compoundf_less_m1, /* 246, 247, 248 */
188   compoundl_overflow, compound_overflow, compoundf_overflow, /* 249, 250, 251 */
189   compoundl_underflow, compound_underflow, compoundf_underflow, /* 252, 253, 254 */
190   tgammal_overflow, tgammal_negative, tgammal_reserve, /* 255, 256, 257 */
191   tgamma_overflow, tgamma_negative, tgamma_reserve, /* 258, 259, 260 */
192   tgammaf_overflow, tgammaf_negative, tgammaf_reserve, /* 261, 262, 263 */
193   exp10l_underflow, exp10_underflow, exp10f_underflow, /* 264, 265, 266 */
194   nextafterl_underflow, nextafter_underflow,
195   nextafterf_underflow,                                /* 267, 268, 269 */
196   nexttowardl_underflow, nexttoward_underflow,
197   nexttowardf_underflow                                /* 270, 271, 272 */
198 } error_types;
199 
200 #define LIBM_ERROR __libm_error_support
201 
202 extern void LIBM_ERROR(void*,void*,void*,error_types);
203 #ifdef _LIBC
204 libc_hidden_proto(LIBM_ERROR)
205 #endif
206 
207 #define LIBM_ERROR1(x,r,e)	LIBM_ERROR(&(x), (void *)0, &(r), e)
208 #define LIBM_ERROR2(x,y,r,e)	LIBM_ERROR(&(x), &(y), &(r), e)
209 
210 #endif // !defined(__LIBM_ERROR_CODES_H__)
211