4
0

math.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
  2. /* A GNU-like <math.h>.
  3. Copyright (C) 2002-2003, 2007 Free Software Foundation, Inc.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef _GL_MATH_H
  15. /* The include_next requires a split double-inclusion guard. */
  16. #include_next <math.h>
  17. #ifndef _GL_MATH_H
  18. #define _GL_MATH_H
  19. /* The definition of GL_LINK_WARNING is copied here. */
  20. /* GL_LINK_WARNING("literal string") arranges to emit the literal string as
  21. a linker warning on most glibc systems.
  22. We use a linker warning rather than a preprocessor warning, because
  23. #warning cannot be used inside macros. */
  24. #ifndef GL_LINK_WARNING
  25. /* This works on platforms with GNU ld and ELF object format.
  26. Testing __GLIBC__ is sufficient for asserting that GNU ld is in use.
  27. Testing __ELF__ guarantees the ELF object format.
  28. Testing __GNUC__ is necessary for the compound expression syntax. */
  29. # if defined __GLIBC__ && defined __ELF__ && defined __GNUC__
  30. # define GL_LINK_WARNING(message) \
  31. GL_LINK_WARNING1 (__FILE__, __LINE__, message)
  32. # define GL_LINK_WARNING1(file, line, message) \
  33. GL_LINK_WARNING2 (file, line, message) /* macroexpand file and line */
  34. # define GL_LINK_WARNING2(file, line, message) \
  35. GL_LINK_WARNING3 (file ":" #line ": warning: " message)
  36. # define GL_LINK_WARNING3(message) \
  37. ({ static const char warning[sizeof (message)] \
  38. __attribute__ ((__unused__, \
  39. __section__ (".gnu.warning"), \
  40. __aligned__ (1))) \
  41. = message "\n"; \
  42. (void)0; \
  43. })
  44. # else
  45. # define GL_LINK_WARNING(message) ((void) 0)
  46. # endif
  47. #endif
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51. /* Write x as
  52. x = mantissa * 2^exp
  53. where
  54. If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
  55. If x is zero: mantissa = x, exp = 0.
  56. If x is infinite or NaN: mantissa = x, exp unspecified.
  57. Store exp in *EXPPTR and return mantissa. */
  58. #if 0
  59. # if 0
  60. # define frexp rpl_frexp
  61. extern double frexp (double x, int *expptr);
  62. # endif
  63. #elif defined GNULIB_POSIXCHECK
  64. # undef frexp
  65. # define frexp(x,e) \
  66. (GL_LINK_WARNING ("frexp is unportable - " \
  67. "use gnulib module frexp for portability"), \
  68. frexp (x, e))
  69. #endif
  70. #if 0 || !1
  71. extern long double acosl (long double x);
  72. #endif
  73. #if !0 && defined GNULIB_POSIXCHECK
  74. # undef acosl
  75. # define acosl(x) \
  76. (GL_LINK_WARNING ("acosl is unportable - " \
  77. "use gnulib module mathl for portability"), \
  78. acosl (x))
  79. #endif
  80. #if 0 || !1
  81. extern long double asinl (long double x);
  82. #endif
  83. #if !0 && defined GNULIB_POSIXCHECK
  84. # undef asinl
  85. # define asinl(x) \
  86. (GL_LINK_WARNING ("asinl is unportable - " \
  87. "use gnulib module mathl for portability"), \
  88. asinl (x))
  89. #endif
  90. #if 0 || !1
  91. extern long double atanl (long double x);
  92. #endif
  93. #if !0 && defined GNULIB_POSIXCHECK
  94. # undef atanl
  95. # define atanl(x) \
  96. (GL_LINK_WARNING ("atanl is unportable - " \
  97. "use gnulib module mathl for portability"), \
  98. atanl (x))
  99. #endif
  100. #if 0
  101. # if 0
  102. # define ceilf rpl_ceilf
  103. extern float ceilf (float x);
  104. # endif
  105. #elif defined GNULIB_POSIXCHECK
  106. # undef ceilf
  107. # define ceilf(x) \
  108. (GL_LINK_WARNING ("ceilf is unportable - " \
  109. "use gnulib module ceilf for portability"), \
  110. ceilf (x))
  111. #endif
  112. #if 0
  113. # if 0
  114. # define ceill rpl_ceill
  115. extern long double ceill (long double x);
  116. # endif
  117. #elif defined GNULIB_POSIXCHECK
  118. # undef ceill
  119. # define ceill(x) \
  120. (GL_LINK_WARNING ("ceill is unportable - " \
  121. "use gnulib module ceill for portability"), \
  122. ceill (x))
  123. #endif
  124. #if 0 || !1
  125. extern long double cosl (long double x);
  126. #endif
  127. #if !0 && defined GNULIB_POSIXCHECK
  128. # undef cosl
  129. # define cosl(x) \
  130. (GL_LINK_WARNING ("cosl is unportable - " \
  131. "use gnulib module mathl for portability"), \
  132. cosl (x))
  133. #endif
  134. #if 0 || !1
  135. extern long double expl (long double x);
  136. #endif
  137. #if !0 && defined GNULIB_POSIXCHECK
  138. # undef expl
  139. # define expl(x) \
  140. (GL_LINK_WARNING ("expl is unportable - " \
  141. "use gnulib module mathl for portability"), \
  142. expl (x))
  143. #endif
  144. #if 1
  145. # if 0
  146. # define floorf rpl_floorf
  147. extern float floorf (float x);
  148. # endif
  149. #elif defined GNULIB_POSIXCHECK
  150. # undef floorf
  151. # define floorf(x) \
  152. (GL_LINK_WARNING ("floorf is unportable - " \
  153. "use gnulib module floorf for portability"), \
  154. floorf (x))
  155. #endif
  156. #if 0
  157. # if 0
  158. # define floorl rpl_floorl
  159. extern long double floorl (long double x);
  160. # endif
  161. #elif defined GNULIB_POSIXCHECK
  162. # undef floorl
  163. # define floorl(x) \
  164. (GL_LINK_WARNING ("floorl is unportable - " \
  165. "use gnulib module floorl for portability"), \
  166. floorl (x))
  167. #endif
  168. /* Write x as
  169. x = mantissa * 2^exp
  170. where
  171. If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
  172. If x is zero: mantissa = x, exp = 0.
  173. If x is infinite or NaN: mantissa = x, exp unspecified.
  174. Store exp in *EXPPTR and return mantissa. */
  175. #if 0 && 0
  176. # define frexpl rpl_frexpl
  177. #endif
  178. #if (0 && 0) || !1
  179. extern long double frexpl (long double x, int *expptr);
  180. #endif
  181. #if !0 && defined GNULIB_POSIXCHECK
  182. # undef frexpl
  183. # define frexpl(x,e) \
  184. (GL_LINK_WARNING ("frexpl is unportable - " \
  185. "use gnulib module frexpl for portability"), \
  186. frexpl (x, e))
  187. #endif
  188. /* Return x * 2^exp. */
  189. #if 0 && 0
  190. # define ldexpl rpl_ldexpl
  191. #endif
  192. #if (0 && 0) || !1
  193. extern long double ldexpl (long double x, int exp);
  194. #endif
  195. #if !0 && defined GNULIB_POSIXCHECK
  196. # undef ldexpl
  197. # define ldexpl(x,e) \
  198. (GL_LINK_WARNING ("ldexpl is unportable - " \
  199. "use gnulib module ldexpl for portability"), \
  200. ldexpl (x, e))
  201. #endif
  202. #if 0 || !1
  203. extern long double logl (long double x);
  204. #endif
  205. #if !0 && defined GNULIB_POSIXCHECK
  206. # undef logl
  207. # define logl(x) \
  208. (GL_LINK_WARNING ("logl is unportable - " \
  209. "use gnulib module mathl for portability"), \
  210. logl (x))
  211. #endif
  212. #if 0
  213. # if 0
  214. # undef roundf
  215. # define roundf rpl_roundf
  216. extern float roundf (float x);
  217. # endif
  218. #elif defined GNULIB_POSIXCHECK
  219. # undef roundf
  220. # define roundf(x) \
  221. (GL_LINK_WARNING ("roundf is unportable - " \
  222. "use gnulib module roundf for portability"), \
  223. roundf (x))
  224. #endif
  225. #if 0
  226. # if 0
  227. # undef round
  228. # define round rpl_round
  229. extern double round (double x);
  230. # endif
  231. #elif defined GNULIB_POSIXCHECK
  232. # undef round
  233. # define round(x) \
  234. (GL_LINK_WARNING ("round is unportable - " \
  235. "use gnulib module round for portability"), \
  236. round (x))
  237. #endif
  238. #if 0
  239. # if 0
  240. # undef roundl
  241. # define roundl rpl_roundl
  242. extern long double roundl (long double x);
  243. # endif
  244. #elif defined GNULIB_POSIXCHECK
  245. # undef roundl
  246. # define roundl(x) \
  247. (GL_LINK_WARNING ("roundl is unportable - " \
  248. "use gnulib module roundl for portability"), \
  249. roundl (x))
  250. #endif
  251. #if 0 || !1
  252. extern long double sinl (long double x);
  253. #endif
  254. #if !0 && defined GNULIB_POSIXCHECK
  255. # undef sinl
  256. # define sinl(x) \
  257. (GL_LINK_WARNING ("sinl is unportable - " \
  258. "use gnulib module mathl for portability"), \
  259. sinl (x))
  260. #endif
  261. #if 0 || !1
  262. extern long double sqrtl (long double x);
  263. #endif
  264. #if !0 && defined GNULIB_POSIXCHECK
  265. # undef sqrtl
  266. # define sqrtl(x) \
  267. (GL_LINK_WARNING ("sqrtl is unportable - " \
  268. "use gnulib module mathl for portability"), \
  269. sqrtl (x))
  270. #endif
  271. #if 0 || !1
  272. extern long double tanl (long double x);
  273. #endif
  274. #if !0 && defined GNULIB_POSIXCHECK
  275. # undef tanl
  276. # define tanl(x) \
  277. (GL_LINK_WARNING ("tanl is unportable - " \
  278. "use gnulib module mathl for portability"), \
  279. tanl (x))
  280. #endif
  281. #if 0
  282. # if !1
  283. # define truncf rpl_truncf
  284. extern float truncf (float x);
  285. # endif
  286. #elif defined GNULIB_POSIXCHECK
  287. # undef truncf
  288. # define truncf(x) \
  289. (GL_LINK_WARNING ("truncf is unportable - " \
  290. "use gnulib module truncf for portability"), \
  291. truncf (x))
  292. #endif
  293. #if 0
  294. # if !1
  295. # define trunc rpl_trunc
  296. extern double trunc (double x);
  297. # endif
  298. #elif defined GNULIB_POSIXCHECK
  299. # undef trunc
  300. # define trunc(x) \
  301. (GL_LINK_WARNING ("trunc is unportable - " \
  302. "use gnulib module trunc for portability"), \
  303. trunc (x))
  304. #endif
  305. #if 0
  306. # if !1
  307. # define truncl rpl_truncl
  308. extern long double truncl (long double x);
  309. # endif
  310. #elif defined GNULIB_POSIXCHECK
  311. # undef truncl
  312. # define truncl(x) \
  313. (GL_LINK_WARNING ("truncl is unportable - " \
  314. "use gnulib module truncl for portability"), \
  315. truncl (x))
  316. #endif
  317. #if 0
  318. # if 0
  319. extern int gl_isfinitef (float x);
  320. extern int gl_isfinited (double x);
  321. extern int gl_isfinitel (long double x);
  322. # undef isfinite
  323. # define isfinite(x) \
  324. (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
  325. sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
  326. gl_isfinitef (x))
  327. # endif
  328. #elif defined GNULIB_POSIXCHECK
  329. /* How to override a macro? */
  330. #endif
  331. #if 0
  332. # if 0
  333. # undef signbit
  334. /* GCC 4.0 and newer provides three built-ins for signbit. */
  335. # define signbit(x) \
  336. (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
  337. sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
  338. __builtin_signbitf (x))
  339. # endif
  340. # if 0
  341. # undef signbit
  342. extern int gl_signbitf (float arg);
  343. extern int gl_signbitd (double arg);
  344. extern int gl_signbitl (long double arg);
  345. # if __GNUC__ >= 2 && !__STRICT_ANSI__
  346. # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT
  347. # define gl_signbitf(arg) \
  348. ({ union { float _value; \
  349. unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
  350. } _m; \
  351. _m._value = (arg); \
  352. (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \
  353. })
  354. # endif
  355. # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT
  356. # define gl_signbitd(arg) \
  357. ({ union { double _value; \
  358. unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
  359. } _m; \
  360. _m._value = (arg); \
  361. (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \
  362. })
  363. # endif
  364. # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT
  365. # define gl_signbitl(arg) \
  366. ({ union { long double _value; \
  367. unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \
  368. } _m; \
  369. _m._value = (arg); \
  370. (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \
  371. })
  372. # endif
  373. # endif
  374. # define signbit(x) \
  375. (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
  376. sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
  377. gl_signbitf (x))
  378. # endif
  379. #elif defined GNULIB_POSIXCHECK
  380. /* How to override a macro? */
  381. #endif
  382. #ifdef __cplusplus
  383. }
  384. #endif
  385. #endif /* _GL_MATH_H */
  386. #endif /* _GL_MATH_H */