Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2695 lines
60 KiB

  1. //
  2. // Copyright (c) 2000, Intel Corporation
  3. // All rights reserved.
  4. //
  5. // Contributed 2/2/2000 by John Harrison, Ted Kubaska, Bob Norin, Shane Story, James
  6. // Edwards, and Ping Tak Peter Tang of the Computational Software Lab, Intel Corporation.
  7. //
  8. // WARRANTY DISCLAIMER
  9. //
  10. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  11. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  12. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  13. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR ITS
  14. // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  15. // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  16. // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  17. // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  18. // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR TORT (INCLUDING
  19. // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  20. // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. //
  22. // Intel Corporation is the author of this code, and requests that all
  23. // problem reports or change requests be submitted to it directly at
  24. // http://developer.intel.com/opensource.
  25. //
  26. // History
  27. //==============================================================
  28. // 2/02/00: Initial version
  29. // 3/22/00: Updated to support flexible and dynamic error handling.
  30. //
  31. #include <errno.h>
  32. #include <stdio.h>
  33. #include "libm_support.h"
  34. _LIB_VERSION_TYPE
  35. #if defined( __MS__ )
  36. _LIB_VERSION = _MS_;
  37. #elif defined( _POSIX_ )
  38. _LIB_VERSION = __POSIX__;
  39. #elif defined( __XOPEN__ )
  40. _LIB_VERSION = _XOPEN_;
  41. #elif defined( __SVID__ )
  42. _LIB_VERSION = _SVID_;
  43. #elif defined( __IEEE__ )
  44. _LIB_VERSION = _IEEE_;
  45. #else
  46. _LIB_VERSION = _ISOC_;
  47. #endif
  48. void __libm_error_support(void *arg1,void *arg2,void *retval,error_types input_tag)
  49. {
  50. # ifdef __cplusplus
  51. struct __exception exc;
  52. # else
  53. struct exception exc;
  54. # endif
  55. struct exceptionf excf;
  56. const char float_inf[4] = {0x00,0x00,0x80,0x7F};
  57. const char float_huge[4] = {0xFF,0xFF,0x7F,0x7F};
  58. const char float_zero[4] = {0x00,0x00,0x00,0x00};
  59. const char float_neg_inf[4] = {0x00,0x00,0x80,0xFF};
  60. const char float_neg_huge[4] = {0xFF,0xFF,0x7F,0xFF};
  61. const char float_neg_zero[4] = {0x00,0x00,0x00,0x80};
  62. const char double_inf[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x7F};
  63. const char double_huge[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0x7F};
  64. const char double_zero[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
  65. const char double_neg_inf[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF};
  66. const char double_neg_huge[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xEF,0xFF};
  67. const char double_neg_zero[8] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80};
  68. const char long_double_inf[10] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0x7F};
  69. const char long_double_huge[10] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7F};
  70. const char long_double_zero[10] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
  71. const char long_double_neg_inf[10] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xFF,0xFF};
  72. const char long_double_neg_huge[10] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF};
  73. const char long_double_neg_zero[10] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80};
  74. #define RETVAL_HUGE_VALD *(double *)retval = *(double *) double_inf
  75. #define RETVAL_NEG_HUGE_VALD *(double *)retval = *(double *) double_neg_inf
  76. #define RETVAL_HUGED *(double *)retval = (double) *(float *)float_huge
  77. #define RETVAL_NEG_HUGED *(double *)retval = (double) *(float *) float_neg_huge
  78. #define RETVAL_HUGE_VALF *(float *)retval = *(float *) float_inf
  79. #define RETVAL_NEG_HUGE_VALF *(float *)retval = *(float *) float_neg_inf
  80. #define RETVAL_HUGEF *(float *)retval = *(float *) float_huge
  81. #define RETVAL_NEG_HUGEF *(double *)retval = *(float *) float_neg_huge
  82. #define RETVAL_ZEROD *(double *)retval = *(double *)double_zero
  83. #define RETVAL_ZEROF *(float *)retval = *(float *)float_zero
  84. #define RETVAL_NEG_ZEROD *(double *)retval = *(double *)double_neg_zero
  85. #define RETVAL_NEG_ZEROF *(float *)retval = *(float *)float_neg_zero
  86. #define RETVAL_ONED *(double *)retval = 1.0
  87. #define RETVAL_ONEF *(float *)retval = 1.0f
  88. #ifdef __MS__
  89. #define NOT_MATHERRD exc.arg1=*(double *)arg1;exc.arg2=*(double *)arg2;exc.retval=*(double *)retval;if(!_matherr(&exc))
  90. #define NOT_MATHERRF excf.arg1=*(float *)arg1;excf.arg2=*(float *)arg2;excf.retval=*(float *)retval;if(!_matherr(&excf))
  91. #else
  92. #define NOT_MATHERRD exc.arg1=*(double *)arg1;exc.arg2=*(double *)arg2;exc.retval=*(double *)retval;if(!matherr(&exc))
  93. #define NOT_MATHERRF excf.arg1=*(float *)arg1;excf.arg2=*(float *)arg2;excf.retval=*(float *)retval;if(!matherrf(&excf))
  94. #endif
  95. #define ifSVID if(_LIB_VERSION==_SVID_)
  96. #define NAMED exc.name
  97. #define NAMEF excf.name
  98. //
  99. // These should work OK for MS because they are ints -
  100. // leading underbars are not necessary.
  101. //
  102. #define DOMAIN 1
  103. #define SING 2
  104. #define OVERFLOW 3
  105. #define UNDERFLOW 4
  106. #define TLOSS 5
  107. #define PLOSS 6
  108. #define SINGD exc.type = SING
  109. #define DOMAIND exc.type = DOMAIN
  110. #define OVERFLOWD exc.type = OVERFLOW
  111. #define UNDERFLOWD exc.type = UNDERFLOW
  112. #define TLOSSD exc.type = TLOSS
  113. #define SINGF excf.type = SING
  114. #define DOMAINF excf.type = DOMAIN
  115. #define OVERFLOWF excf.type = OVERFLOW
  116. #define UNDERFLOWF excf.type = UNDERFLOW
  117. #define TLOSSF excf.type = TLOSS
  118. #define INPUT_XD (exc.arg1=*(double*)arg1)
  119. #define INPUT_XF (excf.arg1=*(float*)arg1)
  120. #define INPUT_YD (exc.arg1=*(double*)arg2)
  121. #define INPUT_YF (excf.arg1=*(float*)arg2)
  122. #define INPUT_RESD (*(double *)retval)
  123. #define INPUT_RESF (*(float *)retval)
  124. #if defined( __MS__)
  125. #define WRITEL_LOG_ZERO
  126. #define WRITED_LOG_ZERO
  127. #define WRITEF_LOG_ZERO
  128. #define WRITEL_LOG_NEGATIVE
  129. #define WRITED_LOG_NEGATIVE
  130. #define WRITEF_LOG_NEGATIVE
  131. #define WRITEL_Y0_ZERO
  132. #define WRITED_Y0_ZERO
  133. #define WRITEF_Y0_ZERO
  134. #define WRITEL_Y0_NEGATIVE
  135. #define WRITED_Y0_NEGATIVE
  136. #define WRITEF_Y0_NEGATIVE
  137. #define WRITEL_Y1_ZERO
  138. #define WRITED_Y1_ZERO
  139. #define WRITEF_Y1_ZERO
  140. #define WRITEL_Y1_NEGATIVE
  141. #define WRITED_Y1_NEGATIUE
  142. #define WRITEF_Y1_NEGATIVE
  143. #define WRITEL_YN_ZERO
  144. #define WRITED_YN_ZERO
  145. #define WRITEF_YN_ZERO
  146. #define WRITEL_YN_NEGATIVE
  147. #define WRITED_YN_NEGATIVE
  148. #define WRITEF_YN_NEGATIVE
  149. #define WRITEL_LOG1P_ZERO
  150. #define WRITED_LOG1P_ZERO
  151. #define WRITEF_LOG1P_ZERO
  152. #define WRITEL_LOG1P_NEGATIVE
  153. #define WRITED_LOG1P_NEGATIVE
  154. #define WRITEF_LOG1P_NEGATIVE
  155. #define WRITEL_LOG10_ZERO
  156. #define WRITED_LOG10_ZERO
  157. #define WRITEF_LOG10_ZERO
  158. #define WRITEL_LOG10_NEGATIVE
  159. #define WRITED_LOG10_NEGATIVE
  160. #define WRITEF_LOG10_NEGATIVE
  161. #define WRITEL_POW_ZERO_TO_ZERO
  162. #define WRITED_POW_ZERO_TO_ZERO
  163. #define WRITEF_POW_ZERO_TO_ZERO
  164. #define WRITEL_POW_ZERO_TO_NEGATIVE
  165. #define WRITED_POW_ZERO_TO_NEGATIVE
  166. #define WRITEF_POW_ZERO_TO_NEGATIVE
  167. #define WRITEL_POW_NEG_TO_NON_INTEGER
  168. #define WRITED_POW_NEG_TO_NON_INTEGER
  169. #define WRITEF_POW_NEG_TO_NON_INTEGER
  170. #define WRITEL_ATAN2_ZERO_BY_ZERO
  171. #define WRITED_ATAN2_ZERO_BY_ZERO
  172. #define WRITEF_ATAN2_ZERO_BY_ZERO
  173. #define WRITEL_SQRT
  174. #define WRITED_SQRT
  175. #define WRITEF_SQRT
  176. #define WRITEL_FMOD
  177. #define WRITED_FMOD
  178. #define WRITEF_FMOD
  179. #define WRITEL_REM
  180. #define WRITED_REM
  181. #define WRITEF_REM
  182. #define WRITEL_ACOS
  183. #define WRITED_ACOS
  184. #define WRITEF_ACOS
  185. #define WRITEL_ASIN
  186. #define WRITED_ASIN
  187. #define WRITEF_ASIN
  188. #define WRITEL_ACOSH
  189. #define WRITED_ACOSH
  190. #define WRITEF_ACOSH
  191. #define WRITEL_ATANH_GT_ONE
  192. #define WRITED_ATANH_GT_ONE
  193. #define WRITEF_ATANH_GT_ONE
  194. #define WRITEL_ATANH_EQ_ONE
  195. #define WRITED_ATANH_EQ_ONE
  196. #define WRITEF_ATANH_EQ_ONE
  197. #define WRITEL_LGAMMA_NEGATIVE
  198. #define WRITED_LGAMMA_NEGATIVE
  199. #define WRITEF_LGAMMA_NEGATIVE
  200. #define WRITEL_GAMMA_NEGATIVE
  201. #define WRITED_GAMMA_NEGATIVE
  202. #define WRITEF_GAMMA_NEGATIVE
  203. #define WRITEL_J0_TLOSS
  204. #define WRITEL_Y0_TLOSS
  205. #define WRITEL_J1_TLOSS
  206. #define WRITEL_Y1_TLOSS
  207. #define WRITEL_JN_TLOSS
  208. #define WRITEL_YN_TLOSS
  209. #define WRITED_J0_TLOSS
  210. #define WRITED_Y0_TLOSS
  211. #define WRITED_J1_TLOSS
  212. #define WRITED_Y1_TLOSS
  213. #define WRITED_JN_TLOSS
  214. #define WRITED_YN_TLOSS
  215. #define WRITEF_J0_TLOSS
  216. #define WRITEF_Y0_TLOSS
  217. #define WRITEF_J1_TLOSS
  218. #define WRITEF_Y1_TLOSS
  219. #define WRITEF_JN_TLOSS
  220. #define WRITEF_YN_TLOSS
  221. #else
  222. #define WRITEL_LOG_ZERO fputs("logl: SING error\n",stderr)
  223. #define WRITED_LOG_ZERO fputs("log: SING error\n",stderr)
  224. #define WRITEF_LOG_ZERO fputs("logf: SING error\n",stderr)
  225. #define WRITEL_LOG_NEGATIVE fputs("logl: DOMAIN error\n",stderr)
  226. #define WRITED_LOG_NEGATIVE fputs("log: DOMAIN error\n",stderr)
  227. #define WRITEF_LOG_NEGATIVE fputs("logf: DOMAIN error\n",stderr)
  228. #define WRITEL_Y0_ZERO fputs("y0l: DOMAIN error\n",stderr)
  229. #define WRITED_Y0_ZERO fputs("y0: DOMAIN error\n",stderr)
  230. #define WRITEF_Y0_ZERO fputs("y0f: DOMAIN error\n",stderr)
  231. #define WRITEL_Y0_NEGATIVE fputs("y0l: DOMAIN error\n",stderr)
  232. #define WRITED_Y0_NEGATIVE fputs("y0: DOMAIN error\n",stderr)
  233. #define WRITEF_Y0_NEGATIVE fputs("y0f: DOMAIN error\n",stderr)
  234. #define WRITEL_Y1_ZERO fputs("y1l: DOMAIN error\n",stderr)
  235. #define WRITED_Y1_ZERO fputs("y1: DOMAIN error\n",stderr)
  236. #define WRITEF_Y1_ZERO fputs("y1f: DOMAIN error\n",stderr)
  237. #define WRITEL_Y1_NEGATIVE fputs("y1l: DOMAIN error\n",stderr)
  238. #define WRITED_Y1_NEGATIUE fputs("y1: DOMAIN error\n",stderr)
  239. #define WRITEF_Y1_NEGATIVE fputs("y1f: DOMAIN error\n",stderr)
  240. #define WRITEL_YN_ZERO fputs("ynl: DOMAIN error\n",stderr)
  241. #define WRITED_YN_ZERO fputs("yn: DOMAIN error\n",stderr)
  242. #define WRITEF_YN_ZERO fputs("ynf: DOMAIN error\n",stderr)
  243. #define WRITEL_YN_NEGATIVE fputs("ynl: DOMAIN error\n",stderr)
  244. #define WRITED_YN_NEGATIVE fputs("yn: DOMAIN error\n",stderr)
  245. #define WRITEF_YN_NEGATIVE fputs("ynf: DOMAIN error\n",stderr)
  246. #define WRITEL_LOG1P_ZERO fputs("log1pl: SING error\n",stderr)
  247. #define WRITED_LOG1P_ZERO fputs("log1p: SING error\n",stderr)
  248. #define WRITEF_LOG1P_ZERO fputs("log1pf: SING error\n",stderr)
  249. #define WRITEL_LOG1P_NEGATIVE fputs("log1pl: DOMAIN error\n",stderr)
  250. #define WRITED_LOG1P_NEGATIVE fputs("log1p: DOMAIN error\n",stderr)
  251. #define WRITEF_LOG1P_NEGATIVE fputs("log1pf: DOMAIN error\n",stderr)
  252. #define WRITEL_LOG10_ZERO fputs("log10l: SING error\n",stderr)
  253. #define WRITED_LOG10_ZERO fputs("log10: SING error\n",stderr)
  254. #define WRITEF_LOG10_ZERO fputs("log10f: SING error\n",stderr)
  255. #define WRITEL_LOG10_NEGATIVE fputs("log10l: DOMAIN error\n",stderr)
  256. #define WRITED_LOG10_NEGATIVE fputs("log10: DOMAIN error\n",stderr)
  257. #define WRITEF_LOG10_NEGATIVE fputs("log10f: DOMAIN error\n",stderr)
  258. #define WRITEL_POW_ZERO_TO_ZERO fputs("powl(0,0): DOMAIN error\n",stderr)
  259. #define WRITED_POW_ZERO_TO_ZERO fputs("pow(0,0): DOMAIN error\n",stderr)
  260. #define WRITEF_POW_ZERO_TO_ZERO fputs("powf(0,0): DOMAIN error\n",stderr)
  261. #define WRITEL_POW_ZERO_TO_NEGATIVE fputs("powl(0,negative): DOMAIN error\n",stderr)
  262. #define WRITED_POW_ZERO_TO_NEGATIVE fputs("pow(0,negative): DOMAIN error\n",stderr)
  263. #define WRITEF_POW_ZERO_TO_NEGATIVE fputs("powf(0,negative): DOMAIN error\n",stderr)
  264. #define WRITEL_POW_NEG_TO_NON_INTEGER fputs("powl(negative,non-integer): DOMAIN error\n",stderr)
  265. #define WRITED_POW_NEG_TO_NON_INTEGER fputs("pow(negative,non-integer): DOMAIN error\n",stderr)
  266. #define WRITEF_POW_NEG_TO_NON_INTEGER fputs("powf(negative,non-integer): DOMAIN error\n",stderr)
  267. #define WRITEL_ATAN2_ZERO_BY_ZERO fputs("atan2l: DOMAIN error\n",stderr)
  268. #define WRITED_ATAN2_ZERO_BY_ZERO fputs("atan2: DOMAIN error\n",stderr)
  269. #define WRITEF_ATAN2_ZERO_BY_ZERO fputs("atan2f: DOMAIN error\n",stderr)
  270. #define WRITEL_SQRT fputs("sqrtl: DOMAIN error\n",stderr)
  271. #define WRITED_SQRT fputs("sqrt: DOMAIN error\n",stderr)
  272. #define WRITEF_SQRT fputs("sqrtf: DOMAIN error\n",stderr)
  273. #define WRITEL_FMOD fputs("fmodl: DOMAIN error\n",stderr)
  274. #define WRITED_FMOD fputs("fmod: DOMAIN error\n",stderr)
  275. #define WRITEF_FMOD fputs("fmodf: DOMAIN error\n",stderr)
  276. #define WRITEL_REM fputs("remainderl: DOMAIN error\n",stderr)
  277. #define WRITED_REM fputs("remainder: DOMAIN error\n",stderr)
  278. #define WRITEF_REM fputs("remainderf: DOMAIN error\n",stderr)
  279. #define WRITEL_ACOS fputs("acosl: DOMAIN error\n",stderr)
  280. #define WRITED_ACOS fputs("acos: DOMAIN error\n",stderr)
  281. #define WRITEF_ACOS fputs("acosf: DOMAIN error\n",stderr)
  282. #define WRITEL_ASIN fputs("asinl: DOMAIN error\n",stderr)
  283. #define WRITED_ASIN fputs("asin: DOMAIN error\n",stderr)
  284. #define WRITEF_ASIN fputs("asinf: DOMAIN error\n",stderr)
  285. #define WRITEL_ACOSH fputs("acoshl: DOMAIN error\n",stderr)
  286. #define WRITED_ACOSH fputs("acosh: DOMAIN error\n",stderr)
  287. #define WRITEF_ACOSH fputs("acoshf: DOMAIN error\n",stderr)
  288. #define WRITEL_ATANH_GT_ONE fputs("atanhl: DOMAIN error\n",stderr)
  289. #define WRITED_ATANH_GT_ONE fputs("atanh: DOMAIN error\n",stderr)
  290. #define WRITEF_ATANH_GT_ONE fputs("atanhf: DOMAIN error\n",stderr)
  291. #define WRITEL_ATANH_EQ_ONE fputs("atanhl: SING error\n",stderr)
  292. #define WRITED_ATANH_EQ_ONE fputs("atanh: SING error\n",stderr)
  293. #define WRITEF_ATANH_EQ_ONE fputs("atanhf: SING error\n",stderr)
  294. #define WRITEL_LGAMMA_NEGATIVE fputs("lgammal: SING error\n",stderr)
  295. #define WRITED_LGAMMA_NEGATIVE fputs("lgamma: SING error\n",stderr)
  296. #define WRITEF_LGAMMA_NEGATIVE fputs("lgammaf: SING error\n",stderr)
  297. #define WRITEL_GAMMA_NEGATIVE fputs("gammal: SING error\n",stderr)
  298. #define WRITED_GAMMA_NEGATIVE fputs("gamma: SING error\n",stderr)
  299. #define WRITEF_GAMMA_NEGATIVE fputs("gammaf: SING error\n",stderr)
  300. #define WRITEL_J0_TLOSS fputs("j0l: TLOSS error\n",stderr)
  301. #define WRITEL_Y0_TLOSS fputs("y0l: TLOSS error\n",stderr)
  302. #define WRITEL_J1_TLOSS fputs("j1l: TLOSS error\n",stderr)
  303. #define WRITEL_Y1_TLOSS fputs("y1l: TLOSS error\n",stderr)
  304. #define WRITEL_JN_TLOSS fputs("jnl: TLOSS error\n",stderr)
  305. #define WRITEL_YN_TLOSS fputs("ynl: TLOSS error\n",stderr)
  306. #define WRITED_J0_TLOSS fputs("j0: TLOSS error\n",stderr)
  307. #define WRITED_Y0_TLOSS fputs("y0: TLOSS error\n",stderr)
  308. #define WRITED_J1_TLOSS fputs("j1: TLOSS error\n",stderr)
  309. #define WRITED_Y1_TLOSS fputs("y1: TLOSS error\n",stderr)
  310. #define WRITED_JN_TLOSS fputs("jn: TLOSS error\n",stderr)
  311. #define WRITED_YN_TLOSS fputs("yn: TLOSS error\n",stderr)
  312. #define WRITEF_J0_TLOSS fputs("j0f: TLOSS error\n",stderr)
  313. #define WRITEF_Y0_TLOSS fputs("y0f: TLOSS error\n",stderr)
  314. #define WRITEF_J1_TLOSS fputs("j1f: TLOSS error\n",stderr)
  315. #define WRITEF_Y1_TLOSS fputs("y1f: TLOSS error\n",stderr)
  316. #define WRITEF_JN_TLOSS fputs("jnf: TLOSS error\n",stderr)
  317. #define WRITEF_YN_TLOSS fputs("ynf: TLOSS error\n",stderr)
  318. #endif
  319. /***********************/
  320. /* IEEE Path */
  321. /***********************/
  322. if(_LIB_VERSION==_IEEE_) return;
  323. /***********************/
  324. /* C9X Path */
  325. /***********************/
  326. else if(_LIB_VERSION==_ISOC_)
  327. {
  328. switch(input_tag)
  329. {
  330. case log_zero:
  331. case logf_zero:
  332. case log10_zero:
  333. case log10f_zero:
  334. case exp_overflow:
  335. case expf_overflow:
  336. case expm1_overflow:
  337. case expm1f_overflow:
  338. case hypot_overflow:
  339. case hypotf_overflow:
  340. case sinh_overflow:
  341. case sinhf_overflow:
  342. case atanh_eq_one:
  343. case atanhf_eq_one:
  344. case scalb_overflow:
  345. case scalbf_overflow:
  346. case cosh_overflow:
  347. case coshf_overflow:
  348. case nextafter_overflow:
  349. case nextafterf_overflow:
  350. case ldexp_overflow:
  351. case ldexpf_overflow:
  352. case lgamma_overflow:
  353. case lgammaf_overflow:
  354. case lgamma_negative:
  355. case lgammaf_negative:
  356. case gamma_overflow:
  357. case gammaf_overflow:
  358. case gamma_negative:
  359. case gammaf_negative:
  360. {
  361. ERRNO_RANGE; break;
  362. }
  363. case log_negative:
  364. case logf_negative:
  365. case log10_negative:
  366. case log10f_negative:
  367. case log1p_negative:
  368. case log1pf_negative:
  369. case sqrt_negative:
  370. case sqrtf_negative:
  371. case atan2_zero:
  372. case atan2f_zero:
  373. case powl_zero_to_negative:
  374. case powl_neg_to_non_integer:
  375. case pow_zero_to_negative:
  376. case pow_neg_to_non_integer:
  377. case powf_zero_to_negative:
  378. case powf_neg_to_non_integer:
  379. case fmod_by_zero:
  380. case fmodf_by_zero:
  381. case atanh_gt_one:
  382. case atanhf_gt_one:
  383. case acos_gt_one:
  384. case acosf_gt_one:
  385. case asin_gt_one:
  386. case asinf_gt_one:
  387. case logb_zero:
  388. case logbf_zero:
  389. case acosh_lt_one:
  390. case acoshf_lt_one:
  391. case y0l_zero:
  392. case y0_zero:
  393. case y0f_zero:
  394. case y1l_zero:
  395. case y1_zero:
  396. case y1f_zero:
  397. case ynl_zero:
  398. case yn_zero:
  399. case ynf_zero:
  400. case y0_negative:
  401. case y0f_negative:
  402. case y1_negative:
  403. case y1f_negative:
  404. case yn_negative:
  405. case ynf_negative:
  406. {
  407. ERRNO_DOMAIN; break;
  408. }
  409. }
  410. return;
  411. }
  412. /***********************/
  413. /* _POSIX_ Path */
  414. /***********************/
  415. else if(_LIB_VERSION==__POSIX__)
  416. {
  417. switch(input_tag)
  418. {
  419. case gamma_overflow:
  420. case lgamma_overflow:
  421. {
  422. RETVAL_HUGE_VALD; ERRNO_RANGE; break;
  423. }
  424. case gammaf_overflow:
  425. case lgammaf_overflow:
  426. {
  427. RETVAL_HUGE_VALF; ERRNO_RANGE; break;
  428. }
  429. case gamma_negative:
  430. case gammaf_negative:
  431. case lgamma_negative:
  432. case lgammaf_negative:
  433. {
  434. ERRNO_DOMAIN; break;
  435. }
  436. case ldexp_overflow:
  437. case ldexp_underflow:
  438. case ldexpf_overflow:
  439. case ldexpf_underflow:
  440. {
  441. ERRNO_RANGE; break;
  442. }
  443. case atanh_gt_one:
  444. case atanh_eq_one:
  445. /* atanh(|x| >= 1) */
  446. {
  447. ERRNO_DOMAIN; break;
  448. }
  449. case atanhf_gt_one:
  450. case atanhf_eq_one:
  451. /* atanhf(|x| >= 1) */
  452. {
  453. ERRNO_DOMAIN; break;
  454. }
  455. case sqrt_negative:
  456. /* sqrt(x < 0) */
  457. {
  458. ERRNO_DOMAIN; break;
  459. }
  460. case sqrtf_negative:
  461. /* sqrtf(x < 0) */
  462. {
  463. ERRNO_DOMAIN; break;
  464. }
  465. case y0_zero:
  466. case y1_zero:
  467. case yn_zero:
  468. /* y0(0) */
  469. /* y1(0) */
  470. /* yn(0) */
  471. {
  472. RETVAL_NEG_HUGE_VALD; ERRNO_DOMAIN; break;
  473. }
  474. case y0f_zero:
  475. case y1f_zero:
  476. case ynf_zero:
  477. /* y0f(0) */
  478. /* y1f(0) */
  479. /* ynf(0) */
  480. {
  481. RETVAL_NEG_HUGE_VALF; ERRNO_DOMAIN; break;
  482. }
  483. case y0_negative:
  484. case y1_negative:
  485. case yn_negative:
  486. /* y0(x < 0) */
  487. /* y1(x < 0) */
  488. /* yn(x < 0) */
  489. {
  490. RETVAL_NEG_HUGE_VALD; ERRNO_DOMAIN; break;
  491. }
  492. case y0f_negative:
  493. case y1f_negative:
  494. case ynf_negative:
  495. /* y0f(x < 0) */
  496. /* y1f(x < 0) */
  497. /* ynf(x < 0) */
  498. {
  499. RETVAL_NEG_HUGE_VALF; ERRNO_DOMAIN; break;
  500. }
  501. case log_zero:
  502. case log1p_zero:
  503. case log10_zero:
  504. /* log(0) */
  505. /* log1p(0) */
  506. /* log10(0) */
  507. {
  508. RETVAL_NEG_HUGE_VALD; ERRNO_RANGE; break;
  509. }
  510. case logf_zero:
  511. case log1pf_zero:
  512. case log10f_zero:
  513. /* logf(0) */
  514. /* log1pf(0) */
  515. /* log10f(0) */
  516. {
  517. RETVAL_NEG_HUGE_VALF; ERRNO_RANGE; break;
  518. }
  519. case log_negative:
  520. case log1p_negative:
  521. case log10_negative:
  522. /* log(x < 0) */
  523. /* log1p(x < 0) */
  524. /* log10(x < 0) */
  525. {
  526. RETVAL_NEG_HUGE_VALD; ERRNO_DOMAIN; break;
  527. }
  528. case logf_negative:
  529. case log1pf_negative:
  530. case log10f_negative:
  531. /* logf(x < 0) */
  532. /* log1pf(x < 0) */
  533. /* log10f(x < 0) */
  534. {
  535. RETVAL_NEG_HUGE_VALF; ERRNO_DOMAIN; break;
  536. }
  537. case exp_overflow:
  538. /* exp overflow */
  539. {
  540. RETVAL_HUGE_VALD; ERRNO_RANGE; break;
  541. }
  542. case expf_overflow:
  543. /* expf overflow */
  544. {
  545. RETVAL_HUGE_VALF; ERRNO_RANGE; break;
  546. }
  547. case exp_underflow:
  548. /* exp underflow */
  549. {
  550. RETVAL_ZEROD; ERRNO_RANGE; break;
  551. }
  552. case expf_underflow:
  553. /* expf underflow */
  554. {
  555. RETVAL_ZEROF; ERRNO_RANGE; break;
  556. }
  557. case j0_gt_loss:
  558. case y0_gt_loss:
  559. case j1_gt_loss:
  560. case y1_gt_loss:
  561. case jn_gt_loss:
  562. case yn_gt_loss:
  563. /* jn and yn double > XLOSS */
  564. {
  565. RETVAL_ZEROD; ERRNO_RANGE; break;
  566. }
  567. case j0f_gt_loss:
  568. case y0f_gt_loss:
  569. case j1f_gt_loss:
  570. case y1f_gt_loss:
  571. case jnf_gt_loss:
  572. case ynf_gt_loss:
  573. /* j0n and y0n > XLOSS */
  574. {
  575. RETVAL_ZEROF; ERRNO_RANGE; break;
  576. }
  577. case pow_zero_to_zero:
  578. /* pow 0**0 */
  579. {
  580. break;
  581. }
  582. case powf_zero_to_zero:
  583. /* powf 0**0 */
  584. {
  585. break;
  586. }
  587. case pow_overflow:
  588. /* pow(x,y) overflow */
  589. {
  590. if (INPUT_RESD < 0) RETVAL_NEG_HUGE_VALD;
  591. else RETVAL_HUGE_VALD;
  592. ERRNO_RANGE; break;
  593. }
  594. case powf_overflow:
  595. /* powf(x,y) overflow */
  596. {
  597. if (INPUT_RESF < 0) RETVAL_NEG_HUGE_VALF;
  598. else RETVAL_HUGE_VALF;
  599. ERRNO_RANGE; break;
  600. }
  601. case pow_underflow:
  602. /* pow(x,y) underflow */
  603. {
  604. RETVAL_ZEROD; ERRNO_RANGE; break;
  605. }
  606. case powf_underflow:
  607. /* powf(x,y) underflow */
  608. {
  609. RETVAL_ZEROF; ERRNO_RANGE; break;
  610. }
  611. case pow_zero_to_negative:
  612. /* 0**neg */
  613. {
  614. ERRNO_DOMAIN; break;
  615. }
  616. case powf_zero_to_negative:
  617. /* 0**neg */
  618. {
  619. ERRNO_DOMAIN; break;
  620. }
  621. case pow_neg_to_non_integer:
  622. /* neg**non_integral */
  623. {
  624. ERRNO_DOMAIN; break;
  625. }
  626. case powf_neg_to_non_integer:
  627. /* neg**non-integral */
  628. {
  629. ERRNO_DOMAIN; break;
  630. }
  631. case pow_nan_to_zero:
  632. /* pow(NaN,0.0) */
  633. {
  634. break;
  635. }
  636. case powf_nan_to_zero:
  637. /* powf(NaN,0.0) */
  638. {
  639. break;
  640. }
  641. case atan2_zero:
  642. /* atan2(0,0) */
  643. {
  644. RETVAL_ZEROD; ERRNO_DOMAIN; break;
  645. }
  646. case
  647. atan2f_zero:
  648. /* atan2f(0,0) */
  649. {
  650. RETVAL_ZEROF; ERRNO_DOMAIN; break;
  651. }
  652. case expm1_overflow:
  653. /* expm1 overflow */
  654. {
  655. ERRNO_RANGE; break;
  656. }
  657. case expm1f_overflow:
  658. /* expm1f overflow */
  659. {
  660. ERRNO_RANGE; break;
  661. }
  662. case expm1_underflow:
  663. /* expm1 underflow */
  664. {
  665. ERRNO_RANGE; break;
  666. }
  667. case expm1f_underflow:
  668. /* expm1f underflow */
  669. {
  670. ERRNO_RANGE; break;
  671. }
  672. case hypot_overflow:
  673. /* hypot overflow */
  674. {
  675. RETVAL_HUGE_VALD; ERRNO_RANGE; break;
  676. }
  677. case hypotf_overflow:
  678. /* hypotf overflow */
  679. {
  680. RETVAL_HUGE_VALF; ERRNO_RANGE; break;
  681. }
  682. case scalb_underflow:
  683. /* scalb underflow */
  684. {
  685. if (INPUT_XD < 0) RETVAL_NEG_ZEROD;
  686. else RETVAL_ZEROD;
  687. ERRNO_RANGE; break;
  688. }
  689. case scalbf_underflow:
  690. /* scalbf underflow */
  691. {
  692. if (INPUT_XF < 0) RETVAL_NEG_ZEROF;
  693. else RETVAL_ZEROF;
  694. ERRNO_RANGE; break;
  695. }
  696. case scalb_overflow:
  697. /* scalb overflow */
  698. {
  699. if (INPUT_XD < 0) RETVAL_NEG_HUGE_VALD;
  700. else RETVAL_HUGE_VALD;
  701. ERRNO_RANGE; break;
  702. }
  703. case scalbf_overflow:
  704. /* scalbf overflow */
  705. {
  706. if (INPUT_XF < 0) RETVAL_NEG_HUGE_VALF;
  707. else RETVAL_HUGE_VALF;
  708. ERRNO_RANGE; break;
  709. }
  710. case acosh_lt_one:
  711. /* acosh(x < 1) */
  712. {
  713. ERRNO_DOMAIN; break;
  714. }
  715. case acoshf_lt_one:
  716. /* acoshf(x < 1) */
  717. {
  718. ERRNO_DOMAIN; break;
  719. }
  720. case acos_gt_one:
  721. /* acos(x > 1) */
  722. {
  723. RETVAL_ZEROD;ERRNO_DOMAIN; break;
  724. }
  725. case acosf_gt_one:
  726. /* acosf(x > 1) */
  727. {
  728. RETVAL_ZEROF;ERRNO_DOMAIN; break;
  729. }
  730. case asin_gt_one:
  731. /* asin(x > 1) */
  732. {
  733. RETVAL_ZEROD; ERRNO_DOMAIN; break;
  734. }
  735. case asinf_gt_one:
  736. /* asinf(x > 1) */
  737. {
  738. RETVAL_ZEROF; ERRNO_DOMAIN; break;
  739. }
  740. case remainder_by_zero:
  741. case fmod_by_zero:
  742. /* fmod(x,0) */
  743. {
  744. ERRNO_DOMAIN; break;
  745. }
  746. case remainderf_by_zero:
  747. case fmodf_by_zero:
  748. /* fmodf(x,0) */
  749. {
  750. ERRNO_DOMAIN; break;
  751. }
  752. case cosh_overflow:
  753. /* cosh overflows */
  754. {
  755. RETVAL_HUGE_VALD; ERRNO_RANGE; break;
  756. }
  757. case coshf_overflow:
  758. /* coshf overflows */
  759. {
  760. RETVAL_HUGE_VALF; ERRNO_RANGE; break;
  761. }
  762. case sinh_overflow:
  763. /* sinh overflows */
  764. {
  765. if (INPUT_XD > 0) RETVAL_HUGE_VALD;
  766. else RETVAL_NEG_HUGE_VALD;
  767. ERRNO_RANGE; break;
  768. }
  769. case sinhf_overflow:
  770. /* sinhf overflows */
  771. {
  772. if (INPUT_XF > 0) RETVAL_HUGE_VALF;
  773. else RETVAL_NEG_HUGE_VALF;
  774. ERRNO_RANGE; break;
  775. }
  776. case logb_zero:
  777. /* logb(0) */
  778. {
  779. ERRNO_DOMAIN; break;
  780. }
  781. case logbf_zero:
  782. /* logbf(0) */
  783. {
  784. ERRNO_DOMAIN; break;
  785. }
  786. }
  787. return;
  788. /* _POSIX_ */
  789. }
  790. /***************************************/
  791. /* __SVID__, __MS__ and __XOPEN__ Path */
  792. /***************************************/
  793. else
  794. {
  795. switch(input_tag)
  796. {
  797. case ldexp_overflow:
  798. case ldexp_underflow:
  799. case ldexpf_overflow:
  800. case ldexpf_underflow:
  801. {
  802. ERRNO_RANGE; break;
  803. }
  804. case sqrt_negative:
  805. /* sqrt(x < 0) */
  806. {
  807. DOMAIND; NAMED = "sqrt";
  808. ifSVID
  809. {
  810. RETVAL_ZEROD;
  811. NOT_MATHERRD
  812. {
  813. WRITED_SQRT;
  814. ERRNO_DOMAIN;
  815. }
  816. }
  817. else
  818. { /* NaN already computed */
  819. NOT_MATHERRD {ERRNO_DOMAIN;}
  820. }
  821. *(double *)retval = exc.retval;
  822. break;
  823. }
  824. case sqrtf_negative:
  825. /* sqrtf(x < 0) */
  826. {
  827. DOMAINF; NAMEF = "sqrtf";
  828. ifSVID
  829. {
  830. RETVAL_ZEROF;
  831. NOT_MATHERRF
  832. {
  833. WRITEF_SQRT;
  834. ERRNO_DOMAIN;
  835. }
  836. }
  837. else
  838. {
  839. NOT_MATHERRF {ERRNO_DOMAIN;}
  840. }
  841. #ifdef __MS__
  842. *(float *)retval = (float) excf.retval;
  843. #elif
  844. *(float *)retval = excf.retval;
  845. #endif
  846. break;
  847. }
  848. case log_zero:
  849. /* log(0) */
  850. {
  851. SINGD; NAMED="log";
  852. ifSVID
  853. {
  854. RETVAL_NEG_HUGED;
  855. NOT_MATHERRD
  856. {
  857. WRITED_LOG_ZERO;
  858. ERRNO_DOMAIN;
  859. }
  860. }
  861. else
  862. {
  863. RETVAL_NEG_HUGE_VALD;
  864. NOT_MATHERRD {ERRNO_DOMAIN;}
  865. }
  866. *(double *)retval = exc.retval;
  867. break;
  868. }
  869. case logf_zero:
  870. /* logf(0) */
  871. {
  872. SINGF; NAMEF="logf";
  873. ifSVID
  874. {
  875. RETVAL_NEG_HUGEF;
  876. NOT_MATHERRF
  877. {
  878. WRITEF_LOG_ZERO;
  879. ERRNO_DOMAIN;
  880. }
  881. }
  882. else
  883. {
  884. RETVAL_NEG_HUGE_VALF;
  885. NOT_MATHERRF {ERRNO_DOMAIN;}
  886. }
  887. #ifdef __MS__
  888. *(float *)retval = (float) excf.retval;
  889. #elif
  890. *(float *)retval = excf.retval;
  891. #endif
  892. break;
  893. }
  894. case log_negative:
  895. /* log(x < 0) */
  896. {
  897. DOMAIND; NAMED="log";
  898. ifSVID
  899. {
  900. RETVAL_NEG_HUGED;
  901. NOT_MATHERRD
  902. {
  903. WRITED_LOG_NEGATIVE;
  904. ERRNO_DOMAIN;
  905. }
  906. }
  907. else
  908. {
  909. #ifndef __MS__
  910. RETVAL_NEG_HUGE_VALD;
  911. #endif
  912. NOT_MATHERRD {ERRNO_DOMAIN;}
  913. }
  914. *(double *)retval = exc.retval;
  915. break;
  916. }
  917. case logf_negative:
  918. /* logf(x < 0) */
  919. {
  920. DOMAINF; NAMEF="logf";
  921. ifSVID
  922. {
  923. RETVAL_NEG_HUGEF;
  924. NOT_MATHERRF
  925. {
  926. WRITEF_LOG_NEGATIVE;
  927. ERRNO_DOMAIN;
  928. }
  929. }
  930. else
  931. {
  932. #ifndef __MS__
  933. RETVAL_NEG_HUGE_VALF;
  934. #endif
  935. NOT_MATHERRF{ERRNO_DOMAIN;}
  936. }
  937. #ifdef __MS__
  938. *(float *)retval = (float) excf.retval;
  939. #elif
  940. *(float *)retval = excf.retval;
  941. #endif
  942. break;
  943. }
  944. case log1p_zero:
  945. /* log1p(-1) */
  946. {
  947. SINGD; NAMED="log1p";
  948. ifSVID
  949. {
  950. RETVAL_NEG_HUGED;
  951. NOT_MATHERRD
  952. {
  953. WRITED_LOG1P_ZERO;
  954. ERRNO_DOMAIN;
  955. }
  956. }
  957. else
  958. {
  959. RETVAL_NEG_HUGE_VALD;
  960. NOT_MATHERRD {ERRNO_DOMAIN;}
  961. }
  962. *(double *)retval = exc.retval;
  963. break;
  964. }
  965. case log1pf_zero:
  966. /* log1pf(-1) */
  967. {
  968. SINGF; NAMEF="log1pf";
  969. ifSVID
  970. {
  971. RETVAL_NEG_HUGEF;
  972. NOT_MATHERRF
  973. {
  974. WRITEF_LOG1P_ZERO;
  975. ERRNO_DOMAIN;
  976. }
  977. }
  978. else
  979. {
  980. RETVAL_NEG_HUGE_VALF;
  981. NOT_MATHERRF {}ERRNO_DOMAIN;
  982. }
  983. #ifdef __MS__
  984. *(float *)retval = (float) excf.retval;
  985. #elif
  986. *(float *)retval = excf.retval;
  987. #endif
  988. break;
  989. }
  990. case log1p_negative:
  991. /* log1p(x < -1) */
  992. {
  993. DOMAIND; NAMED="log1p";
  994. ifSVID
  995. {
  996. RETVAL_NEG_HUGED;
  997. NOT_MATHERRD
  998. {
  999. WRITED_LOG1P_NEGATIVE;
  1000. ERRNO_DOMAIN;
  1001. }
  1002. }
  1003. else
  1004. {
  1005. #ifndef __MS__
  1006. RETVAL_NEG_HUGE_VALD;
  1007. #endif
  1008. NOT_MATHERRD {ERRNO_DOMAIN;}
  1009. }
  1010. *(double *)retval = exc.retval;
  1011. break;
  1012. }
  1013. case log1pf_negative:
  1014. /* log1pf(x < -1) */
  1015. {
  1016. DOMAINF; NAMEF="log1pf";
  1017. ifSVID
  1018. {
  1019. RETVAL_NEG_HUGEF;
  1020. NOT_MATHERRF
  1021. {
  1022. WRITEF_LOG1P_NEGATIVE;
  1023. ERRNO_DOMAIN;
  1024. }
  1025. }
  1026. else
  1027. {
  1028. #ifndef __MS__
  1029. RETVAL_NEG_HUGE_VALF;
  1030. #endif
  1031. NOT_MATHERRF {ERRNO_DOMAIN;}
  1032. }
  1033. #ifdef __MS__
  1034. *(float *)retval = (float) excf.retval;
  1035. #elif
  1036. *(float *)retval = excf.retval;
  1037. #endif
  1038. break;
  1039. }
  1040. case log10_zero:
  1041. /* log10(0) */
  1042. {
  1043. SINGD; NAMED="log10";
  1044. ifSVID
  1045. {
  1046. RETVAL_NEG_HUGED;
  1047. NOT_MATHERRD
  1048. {
  1049. WRITED_LOG10_ZERO;
  1050. ERRNO_RANGE;
  1051. }
  1052. }
  1053. else
  1054. {
  1055. RETVAL_NEG_HUGE_VALD;
  1056. NOT_MATHERRD {ERRNO_DOMAIN;}
  1057. }
  1058. *(double *)retval = exc.retval;
  1059. break;
  1060. }
  1061. case log10f_zero:
  1062. /* log10f(0) */
  1063. {
  1064. SINGF; NAMEF="log10f";
  1065. ifSVID
  1066. {
  1067. RETVAL_NEG_HUGEF;
  1068. NOT_MATHERRF
  1069. {
  1070. WRITEF_LOG10_ZERO;
  1071. ERRNO_RANGE;
  1072. }
  1073. }
  1074. else
  1075. {
  1076. RETVAL_NEG_HUGE_VALF;
  1077. NOT_MATHERRF {ERRNO_DOMAIN;}
  1078. }
  1079. #ifdef __MS__
  1080. *(float *)retval = (float) excf.retval;
  1081. #elif
  1082. *(float *)retval = excf.retval;
  1083. #endif
  1084. break;
  1085. }
  1086. case log10_negative:
  1087. /* log10(x < 0) */
  1088. {
  1089. DOMAIND; NAMED="log10";
  1090. ifSVID
  1091. {
  1092. RETVAL_NEG_HUGED;
  1093. NOT_MATHERRD
  1094. {
  1095. WRITED_LOG10_NEGATIVE;
  1096. ERRNO_DOMAIN;
  1097. }
  1098. }
  1099. else
  1100. {
  1101. #ifndef __MS__
  1102. RETVAL_NEG_HUGE_VALD;
  1103. #endif
  1104. NOT_MATHERRD {ERRNO_DOMAIN;}
  1105. }
  1106. *(double *)retval = exc.retval;
  1107. break;
  1108. }
  1109. case log10f_negative:
  1110. /* log10f(x < 0) */
  1111. {
  1112. DOMAINF; NAMEF="log10f";
  1113. ifSVID
  1114. {
  1115. RETVAL_NEG_HUGEF;
  1116. NOT_MATHERRF
  1117. {
  1118. WRITEF_LOG10_NEGATIVE;
  1119. ERRNO_DOMAIN;
  1120. }
  1121. }
  1122. else
  1123. {
  1124. #ifndef __MS__
  1125. RETVAL_NEG_HUGE_VALF;
  1126. #endif
  1127. NOT_MATHERRF {ERRNO_DOMAIN;}
  1128. }
  1129. #ifdef __MS__
  1130. *(float *)retval = (float) excf.retval;
  1131. #elif
  1132. *(float *)retval = excf.retval;
  1133. #endif
  1134. break;
  1135. }
  1136. case exp_overflow:
  1137. /* exp overflow */
  1138. {
  1139. OVERFLOWD; NAMED="exp";
  1140. ifSVID
  1141. {
  1142. RETVAL_HUGED;
  1143. }
  1144. else
  1145. {
  1146. RETVAL_HUGE_VALD;
  1147. }
  1148. NOT_MATHERRD {ERRNO_RANGE;}
  1149. *(double *)retval = exc.retval;
  1150. break;
  1151. }
  1152. case expf_overflow:
  1153. /* expf overflow */
  1154. {
  1155. OVERFLOWF; NAMEF="expf";
  1156. ifSVID
  1157. {
  1158. RETVAL_HUGEF;
  1159. }
  1160. else
  1161. {
  1162. RETVAL_HUGE_VALF;
  1163. }
  1164. NOT_MATHERRF {ERRNO_RANGE;}
  1165. #ifdef __MS__
  1166. *(float *)retval = (float) excf.retval;
  1167. #elif
  1168. *(float *)retval = excf.retval;
  1169. #endif
  1170. break;
  1171. }
  1172. case exp_underflow:
  1173. /* exp underflow */
  1174. {
  1175. UNDERFLOWD; NAMED="exp"; RETVAL_ZEROD;
  1176. NOT_MATHERRD {ERRNO_RANGE;}
  1177. *(double *)retval = exc.retval;
  1178. break;
  1179. }
  1180. case expf_underflow:
  1181. /* expf underflow */
  1182. {
  1183. UNDERFLOWF; NAMEF="expf"; RETVAL_ZEROF;
  1184. NOT_MATHERRF {ERRNO_RANGE;}
  1185. #ifdef __MS__
  1186. *(float *)retval = (float) excf.retval;
  1187. #elif
  1188. *(float *)retval = excf.retval;
  1189. #endif
  1190. break;
  1191. }
  1192. case pow_zero_to_zero:
  1193. /* pow 0**0 */
  1194. {
  1195. DOMAIND; NAMED="pow";
  1196. ifSVID
  1197. {
  1198. RETVAL_ZEROD;
  1199. NOT_MATHERRD
  1200. {
  1201. WRITED_POW_ZERO_TO_ZERO;
  1202. ERRNO_RANGE;
  1203. }
  1204. *(double *)retval = exc.retval;
  1205. }
  1206. else RETVAL_ONED;
  1207. break;
  1208. }
  1209. case powf_zero_to_zero:
  1210. /* powf 0**0 */
  1211. {
  1212. DOMAINF; NAMEF="powf";
  1213. ifSVID
  1214. {
  1215. RETVAL_ZEROF;
  1216. NOT_MATHERRF
  1217. {
  1218. WRITEF_POW_ZERO_TO_ZERO;
  1219. ERRNO_RANGE;
  1220. }
  1221. #ifdef __MS__
  1222. *(float *)retval = (float) excf.retval;
  1223. #elif
  1224. *(float *)retval = excf.retval;
  1225. #endif
  1226. }
  1227. else RETVAL_ONEF;
  1228. break;
  1229. }
  1230. case pow_overflow:
  1231. /* pow(x,y) overflow */
  1232. {
  1233. OVERFLOWD; NAMED = "pow";
  1234. ifSVID
  1235. {
  1236. if (INPUT_XD < 0) RETVAL_NEG_HUGED;
  1237. else RETVAL_HUGED;
  1238. }
  1239. else
  1240. {
  1241. if (INPUT_XD < 0) RETVAL_NEG_HUGE_VALD;
  1242. else RETVAL_HUGE_VALD;
  1243. }
  1244. NOT_MATHERRD {ERRNO_RANGE;}
  1245. *(double *)retval = exc.retval;
  1246. break;
  1247. }
  1248. case powf_overflow:
  1249. /* powf(x,y) overflow */
  1250. {
  1251. OVERFLOWF; NAMEF = "powf";
  1252. ifSVID
  1253. {
  1254. if (INPUT_XF < 0) RETVAL_NEG_HUGEF;
  1255. else RETVAL_HUGEF;
  1256. }
  1257. else
  1258. {
  1259. if (INPUT_XF < 0) RETVAL_NEG_HUGE_VALF;
  1260. else RETVAL_HUGE_VALF;
  1261. }
  1262. NOT_MATHERRF {ERRNO_RANGE;}
  1263. #ifdef __MS__
  1264. *(float *)retval = (float) excf.retval;
  1265. #elif
  1266. *(float *)retval = excf.retval;
  1267. #endif
  1268. break;
  1269. }
  1270. case pow_underflow:
  1271. /* pow(x,y) underflow */
  1272. {
  1273. UNDERFLOWD; NAMED = "pow"; RETVAL_ZEROD;
  1274. NOT_MATHERRD {ERRNO_RANGE;}
  1275. *(double *)retval = exc.retval;
  1276. break;
  1277. }
  1278. case powf_underflow:
  1279. /* powf(x,y) underflow */
  1280. {
  1281. UNDERFLOWF; NAMEF = "powf"; RETVAL_ZEROF;
  1282. NOT_MATHERRF {ERRNO_RANGE;}
  1283. #ifdef __MS__
  1284. *(float *)retval = (float) excf.retval;
  1285. #elif
  1286. *(float *)retval = excf.retval;
  1287. #endif
  1288. break;
  1289. }
  1290. case pow_zero_to_negative:
  1291. /* 0**neg */
  1292. {
  1293. DOMAIND; NAMED = "pow";
  1294. ifSVID
  1295. {
  1296. RETVAL_ZEROD;
  1297. NOT_MATHERRD
  1298. {
  1299. WRITED_POW_ZERO_TO_NEGATIVE;
  1300. ERRNO_DOMAIN;
  1301. }
  1302. }
  1303. else
  1304. {
  1305. #ifndef __MS__
  1306. RETVAL_NEG_HUGE_VALD;
  1307. #endif
  1308. NOT_MATHERRD {ERRNO_DOMAIN;}
  1309. }
  1310. *(double *)retval = exc.retval;
  1311. break;
  1312. }
  1313. case powf_zero_to_negative:
  1314. /* 0**neg */
  1315. {
  1316. DOMAINF; NAMEF = "powf";
  1317. RETVAL_NEG_HUGE_VALF;
  1318. ifSVID
  1319. {
  1320. RETVAL_ZEROF;
  1321. NOT_MATHERRF
  1322. {
  1323. WRITEF_POW_ZERO_TO_NEGATIVE;
  1324. ERRNO_DOMAIN;
  1325. }
  1326. }
  1327. else
  1328. {
  1329. #ifndef __MS__
  1330. RETVAL_NEG_HUGE_VALF;
  1331. #endif
  1332. NOT_MATHERRF {ERRNO_DOMAIN;}
  1333. }
  1334. #ifdef __MS__
  1335. *(float *)retval = (float) excf.retval;
  1336. #elif
  1337. *(float *)retval = excf.retval;
  1338. #endif
  1339. break;
  1340. }
  1341. case pow_neg_to_non_integer:
  1342. /* neg**non_integral */
  1343. {
  1344. DOMAIND; NAMED = "pow";
  1345. ifSVID
  1346. {
  1347. RETVAL_ZEROD;
  1348. NOT_MATHERRD
  1349. {
  1350. WRITED_POW_NEG_TO_NON_INTEGER;
  1351. ERRNO_DOMAIN;
  1352. }
  1353. }
  1354. else
  1355. {
  1356. NOT_MATHERRD {ERRNO_DOMAIN;}
  1357. }
  1358. *(double *)retval = exc.retval;
  1359. break;
  1360. }
  1361. case powf_neg_to_non_integer:
  1362. /* neg**non-integral */
  1363. {
  1364. DOMAINF; NAMEF = "powf";
  1365. ifSVID
  1366. {
  1367. RETVAL_ZEROF;
  1368. NOT_MATHERRF
  1369. {
  1370. WRITEF_POW_NEG_TO_NON_INTEGER;
  1371. ERRNO_DOMAIN;
  1372. }
  1373. }
  1374. else
  1375. {
  1376. NOT_MATHERRF {ERRNO_DOMAIN;}
  1377. }
  1378. #ifdef __MS__
  1379. *(float *)retval = (float) excf.retval;
  1380. #elif
  1381. *(float *)retval = excf.retval;
  1382. #endif
  1383. break;
  1384. }
  1385. case pow_nan_to_zero:
  1386. /* pow(NaN,0.0) */
  1387. /* Special Error */
  1388. {
  1389. DOMAIND; NAMED = "pow"; INPUT_XD; INPUT_YD;
  1390. exc.retval = *(double *)arg1;
  1391. if (!_matherr(&exc)) ERRNO_DOMAIN;
  1392. *(double *)retval = exc.retval;
  1393. break;
  1394. }
  1395. case powf_nan_to_zero:
  1396. /* powf(NaN,0.0) */
  1397. /* Special Error */
  1398. {
  1399. DOMAINF; NAMEF = "powf"; INPUT_XF; INPUT_YF;
  1400. #ifdef __MS__
  1401. excf.retval = *(double *)arg1;
  1402. #elif
  1403. excf.retval = *(float *)arg1;
  1404. #endif
  1405. if (!_matherrf(&excf)) ERRNO_DOMAIN;
  1406. #ifdef __MS__
  1407. *(float *)retval = (float) excf.retval;
  1408. #elif
  1409. *(float *)retval = excf.retval;
  1410. #endif
  1411. break;
  1412. }
  1413. case atan2_zero:
  1414. /* atan2(0.0,0.0) */
  1415. {
  1416. DOMAIND; NAMED = "atan2";
  1417. #ifndef __MS__
  1418. RETVAL_ZEROD;
  1419. #endif
  1420. NOT_MATHERRD
  1421. {
  1422. ifSVID
  1423. {
  1424. WRITED_ATAN2_ZERO_BY_ZERO;
  1425. }
  1426. ERRNO_DOMAIN;
  1427. }
  1428. *(double *)retval = exc.retval;
  1429. break;
  1430. }
  1431. case atan2f_zero:
  1432. /* atan2f(0.0,0.0) */
  1433. {
  1434. DOMAINF; NAMEF = "atan2f";
  1435. #ifndef __MS__
  1436. RETVAL_ZEROF;
  1437. #endif
  1438. NOT_MATHERRF
  1439. ifSVID
  1440. {
  1441. WRITEF_ATAN2_ZERO_BY_ZERO;
  1442. }
  1443. ERRNO_DOMAIN;
  1444. #ifdef __MS__
  1445. *(float *)retval = (float) excf.retval;
  1446. #elif
  1447. *(float *)retval = excf.retval;
  1448. #endif
  1449. break;
  1450. }
  1451. case expm1_overflow:
  1452. /* expm1(finite) overflow */
  1453. /* Overflow is the only documented */
  1454. /* special value. */
  1455. {
  1456. ERRNO_RANGE;
  1457. break;
  1458. }
  1459. case expm1f_overflow:
  1460. /* expm1f(finite) overflow */
  1461. {
  1462. ERRNO_RANGE;
  1463. break;
  1464. }
  1465. case expm1_underflow:
  1466. /* expm1(finite) underflow */
  1467. /* Underflow is not documented */
  1468. /* special value. */
  1469. {
  1470. ERRNO_RANGE;
  1471. break;
  1472. }
  1473. case expm1f_underflow:
  1474. /* expm1f(finite) underflow */
  1475. {
  1476. ERRNO_RANGE;
  1477. break;
  1478. }
  1479. case scalb_underflow:
  1480. /* scalb underflow */
  1481. {
  1482. UNDERFLOWD; NAMED = "scalb";
  1483. if (INPUT_XD < 0.0) RETVAL_NEG_ZEROD;
  1484. else RETVAL_ZEROD;
  1485. NOT_MATHERRD {ERRNO_RANGE;}
  1486. *(double *)retval = exc.retval;
  1487. break;
  1488. }
  1489. case scalbf_underflow:
  1490. /* scalbf underflow */
  1491. {
  1492. UNDERFLOWF; NAMEF = "scalbf";
  1493. if (INPUT_XF < 0.0) RETVAL_NEG_ZEROF;
  1494. else RETVAL_ZEROF;
  1495. NOT_MATHERRF {ERRNO_RANGE;}
  1496. #ifdef __MS__
  1497. *(float *)retval = (float) excf.retval;
  1498. #elif
  1499. *(float *)retval = excf.retval;
  1500. #endif
  1501. break;
  1502. }
  1503. case scalb_overflow:
  1504. /* scalb overflow */
  1505. {
  1506. OVERFLOWD; NAMED = "scalb";
  1507. if (INPUT_XD < 0) RETVAL_NEG_HUGE_VALD;
  1508. else RETVAL_HUGE_VALD;
  1509. NOT_MATHERRD {ERRNO_RANGE;}
  1510. *(double *)retval = exc.retval;
  1511. break;
  1512. }
  1513. case scalbf_overflow:
  1514. /* scalbf overflow */
  1515. {
  1516. OVERFLOWF; NAMEF = "scalbf";
  1517. if (INPUT_XF < 0) RETVAL_NEG_HUGE_VALF;
  1518. else RETVAL_HUGE_VALF;
  1519. NOT_MATHERRF {ERRNO_RANGE;}
  1520. #ifdef __MS__
  1521. *(float *)retval = (float) excf.retval;
  1522. #elif
  1523. *(float *)retval = excf.retval;
  1524. #endif
  1525. break;
  1526. }
  1527. case hypot_overflow:
  1528. /* hypot overflow */
  1529. {
  1530. OVERFLOWD; NAMED = "hypot";
  1531. ifSVID
  1532. {
  1533. RETVAL_HUGED;
  1534. }
  1535. else
  1536. {
  1537. RETVAL_HUGE_VALD;
  1538. }
  1539. NOT_MATHERRD {ERRNO_RANGE;}
  1540. *(double *)retval = exc.retval;
  1541. break;
  1542. }
  1543. case hypotf_overflow:
  1544. /* hypotf overflow */
  1545. {
  1546. OVERFLOWF; NAMEF = "hypotf";
  1547. ifSVID
  1548. {
  1549. RETVAL_HUGEF;
  1550. }
  1551. else
  1552. {
  1553. RETVAL_HUGE_VALF;
  1554. }
  1555. NOT_MATHERRF {ERRNO_RANGE;}
  1556. #ifdef __MS__
  1557. *(float *)retval = (float) excf.retval;
  1558. #elif
  1559. *(float *)retval = excf.retval;
  1560. #endif
  1561. break;
  1562. }
  1563. case acos_gt_one:
  1564. /* acos(x > 1) */
  1565. {
  1566. DOMAIND; NAMED = "acos";
  1567. #ifndef __MS__
  1568. RETVAL_ZEROD;
  1569. #endif
  1570. ifSVID
  1571. {
  1572. NOT_MATHERRD
  1573. {
  1574. WRITED_ACOS;
  1575. ERRNO_DOMAIN;
  1576. }
  1577. }
  1578. else
  1579. {
  1580. NOT_MATHERRD {ERRNO_DOMAIN;}
  1581. }
  1582. *(double *)retval = exc.retval;
  1583. break;
  1584. }
  1585. case acosf_gt_one:
  1586. /* acosf(x > 1) */
  1587. {
  1588. DOMAINF; NAMEF = "acosf";
  1589. #ifndef __MS__
  1590. RETVAL_ZEROF;
  1591. #endif
  1592. ifSVID
  1593. {
  1594. NOT_MATHERRF
  1595. {
  1596. WRITEF_ACOS;
  1597. ERRNO_DOMAIN;
  1598. }
  1599. }
  1600. else
  1601. {
  1602. NOT_MATHERRF {ERRNO_DOMAIN;}
  1603. }
  1604. #ifdef __MS__
  1605. *(float *)retval = (float)excf.retval;
  1606. #elif
  1607. *(float *)retval = excf.retval;
  1608. #endif
  1609. break;
  1610. }
  1611. case asin_gt_one:
  1612. /* asin(x > 1) */
  1613. {
  1614. DOMAIND; NAMED = "asin";
  1615. #ifndef __MS__
  1616. RETVAL_ZEROD;
  1617. #endif
  1618. ifSVID
  1619. {
  1620. NOT_MATHERRD
  1621. {
  1622. WRITED_ASIN;
  1623. ERRNO_DOMAIN;
  1624. }
  1625. }
  1626. else
  1627. {
  1628. NOT_MATHERRD {ERRNO_DOMAIN;}
  1629. }
  1630. *(double *)retval = exc.retval;
  1631. break;
  1632. }
  1633. case asinf_gt_one:
  1634. /* asinf(x > 1) */
  1635. {
  1636. DOMAINF; NAMEF = "asinf";
  1637. #ifndef __MS__
  1638. RETVAL_ZEROF;
  1639. #endif
  1640. ifSVID
  1641. {
  1642. NOT_MATHERRF
  1643. {
  1644. WRITEF_ASIN;
  1645. ERRNO_DOMAIN;
  1646. }
  1647. }
  1648. else
  1649. {
  1650. NOT_MATHERRF {ERRNO_DOMAIN;}
  1651. }
  1652. #ifdef __MS__
  1653. *(float *)retval = (float) excf.retval;
  1654. #elif
  1655. *(float *)retval = excf.retval;
  1656. #endif
  1657. break;
  1658. }
  1659. case cosh_overflow:
  1660. /* cosh overflow */
  1661. {
  1662. OVERFLOWD; NAMED="cosh";
  1663. ifSVID
  1664. {
  1665. RETVAL_HUGED;
  1666. }
  1667. else
  1668. {
  1669. RETVAL_HUGE_VALD;
  1670. }
  1671. NOT_MATHERRD {ERRNO_RANGE;}
  1672. *(double *)retval = exc.retval;
  1673. break;
  1674. }
  1675. case coshf_overflow:
  1676. /* coshf overflow */
  1677. {
  1678. OVERFLOWF; NAMEF="coshf";
  1679. ifSVID
  1680. {
  1681. RETVAL_HUGEF;
  1682. }
  1683. else
  1684. {
  1685. RETVAL_HUGE_VALF;
  1686. }
  1687. NOT_MATHERRF {ERRNO_RANGE;}
  1688. #ifdef __MS__
  1689. *(float *)retval = (float) excf.retval;
  1690. #elif
  1691. *(float *)retval = excf.retval;
  1692. #endif
  1693. break;
  1694. }
  1695. case sinh_overflow:
  1696. /* sinh overflow */
  1697. {
  1698. OVERFLOWD; NAMED="sinh";
  1699. ifSVID
  1700. {
  1701. if (INPUT_XD > 0.0) RETVAL_HUGED;
  1702. else RETVAL_NEG_HUGED;
  1703. }
  1704. else
  1705. {
  1706. if (INPUT_XD > 0.0) RETVAL_HUGE_VALD;
  1707. else RETVAL_NEG_HUGE_VALD;
  1708. }
  1709. NOT_MATHERRD {ERRNO_RANGE;}
  1710. *(double *)retval = exc.retval;
  1711. break;
  1712. }
  1713. case sinhf_overflow:
  1714. /* sinhf overflow */
  1715. {
  1716. OVERFLOWF; NAMEF="sinhf";
  1717. ifSVID
  1718. {
  1719. if( INPUT_XF > 0.0) RETVAL_HUGEF;
  1720. else RETVAL_NEG_HUGEF;
  1721. }
  1722. else
  1723. {
  1724. if (INPUT_XF > 0.0) RETVAL_HUGE_VALF;
  1725. else RETVAL_NEG_HUGE_VALF;
  1726. }
  1727. NOT_MATHERRF {ERRNO_RANGE;}
  1728. #ifdef __MS__
  1729. *(float *)retval = (float) excf.retval;
  1730. #elif
  1731. *(float *)retval = excf.retval;
  1732. #endif
  1733. break;
  1734. }
  1735. case acosh_lt_one:
  1736. /* acosh(x < 1) */
  1737. {
  1738. DOMAIND; NAMED="acosh";
  1739. ifSVID
  1740. {
  1741. NOT_MATHERRD
  1742. {
  1743. WRITEL_ACOSH;
  1744. ERRNO_DOMAIN;
  1745. }
  1746. }
  1747. else NOT_MATHERRD {ERRNO_DOMAIN;}
  1748. *(double *)retval = exc.retval;
  1749. break;
  1750. }
  1751. case acoshf_lt_one:
  1752. /* acoshf(x < 1) */
  1753. {
  1754. DOMAINF; NAMEF="acoshf";
  1755. ifSVID
  1756. {
  1757. NOT_MATHERRF
  1758. {
  1759. WRITEF_ACOSH;
  1760. ERRNO_DOMAIN;
  1761. }
  1762. }
  1763. else
  1764. {
  1765. NOT_MATHERRF {ERRNO_DOMAIN;}
  1766. }
  1767. #ifdef __MS__
  1768. *(float *)retval = (float) excf.retval;
  1769. #elif
  1770. *(float *)retval = excf.retval;
  1771. #endif
  1772. ERRNO_DOMAIN; break;
  1773. }
  1774. case atanh_gt_one:
  1775. /* atanh(|x| > 1) */
  1776. {
  1777. DOMAIND; NAMED="atanh";
  1778. ifSVID
  1779. {
  1780. NOT_MATHERRD
  1781. {
  1782. WRITED_ATANH_GT_ONE;
  1783. ERRNO_DOMAIN;
  1784. }
  1785. }
  1786. else
  1787. {
  1788. NOT_MATHERRD {ERRNO_DOMAIN;}
  1789. }
  1790. break;
  1791. }
  1792. case atanhf_gt_one:
  1793. /* atanhf(|x| > 1) */
  1794. {
  1795. DOMAINF; NAMEF="atanhf";
  1796. ifSVID
  1797. {
  1798. NOT_MATHERRF
  1799. {
  1800. WRITEF_ATANH_GT_ONE;
  1801. ERRNO_DOMAIN;
  1802. }
  1803. }
  1804. else
  1805. {
  1806. NOT_MATHERRF {ERRNO_DOMAIN;}
  1807. }
  1808. break;
  1809. }
  1810. case atanh_eq_one:
  1811. /* atanh(|x| == 1) */
  1812. {
  1813. SINGD; NAMED="atanh";
  1814. ifSVID
  1815. {
  1816. NOT_MATHERRD
  1817. {
  1818. WRITED_ATANH_EQ_ONE;
  1819. ERRNO_DOMAIN;
  1820. }
  1821. }
  1822. else
  1823. {
  1824. NOT_MATHERRD {ERRNO_DOMAIN;}
  1825. }
  1826. break;
  1827. }
  1828. case atanhf_eq_one:
  1829. /* atanhf(|x| == 1) */
  1830. {
  1831. SINGF; NAMEF="atanhf";
  1832. ifSVID
  1833. {
  1834. NOT_MATHERRF
  1835. {
  1836. WRITEF_ATANH_EQ_ONE;
  1837. ERRNO_DOMAIN;
  1838. }
  1839. }
  1840. else
  1841. {
  1842. NOT_MATHERRF {ERRNO_DOMAIN;}
  1843. }
  1844. break;
  1845. }
  1846. case gamma_overflow:
  1847. /* gamma overflow */
  1848. {
  1849. OVERFLOWD; NAMED="gamma";
  1850. ifSVID
  1851. {
  1852. RETVAL_HUGED;
  1853. }
  1854. else
  1855. {
  1856. RETVAL_HUGE_VALD;
  1857. }
  1858. NOT_MATHERRD {ERRNO_RANGE;}
  1859. *(double *)retval = exc.retval;
  1860. break;
  1861. }
  1862. case gammaf_overflow:
  1863. /* gammaf overflow */
  1864. {
  1865. OVERFLOWF; NAMEF="gammaf";
  1866. ifSVID
  1867. {
  1868. RETVAL_HUGEF;
  1869. }
  1870. else
  1871. {
  1872. RETVAL_HUGE_VALF;
  1873. }
  1874. NOT_MATHERRF {ERRNO_RANGE;}
  1875. #ifdef __MS__
  1876. *(float *)retval = (float) excf.retval;
  1877. #elif
  1878. *(float *)retval = excf.retval;
  1879. #endif
  1880. break;
  1881. }
  1882. case lgamma_overflow:
  1883. /* lgamma overflow */
  1884. {
  1885. OVERFLOWD; NAMED="lgamma";
  1886. ifSVID
  1887. {
  1888. RETVAL_HUGED;
  1889. }
  1890. else
  1891. {
  1892. RETVAL_HUGE_VALD;
  1893. }
  1894. NOT_MATHERRD {ERRNO_RANGE;}
  1895. *(double *)retval = exc.retval;
  1896. break;
  1897. }
  1898. case lgammaf_overflow:
  1899. /* lgammaf overflow */
  1900. {
  1901. OVERFLOWF; NAMEF="lgammaf";
  1902. ifSVID
  1903. {
  1904. RETVAL_HUGEF;
  1905. }
  1906. else
  1907. {
  1908. RETVAL_HUGE_VALF;
  1909. }
  1910. NOT_MATHERRF {ERRNO_RANGE;}
  1911. #ifdef __MS__
  1912. *(float *)retval = (float) excf.retval;
  1913. #elif
  1914. *(float *)retval = excf.retval;
  1915. #endif
  1916. break;
  1917. }
  1918. case lgamma_negative:
  1919. /* lgamma -int or 0 */
  1920. {
  1921. SINGD; NAMED="lgamma";
  1922. ifSVID
  1923. {
  1924. RETVAL_HUGED;
  1925. NOT_MATHERRD
  1926. {
  1927. WRITED_LGAMMA_NEGATIVE;
  1928. ERRNO_DOMAIN;
  1929. }
  1930. }
  1931. else
  1932. {
  1933. RETVAL_HUGE_VALD;
  1934. NOT_MATHERRD {ERRNO_DOMAIN;}
  1935. }
  1936. *(double *)retval = exc.retval;
  1937. break;
  1938. }
  1939. case lgammaf_negative:
  1940. /* lgammaf -int or 0 */
  1941. {
  1942. SINGF; NAMEF="lgammaf";
  1943. ifSVID
  1944. {
  1945. RETVAL_HUGEF;
  1946. NOT_MATHERRF
  1947. {
  1948. WRITEF_LGAMMA_NEGATIVE;
  1949. ERRNO_DOMAIN;
  1950. }
  1951. }
  1952. else
  1953. {
  1954. RETVAL_HUGE_VALF;
  1955. NOT_MATHERRF {ERRNO_DOMAIN;}
  1956. }
  1957. #ifdef __MS__
  1958. *(float *)retval = (float) excf.retval;
  1959. #elif
  1960. *(float *)retval = excf.retval;
  1961. #endif
  1962. break;
  1963. }
  1964. case gamma_negative:
  1965. /* gamma -int or 0 */
  1966. {
  1967. SINGD; NAMED="gamma";
  1968. ifSVID
  1969. {
  1970. RETVAL_HUGED;
  1971. NOT_MATHERRD
  1972. {
  1973. WRITED_GAMMA_NEGATIVE;
  1974. ERRNO_DOMAIN;
  1975. }
  1976. }
  1977. else
  1978. {
  1979. RETVAL_HUGE_VALD;
  1980. NOT_MATHERRD {ERRNO_DOMAIN;}
  1981. }
  1982. *(double *)retval = exc.retval;
  1983. break;
  1984. }
  1985. case gammaf_negative:
  1986. /* gammaf -int or 0 */
  1987. {
  1988. SINGF; NAMEF="gammaf";
  1989. ifSVID
  1990. {
  1991. RETVAL_HUGEF;
  1992. NOT_MATHERRF
  1993. {
  1994. WRITEF_GAMMA_NEGATIVE;
  1995. ERRNO_DOMAIN;
  1996. }
  1997. }
  1998. else
  1999. {
  2000. RETVAL_HUGE_VALF;
  2001. NOT_MATHERRF {ERRNO_DOMAIN;}
  2002. }
  2003. #ifdef __MS__
  2004. *(float *)retval = (float) excf.retval;
  2005. #elif
  2006. *(float *)retval = excf.retval;
  2007. #endif
  2008. break;
  2009. }
  2010. case j0_gt_loss:
  2011. /* j0 > loss */
  2012. {
  2013. TLOSSD; NAMED="j0";
  2014. RETVAL_ZEROD;
  2015. ifSVID
  2016. {
  2017. NOT_MATHERRD
  2018. {
  2019. WRITED_J0_TLOSS;
  2020. ERRNO_RANGE;
  2021. }
  2022. }
  2023. else
  2024. {
  2025. NOT_MATHERRD {ERRNO_RANGE;}
  2026. }
  2027. *(double*)retval = exc.retval;
  2028. break;
  2029. }
  2030. case j0f_gt_loss:
  2031. /* j0f > loss */
  2032. {
  2033. TLOSSF; NAMEF="j0f";
  2034. RETVAL_ZEROF;
  2035. ifSVID
  2036. {
  2037. NOT_MATHERRF
  2038. {
  2039. WRITEF_J0_TLOSS;
  2040. ERRNO_RANGE;
  2041. }
  2042. }
  2043. else
  2044. {
  2045. NOT_MATHERRF {ERRNO_RANGE;}
  2046. }
  2047. #ifdef __MS__
  2048. *(float *)retval = (float) excf.retval;
  2049. #elif
  2050. *(float *)retval = excf.retval;
  2051. #endif
  2052. break;
  2053. }
  2054. case j1_gt_loss:
  2055. /* j1 > loss */
  2056. {
  2057. TLOSSD; NAMED="j1";
  2058. RETVAL_ZEROD;
  2059. ifSVID
  2060. {
  2061. NOT_MATHERRD
  2062. {
  2063. WRITED_J1_TLOSS;
  2064. ERRNO_RANGE;
  2065. }
  2066. }
  2067. else
  2068. {
  2069. NOT_MATHERRD {ERRNO_RANGE;}
  2070. }
  2071. *(double*)retval = exc.retval;
  2072. break;
  2073. }
  2074. case j1f_gt_loss:
  2075. /* j1f > loss */
  2076. {
  2077. TLOSSF; NAMEF="j1f";
  2078. RETVAL_ZEROF;
  2079. ifSVID
  2080. {
  2081. NOT_MATHERRF
  2082. {
  2083. WRITEF_J1_TLOSS;
  2084. ERRNO_RANGE;
  2085. }
  2086. }
  2087. else
  2088. {
  2089. NOT_MATHERRF {ERRNO_RANGE;}
  2090. }
  2091. #ifdef __MS__
  2092. *(float *)retval = (float) excf.retval;
  2093. #elif
  2094. *(float *)retval = excf.retval;
  2095. #endif
  2096. break;
  2097. }
  2098. case jn_gt_loss:
  2099. /* jn > loss */
  2100. {
  2101. TLOSSD; NAMED="jn";
  2102. RETVAL_ZEROD;
  2103. ifSVID
  2104. {
  2105. NOT_MATHERRD
  2106. {
  2107. WRITED_JN_TLOSS;
  2108. ERRNO_RANGE;
  2109. }
  2110. }
  2111. else
  2112. {
  2113. NOT_MATHERRD {ERRNO_RANGE;}
  2114. }
  2115. *(double*)retval = exc.retval;
  2116. break;
  2117. }
  2118. case jnf_gt_loss:
  2119. /* jnf > loss */
  2120. {
  2121. TLOSSF; NAMEF="jnf";
  2122. RETVAL_ZEROF;
  2123. ifSVID
  2124. {
  2125. NOT_MATHERRF
  2126. {
  2127. WRITEF_JN_TLOSS;
  2128. ERRNO_RANGE;
  2129. }
  2130. }
  2131. else
  2132. {
  2133. NOT_MATHERRF {ERRNO_RANGE;}
  2134. }
  2135. #ifdef __MS__
  2136. *(float *)retval = (float) excf.retval;
  2137. #elif
  2138. *(float *)retval = excf.retval;
  2139. #endif
  2140. break;
  2141. }
  2142. case y0_gt_loss:
  2143. /* y0 > loss */
  2144. {
  2145. TLOSSD; NAMED="y0";
  2146. RETVAL_ZEROD;
  2147. ifSVID
  2148. {
  2149. NOT_MATHERRD
  2150. {
  2151. WRITED_Y0_TLOSS;
  2152. ERRNO_RANGE;
  2153. }
  2154. }
  2155. else
  2156. {
  2157. NOT_MATHERRD {ERRNO_RANGE;}
  2158. }
  2159. *(double*)retval = exc.retval;
  2160. break;
  2161. }
  2162. case y0f_gt_loss:
  2163. /* y0f > loss */
  2164. {
  2165. TLOSSF; NAMEF="y0f";
  2166. RETVAL_ZEROF;
  2167. ifSVID
  2168. {
  2169. NOT_MATHERRF
  2170. {
  2171. WRITEF_Y0_TLOSS;
  2172. ERRNO_RANGE;
  2173. }
  2174. }
  2175. else
  2176. {
  2177. NOT_MATHERRF {ERRNO_RANGE;}
  2178. }
  2179. #ifdef __MS__
  2180. *(float *)retval = (float) excf.retval;
  2181. #elif
  2182. *(float *)retval = excf.retval;
  2183. #endif
  2184. break;
  2185. }
  2186. case y0_zero:
  2187. /* y0(0) */
  2188. {
  2189. DOMAIND; NAMED="y0";
  2190. ifSVID
  2191. {
  2192. RETVAL_NEG_HUGED;
  2193. NOT_MATHERRD
  2194. {
  2195. WRITED_Y0_ZERO;
  2196. ERRNO_DOMAIN;
  2197. }
  2198. }
  2199. else
  2200. {
  2201. #ifndef __MS__
  2202. RETVAL_NEG_HUGE_VALD;
  2203. #endif
  2204. NOT_MATHERRD {ERRNO_DOMAIN;}
  2205. }
  2206. *(double *)retval = exc.retval;
  2207. break;
  2208. }
  2209. case y0f_zero:
  2210. /* y0f(0) */
  2211. {
  2212. DOMAINF; NAMEF="y0f";
  2213. ifSVID
  2214. {
  2215. RETVAL_NEG_HUGEF;
  2216. NOT_MATHERRF
  2217. {
  2218. WRITEF_Y0_ZERO;
  2219. ERRNO_DOMAIN;
  2220. }
  2221. }
  2222. else
  2223. {
  2224. #ifndef __MS__
  2225. RETVAL_NEG_HUGE_VALF;
  2226. #endif
  2227. NOT_MATHERRF {ERRNO_DOMAIN;}
  2228. }
  2229. #ifdef __MS__
  2230. *(float *)retval = (float) excf.retval;
  2231. #elif
  2232. *(float *)retval = excf.retval;
  2233. #endif
  2234. break;
  2235. }
  2236. case y1_gt_loss:
  2237. /* y1 > loss */
  2238. {
  2239. TLOSSD; NAMED="y1";
  2240. RETVAL_ZEROD;
  2241. ifSVID
  2242. {
  2243. NOT_MATHERRD
  2244. {
  2245. WRITED_Y1_TLOSS;
  2246. ERRNO_RANGE;
  2247. }
  2248. }
  2249. else
  2250. {
  2251. NOT_MATHERRD {ERRNO_RANGE;}
  2252. }
  2253. *(double*)retval = exc.retval;
  2254. break;
  2255. }
  2256. case y1f_gt_loss:
  2257. /* y1f > loss */
  2258. {
  2259. TLOSSF; NAMEF="y1f";
  2260. RETVAL_ZEROF;
  2261. ifSVID
  2262. {
  2263. NOT_MATHERRF
  2264. {
  2265. WRITEF_Y1_TLOSS;
  2266. ERRNO_RANGE;
  2267. }
  2268. }
  2269. else
  2270. {
  2271. NOT_MATHERRF {ERRNO_RANGE;}
  2272. }
  2273. #ifdef __MS__
  2274. *(float *)retval = (float) excf.retval;
  2275. #elif
  2276. *(float *)retval = excf.retval;
  2277. #endif
  2278. break;
  2279. }
  2280. case y1_zero:
  2281. /* y1(0) */
  2282. {
  2283. DOMAIND; NAMED="y1";
  2284. ifSVID
  2285. {
  2286. RETVAL_NEG_HUGED;
  2287. NOT_MATHERRD
  2288. {
  2289. WRITED_Y1_ZERO;
  2290. ERRNO_DOMAIN;
  2291. }
  2292. }
  2293. else
  2294. {
  2295. #ifndef __MS__
  2296. RETVAL_NEG_HUGE_VALD;
  2297. #endif
  2298. NOT_MATHERRD {ERRNO_DOMAIN;}
  2299. }
  2300. *(double *)retval = exc.retval;
  2301. break;
  2302. }
  2303. case y1f_zero:
  2304. /* y1f(0) */
  2305. {
  2306. DOMAINF; NAMEF="y1f";
  2307. ifSVID
  2308. {
  2309. RETVAL_NEG_HUGEF;
  2310. NOT_MATHERRF
  2311. {
  2312. WRITEF_Y1_ZERO;
  2313. ERRNO_DOMAIN;
  2314. }
  2315. }else
  2316. {
  2317. #ifndef __MS__
  2318. RETVAL_NEG_HUGE_VALF;
  2319. #endif
  2320. NOT_MATHERRF {ERRNO_DOMAIN;}
  2321. }
  2322. #ifdef __MS__
  2323. *(float *)retval = (float) excf.retval;
  2324. #elif
  2325. *(float *)retval = excf.retval;
  2326. #endif
  2327. break;
  2328. }
  2329. case yn_gt_loss:
  2330. /* yn > loss */
  2331. {
  2332. TLOSSD; NAMED="yn";
  2333. RETVAL_ZEROD;
  2334. ifSVID
  2335. {
  2336. NOT_MATHERRD
  2337. {
  2338. WRITED_YN_TLOSS;
  2339. ERRNO_RANGE;
  2340. }
  2341. }
  2342. else
  2343. {
  2344. NOT_MATHERRD {ERRNO_RANGE;}
  2345. }
  2346. *(double*)retval = exc.retval;
  2347. break;
  2348. }
  2349. case ynf_gt_loss:
  2350. /* ynf > loss */
  2351. {
  2352. TLOSSF; NAMEF="ynf";
  2353. RETVAL_ZEROF;
  2354. ifSVID
  2355. {
  2356. NOT_MATHERRF
  2357. {
  2358. WRITEF_YN_TLOSS;
  2359. ERRNO_RANGE;
  2360. }
  2361. }
  2362. else
  2363. {
  2364. NOT_MATHERRF {ERRNO_RANGE;}
  2365. }
  2366. #ifdef __MS__
  2367. *(float *)retval = (float) excf.retval;
  2368. #elif
  2369. *(float *)retval = excf.retval;
  2370. #endif
  2371. break;
  2372. }
  2373. case yn_zero:
  2374. /* yn(0) */
  2375. {
  2376. DOMAIND; NAMED="yn";
  2377. ifSVID
  2378. {
  2379. RETVAL_NEG_HUGED;
  2380. NOT_MATHERRD
  2381. {
  2382. WRITED_YN_ZERO;
  2383. ERRNO_DOMAIN;
  2384. }
  2385. }
  2386. else
  2387. {
  2388. #ifndef __MS__
  2389. RETVAL_NEG_HUGE_VALD;
  2390. #endif
  2391. NOT_MATHERRD {ERRNO_DOMAIN;}
  2392. }
  2393. *(double *)retval = exc.retval;
  2394. break;
  2395. }
  2396. case ynf_zero:
  2397. /* ynf(0) */
  2398. {
  2399. DOMAINF; NAMEF="ynf";
  2400. ifSVID
  2401. {
  2402. RETVAL_NEG_HUGEF;
  2403. NOT_MATHERRF
  2404. {
  2405. WRITEF_YN_ZERO;
  2406. ERRNO_DOMAIN;
  2407. }
  2408. }
  2409. else
  2410. {
  2411. #ifndef __MS__
  2412. RETVAL_NEG_HUGE_VALF;
  2413. #endif
  2414. NOT_MATHERRF {ERRNO_DOMAIN;}
  2415. }
  2416. #ifdef __MS__
  2417. *(float *)retval = (float) excf.retval;
  2418. #elif
  2419. *(float *)retval = excf.retval;
  2420. #endif
  2421. break;
  2422. }
  2423. case y0_negative:
  2424. /* y0(x<0) */
  2425. {
  2426. DOMAIND; NAMED="y0";
  2427. ifSVID
  2428. {
  2429. RETVAL_NEG_HUGED;
  2430. NOT_MATHERRD
  2431. {
  2432. WRITED_Y0_NEGATIVE;
  2433. ERRNO_DOMAIN;
  2434. }
  2435. }
  2436. else
  2437. {
  2438. #ifndef __MS__
  2439. RETVAL_NEG_HUGE_VALD;
  2440. #endif
  2441. NOT_MATHERRD {ERRNO_DOMAIN;}
  2442. }
  2443. *(double *)retval = exc.retval;
  2444. break;
  2445. }
  2446. case y0f_negative:
  2447. /* y0f(x<0) */
  2448. {
  2449. DOMAINF; NAMEF="y0f";
  2450. ifSVID
  2451. {
  2452. RETVAL_NEG_HUGEF;
  2453. NOT_MATHERRF
  2454. {
  2455. WRITEF_Y0_NEGATIVE;
  2456. ERRNO_DOMAIN;
  2457. }
  2458. }
  2459. else
  2460. {
  2461. #ifndef __MS__
  2462. RETVAL_NEG_HUGE_VALF;
  2463. #endif
  2464. NOT_MATHERRF {ERRNO_DOMAIN;}
  2465. }
  2466. #ifdef __MS__
  2467. *(float *)retval = (float) excf.retval;
  2468. #elif
  2469. *(float *)retval = excf.retval;
  2470. #endif
  2471. break;
  2472. }
  2473. case y1_negative:
  2474. /* y1(x<0) */
  2475. {
  2476. DOMAIND; NAMED="y1";
  2477. ifSVID
  2478. {
  2479. RETVAL_NEG_HUGED;
  2480. NOT_MATHERRD
  2481. {
  2482. WRITED_Y1_NEGATIUE;
  2483. ERRNO_DOMAIN;
  2484. }
  2485. }
  2486. else
  2487. {
  2488. #ifndef __MS__
  2489. RETVAL_NEG_HUGE_VALD;
  2490. #endif
  2491. NOT_MATHERRD {ERRNO_DOMAIN;}
  2492. }
  2493. *(double *)retval = exc.retval;
  2494. break;
  2495. }
  2496. case y1f_negative:
  2497. /* y1f(x<0) */
  2498. {
  2499. DOMAINF; NAMEF="y1f";
  2500. ifSVID
  2501. {
  2502. RETVAL_NEG_HUGEF;
  2503. NOT_MATHERRF
  2504. {
  2505. WRITEF_Y1_NEGATIVE;
  2506. ERRNO_DOMAIN;
  2507. }
  2508. }
  2509. else
  2510. {
  2511. #ifndef __MS__
  2512. RETVAL_NEG_HUGE_VALF;
  2513. #endif
  2514. NOT_MATHERRF {ERRNO_DOMAIN;}
  2515. }
  2516. #ifdef __MS__
  2517. *(float *)retval = (float) excf.retval;
  2518. #elif
  2519. *(float *)retval = excf.retval;
  2520. #endif
  2521. break;
  2522. }
  2523. case yn_negative:
  2524. /* yn(x<0) */
  2525. {
  2526. DOMAIND; NAMED="yn";
  2527. ifSVID
  2528. {
  2529. RETVAL_NEG_HUGED;
  2530. NOT_MATHERRD
  2531. {
  2532. WRITED_YN_NEGATIVE;
  2533. ERRNO_DOMAIN;
  2534. }
  2535. }
  2536. else
  2537. {
  2538. #ifndef __MS__
  2539. RETVAL_NEG_HUGE_VALD;
  2540. #endif
  2541. NOT_MATHERRD {ERRNO_DOMAIN;}
  2542. }
  2543. *(double *)retval = exc.retval;
  2544. break;
  2545. }
  2546. case ynf_negative:
  2547. /* ynf(x<0) */
  2548. {
  2549. DOMAINF; NAMEF="ynf";
  2550. ifSVID
  2551. {
  2552. RETVAL_NEG_HUGEF;
  2553. NOT_MATHERRF
  2554. {
  2555. WRITEF_YN_NEGATIVE;
  2556. ERRNO_DOMAIN;
  2557. }
  2558. }
  2559. else
  2560. {
  2561. #ifndef __MS__
  2562. RETVAL_NEG_HUGE_VALF;
  2563. #endif
  2564. NOT_MATHERRF {ERRNO_DOMAIN;}
  2565. }
  2566. #ifdef __MS__
  2567. *(float *)retval = (float) excf.retval;
  2568. #elif
  2569. *(float *)retval = excf.retval;
  2570. #endif
  2571. break;
  2572. }
  2573. case fmod_by_zero:
  2574. /* fmod(x,0) */
  2575. {
  2576. DOMAIND; NAMED = "fmod";
  2577. ifSVID
  2578. {
  2579. *(double *)retval = *(double *)arg1;
  2580. NOT_MATHERRD
  2581. {
  2582. WRITED_FMOD;
  2583. ERRNO_DOMAIN;
  2584. }
  2585. }
  2586. else
  2587. { /* NaN already computed */
  2588. NOT_MATHERRD {ERRNO_DOMAIN;}
  2589. }
  2590. *(double *)retval = exc.retval;
  2591. break;
  2592. }
  2593. case fmodf_by_zero:
  2594. /* fmodf(x,0) */
  2595. {
  2596. DOMAINF; NAMEF = "fmodf";
  2597. ifSVID
  2598. {
  2599. #ifdef __MS__
  2600. *(double *)retval = *(double *)arg1;
  2601. #elif
  2602. *(float *)retval = *(float *)arg1;
  2603. #endif
  2604. NOT_MATHERRF
  2605. {
  2606. WRITEF_FMOD;
  2607. ERRNO_DOMAIN;
  2608. }
  2609. }
  2610. else
  2611. {
  2612. NOT_MATHERRF {ERRNO_DOMAIN;}
  2613. }
  2614. #ifdef __MS__
  2615. *(float *)retval = (float) excf.retval;
  2616. #elif
  2617. *(float *)retval = excf.retval;
  2618. #endif
  2619. break;
  2620. }
  2621. case remainder_by_zero:
  2622. /* remainder(x,0) */
  2623. {
  2624. DOMAIND; NAMED = "remainder";
  2625. ifSVID
  2626. {
  2627. NOT_MATHERRD
  2628. {
  2629. WRITED_REM;
  2630. ERRNO_DOMAIN;
  2631. }
  2632. }
  2633. else
  2634. { /* NaN already computed */
  2635. NOT_MATHERRD {ERRNO_DOMAIN;}
  2636. }
  2637. *(double *)retval = exc.retval;
  2638. break;
  2639. }
  2640. case remainderf_by_zero:
  2641. /* remainderf(x,0) */
  2642. {
  2643. DOMAINF; NAMEF = "remainderf";
  2644. ifSVID
  2645. {
  2646. NOT_MATHERRF
  2647. {
  2648. WRITEF_REM;
  2649. ERRNO_DOMAIN;
  2650. }
  2651. }
  2652. else
  2653. {
  2654. NOT_MATHERRF {ERRNO_DOMAIN;}
  2655. }
  2656. #ifdef __MS__
  2657. *(float *)retval = (float) excf.retval;
  2658. #elif
  2659. *(float *)retval = excf.retval;
  2660. #endif
  2661. break;
  2662. }
  2663. }
  2664. return;
  2665. }
  2666. }