math.in.h 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308
  1. /* A GNU-like <math.h>.
  2. Copyright (C) 2002-2003, 2007-2011 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Lesser General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #ifndef _@GUARD_PREFIX@_MATH_H
  14. #if __GNUC__ >= 3
  15. @PRAGMA_SYSTEM_HEADER@
  16. #endif
  17. @PRAGMA_COLUMNS@
  18. /* The include_next requires a split double-inclusion guard. */
  19. #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
  20. #ifndef _@GUARD_PREFIX@_MATH_H
  21. #define _@GUARD_PREFIX@_MATH_H
  22. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  23. /* The definition of _GL_ARG_NONNULL is copied here. */
  24. /* The definition of _GL_WARN_ON_USE is copied here. */
  25. #ifdef __cplusplus
  26. /* Helper macros to define type-generic function FUNC as overloaded functions,
  27. rather than as macros like in C. POSIX declares these with an argument of
  28. real-floating (that is, one of float, double, or long double). */
  29. # define _GL_MATH_CXX_REAL_FLOATING_DECL_1(func) \
  30. static inline int \
  31. _gl_cxx_ ## func ## f (float f) \
  32. { \
  33. return func (f); \
  34. } \
  35. static inline int \
  36. _gl_cxx_ ## func ## d (double d) \
  37. { \
  38. return func (d); \
  39. } \
  40. static inline int \
  41. _gl_cxx_ ## func ## l (long double l) \
  42. { \
  43. return func (l); \
  44. }
  45. # define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \
  46. inline int \
  47. func (float f) \
  48. { \
  49. return _gl_cxx_ ## func ## f (f); \
  50. } \
  51. inline int \
  52. func (double d) \
  53. { \
  54. return _gl_cxx_ ## func ## d (d); \
  55. } \
  56. inline int \
  57. func (long double l) \
  58. { \
  59. return _gl_cxx_ ## func ## l (l); \
  60. }
  61. #endif
  62. /* Helper macros to define a portability warning for the
  63. classification macro FUNC called with VALUE. POSIX declares the
  64. classification macros with an argument of real-floating (that is,
  65. one of float, double, or long double). */
  66. #define _GL_WARN_REAL_FLOATING_DECL(func) \
  67. static inline int \
  68. rpl_ ## func ## f (float f) \
  69. { \
  70. return func (f); \
  71. } \
  72. static inline int \
  73. rpl_ ## func ## d (double d) \
  74. { \
  75. return func (d); \
  76. } \
  77. static inline int \
  78. rpl_ ## func ## l (long double l) \
  79. { \
  80. return func (l); \
  81. } \
  82. _GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - " \
  83. "use gnulib module " #func " for portability"); \
  84. _GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - " \
  85. "use gnulib module " #func " for portability"); \
  86. _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \
  87. "use gnulib module " #func " for portability")
  88. #define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
  89. (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value) \
  90. : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value) \
  91. : rpl_ ## func ## l (value))
  92. #if @REPLACE_ITOLD@
  93. /* Pull in a function that fixes the 'int' to 'long double' conversion
  94. of glibc 2.7. */
  95. _GL_EXTERN_C void _Qp_itoq (long double *, int);
  96. static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq;
  97. #endif
  98. /* POSIX allows platforms that don't support NAN. But all major
  99. machines in the past 15 years have supported something close to
  100. IEEE NaN, so we define this unconditionally. We also must define
  101. it on platforms like Solaris 10, where NAN is present but defined
  102. as a function pointer rather than a floating point constant. */
  103. #if !defined NAN || @REPLACE_NAN@
  104. # if !GNULIB_defined_NAN
  105. # undef NAN
  106. /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
  107. choke on the expression 0.0 / 0.0. */
  108. # if defined __DECC || defined _MSC_VER
  109. static float
  110. _NaN ()
  111. {
  112. static float zero = 0.0f;
  113. return zero / zero;
  114. }
  115. # define NAN (_NaN())
  116. # else
  117. # define NAN (0.0f / 0.0f)
  118. # endif
  119. # define GNULIB_defined_NAN 1
  120. # endif
  121. #endif
  122. /* Solaris 10 defines HUGE_VAL, but as a function pointer rather
  123. than a floating point constant. */
  124. #if @REPLACE_HUGE_VAL@
  125. # undef HUGE_VAL
  126. # define HUGE_VAL (1.0 / 0.0)
  127. #endif
  128. #if @GNULIB_ACOSF@
  129. # if !@HAVE_ACOSF@
  130. # undef acosf
  131. _GL_FUNCDECL_SYS (acosf, float, (float x));
  132. # endif
  133. _GL_CXXALIAS_SYS (acosf, float, (float x));
  134. _GL_CXXALIASWARN (acosf);
  135. #elif defined GNULIB_POSIXCHECK
  136. # undef acosf
  137. # if HAVE_RAW_DECL_ACOSF
  138. _GL_WARN_ON_USE (acosf, "acosf is unportable - "
  139. "use gnulib module acosf for portability");
  140. # endif
  141. #endif
  142. #if @GNULIB_ACOSL@
  143. # if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
  144. _GL_FUNCDECL_SYS (acosl, long double, (long double x));
  145. # endif
  146. _GL_CXXALIAS_SYS (acosl, long double, (long double x));
  147. _GL_CXXALIASWARN (acosl);
  148. #elif defined GNULIB_POSIXCHECK
  149. # undef acosl
  150. # if HAVE_RAW_DECL_ACOSL
  151. _GL_WARN_ON_USE (acosl, "acosl is unportable - "
  152. "use gnulib module mathl for portability");
  153. # endif
  154. #endif
  155. #if @GNULIB_ASINF@
  156. # if !@HAVE_ASINF@
  157. # undef asinf
  158. _GL_FUNCDECL_SYS (asinf, float, (float x));
  159. # endif
  160. _GL_CXXALIAS_SYS (asinf, float, (float x));
  161. _GL_CXXALIASWARN (asinf);
  162. #elif defined GNULIB_POSIXCHECK
  163. # undef asinf
  164. # if HAVE_RAW_DECL_ASINF
  165. _GL_WARN_ON_USE (asinf, "asinf is unportable - "
  166. "use gnulib module asinf for portability");
  167. # endif
  168. #endif
  169. #if @GNULIB_ASINL@
  170. # if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
  171. _GL_FUNCDECL_SYS (asinl, long double, (long double x));
  172. # endif
  173. _GL_CXXALIAS_SYS (asinl, long double, (long double x));
  174. _GL_CXXALIASWARN (asinl);
  175. #elif defined GNULIB_POSIXCHECK
  176. # undef asinl
  177. # if HAVE_RAW_DECL_ASINL
  178. _GL_WARN_ON_USE (asinl, "asinl is unportable - "
  179. "use gnulib module mathl for portability");
  180. # endif
  181. #endif
  182. #if @GNULIB_ATANF@
  183. # if !@HAVE_ATANF@
  184. # undef atanf
  185. _GL_FUNCDECL_SYS (atanf, float, (float x));
  186. # endif
  187. _GL_CXXALIAS_SYS (atanf, float, (float x));
  188. _GL_CXXALIASWARN (atanf);
  189. #elif defined GNULIB_POSIXCHECK
  190. # undef atanf
  191. # if HAVE_RAW_DECL_ATANF
  192. _GL_WARN_ON_USE (atanf, "atanf is unportable - "
  193. "use gnulib module atanf for portability");
  194. # endif
  195. #endif
  196. #if @GNULIB_ATANL@
  197. # if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
  198. _GL_FUNCDECL_SYS (atanl, long double, (long double x));
  199. # endif
  200. _GL_CXXALIAS_SYS (atanl, long double, (long double x));
  201. _GL_CXXALIASWARN (atanl);
  202. #elif defined GNULIB_POSIXCHECK
  203. # undef atanl
  204. # if HAVE_RAW_DECL_ATANL
  205. _GL_WARN_ON_USE (atanl, "atanl is unportable - "
  206. "use gnulib module mathl for portability");
  207. # endif
  208. #endif
  209. #if @GNULIB_ATAN2F@
  210. # if !@HAVE_ATAN2F@
  211. # undef atan2f
  212. _GL_FUNCDECL_SYS (atan2f, float, (float y, float x));
  213. # endif
  214. _GL_CXXALIAS_SYS (atan2f, float, (float y, float x));
  215. _GL_CXXALIASWARN (atan2f);
  216. #elif defined GNULIB_POSIXCHECK
  217. # undef atan2f
  218. # if HAVE_RAW_DECL_ATAN2F
  219. _GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
  220. "use gnulib module atan2f for portability");
  221. # endif
  222. #endif
  223. #if @GNULIB_CEILF@
  224. # if @REPLACE_CEILF@
  225. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  226. # undef ceilf
  227. # define ceilf rpl_ceilf
  228. # endif
  229. _GL_FUNCDECL_RPL (ceilf, float, (float x));
  230. _GL_CXXALIAS_RPL (ceilf, float, (float x));
  231. # else
  232. # if !@HAVE_DECL_CEILF@
  233. _GL_FUNCDECL_SYS (ceilf, float, (float x));
  234. # endif
  235. _GL_CXXALIAS_SYS (ceilf, float, (float x));
  236. # endif
  237. _GL_CXXALIASWARN (ceilf);
  238. #elif defined GNULIB_POSIXCHECK
  239. # undef ceilf
  240. # if HAVE_RAW_DECL_CEILF
  241. _GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
  242. "use gnulib module ceilf for portability");
  243. # endif
  244. #endif
  245. #if @GNULIB_CEIL@
  246. # if @REPLACE_CEIL@
  247. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  248. # define ceil rpl_ceil
  249. # endif
  250. _GL_FUNCDECL_RPL (ceil, double, (double x));
  251. _GL_CXXALIAS_RPL (ceil, double, (double x));
  252. # else
  253. _GL_CXXALIAS_SYS (ceil, double, (double x));
  254. # endif
  255. _GL_CXXALIASWARN (ceil);
  256. #endif
  257. #if @GNULIB_CEILL@
  258. # if @REPLACE_CEILL@
  259. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  260. # undef ceill
  261. # define ceill rpl_ceill
  262. # endif
  263. _GL_FUNCDECL_RPL (ceill, long double, (long double x));
  264. _GL_CXXALIAS_RPL (ceill, long double, (long double x));
  265. # else
  266. # if !@HAVE_DECL_CEILL@
  267. _GL_FUNCDECL_SYS (ceill, long double, (long double x));
  268. # endif
  269. _GL_CXXALIAS_SYS (ceill, long double, (long double x));
  270. # endif
  271. _GL_CXXALIASWARN (ceill);
  272. #elif defined GNULIB_POSIXCHECK
  273. # undef ceill
  274. # if HAVE_RAW_DECL_CEILL
  275. _GL_WARN_ON_USE (ceill, "ceill is unportable - "
  276. "use gnulib module ceill for portability");
  277. # endif
  278. #endif
  279. #if @GNULIB_COPYSIGNF@
  280. # if !@HAVE_COPYSIGNF@
  281. _GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
  282. # endif
  283. _GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
  284. _GL_CXXALIASWARN (copysignf);
  285. #elif defined GNULIB_POSIXCHECK
  286. # undef copysignf
  287. # if HAVE_RAW_DECL_COPYSIGNF
  288. _GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
  289. "use gnulib module copysignf for portability");
  290. # endif
  291. #endif
  292. #if @GNULIB_COPYSIGN@
  293. # if !@HAVE_COPYSIGN@
  294. _GL_FUNCDECL_SYS (copysign, double, (double x, double y));
  295. # endif
  296. _GL_CXXALIAS_SYS (copysign, double, (double x, double y));
  297. _GL_CXXALIASWARN (copysign);
  298. #elif defined GNULIB_POSIXCHECK
  299. # undef copysign
  300. # if HAVE_RAW_DECL_COPYSIGN
  301. _GL_WARN_ON_USE (copysign, "copysign is unportable - "
  302. "use gnulib module copysign for portability");
  303. # endif
  304. #endif
  305. #if @GNULIB_COPYSIGNL@
  306. # if !@HAVE_COPYSIGNL@
  307. _GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y));
  308. # endif
  309. _GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y));
  310. _GL_CXXALIASWARN (copysignl);
  311. #elif defined GNULIB_POSIXCHECK
  312. # undef copysignl
  313. # if HAVE_RAW_DECL_COPYSIGNL
  314. _GL_WARN_ON_USE (copysign, "copysignl is unportable - "
  315. "use gnulib module copysignl for portability");
  316. # endif
  317. #endif
  318. #if @GNULIB_COSF@
  319. # if !@HAVE_COSF@
  320. # undef cosf
  321. _GL_FUNCDECL_SYS (cosf, float, (float x));
  322. # endif
  323. _GL_CXXALIAS_SYS (cosf, float, (float x));
  324. _GL_CXXALIASWARN (cosf);
  325. #elif defined GNULIB_POSIXCHECK
  326. # undef cosf
  327. # if HAVE_RAW_DECL_COSF
  328. _GL_WARN_ON_USE (cosf, "cosf is unportable - "
  329. "use gnulib module cosf for portability");
  330. # endif
  331. #endif
  332. #if @GNULIB_COSL@
  333. # if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
  334. _GL_FUNCDECL_SYS (cosl, long double, (long double x));
  335. # endif
  336. _GL_CXXALIAS_SYS (cosl, long double, (long double x));
  337. _GL_CXXALIASWARN (cosl);
  338. #elif defined GNULIB_POSIXCHECK
  339. # undef cosl
  340. # if HAVE_RAW_DECL_COSL
  341. _GL_WARN_ON_USE (cosl, "cosl is unportable - "
  342. "use gnulib module mathl for portability");
  343. # endif
  344. #endif
  345. #if @GNULIB_COSHF@
  346. # if !@HAVE_COSHF@
  347. # undef coshf
  348. _GL_FUNCDECL_SYS (coshf, float, (float x));
  349. # endif
  350. _GL_CXXALIAS_SYS (coshf, float, (float x));
  351. _GL_CXXALIASWARN (coshf);
  352. #elif defined GNULIB_POSIXCHECK
  353. # undef coshf
  354. # if HAVE_RAW_DECL_COSHF
  355. _GL_WARN_ON_USE (coshf, "coshf is unportable - "
  356. "use gnulib module coshf for portability");
  357. # endif
  358. #endif
  359. #if @GNULIB_EXPF@
  360. # if !@HAVE_EXPF@
  361. # undef expf
  362. _GL_FUNCDECL_SYS (expf, float, (float x));
  363. # endif
  364. _GL_CXXALIAS_SYS (expf, float, (float x));
  365. _GL_CXXALIASWARN (expf);
  366. #elif defined GNULIB_POSIXCHECK
  367. # undef expf
  368. # if HAVE_RAW_DECL_EXPF
  369. _GL_WARN_ON_USE (expf, "expf is unportable - "
  370. "use gnulib module expf for portability");
  371. # endif
  372. #endif
  373. #if @GNULIB_EXPL@
  374. # if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
  375. _GL_FUNCDECL_SYS (expl, long double, (long double x));
  376. # endif
  377. _GL_CXXALIAS_SYS (expl, long double, (long double x));
  378. _GL_CXXALIASWARN (expl);
  379. #elif defined GNULIB_POSIXCHECK
  380. # undef expl
  381. # if HAVE_RAW_DECL_EXPL
  382. _GL_WARN_ON_USE (expl, "expl is unportable - "
  383. "use gnulib module mathl for portability");
  384. # endif
  385. #endif
  386. #if @GNULIB_FABSF@
  387. # if !@HAVE_FABSF@
  388. # undef fabsf
  389. _GL_FUNCDECL_SYS (fabsf, float, (float x));
  390. # endif
  391. _GL_CXXALIAS_SYS (fabsf, float, (float x));
  392. _GL_CXXALIASWARN (fabsf);
  393. #elif defined GNULIB_POSIXCHECK
  394. # undef fabsf
  395. # if HAVE_RAW_DECL_FABSF
  396. _GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
  397. "use gnulib module fabsf for portability");
  398. # endif
  399. #endif
  400. #if @GNULIB_FLOORF@
  401. # if @REPLACE_FLOORF@
  402. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  403. # undef floorf
  404. # define floorf rpl_floorf
  405. # endif
  406. _GL_FUNCDECL_RPL (floorf, float, (float x));
  407. _GL_CXXALIAS_RPL (floorf, float, (float x));
  408. # else
  409. # if !@HAVE_DECL_FLOORF@
  410. _GL_FUNCDECL_SYS (floorf, float, (float x));
  411. # endif
  412. _GL_CXXALIAS_SYS (floorf, float, (float x));
  413. # endif
  414. _GL_CXXALIASWARN (floorf);
  415. #elif defined GNULIB_POSIXCHECK
  416. # undef floorf
  417. # if HAVE_RAW_DECL_FLOORF
  418. _GL_WARN_ON_USE (floorf, "floorf is unportable - "
  419. "use gnulib module floorf for portability");
  420. # endif
  421. #endif
  422. #if @GNULIB_FLOOR@
  423. # if @REPLACE_FLOOR@
  424. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  425. # define floor rpl_floor
  426. # endif
  427. _GL_FUNCDECL_RPL (floor, double, (double x));
  428. _GL_CXXALIAS_RPL (floor, double, (double x));
  429. # else
  430. _GL_CXXALIAS_SYS (floor, double, (double x));
  431. # endif
  432. _GL_CXXALIASWARN (floor);
  433. #endif
  434. #if @GNULIB_FLOORL@
  435. # if @REPLACE_FLOORL@
  436. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  437. # undef floorl
  438. # define floorl rpl_floorl
  439. # endif
  440. _GL_FUNCDECL_RPL (floorl, long double, (long double x));
  441. _GL_CXXALIAS_RPL (floorl, long double, (long double x));
  442. # else
  443. # if !@HAVE_DECL_FLOORL@
  444. _GL_FUNCDECL_SYS (floorl, long double, (long double x));
  445. # endif
  446. _GL_CXXALIAS_SYS (floorl, long double, (long double x));
  447. # endif
  448. _GL_CXXALIASWARN (floorl);
  449. #elif defined GNULIB_POSIXCHECK
  450. # undef floorl
  451. # if HAVE_RAW_DECL_FLOORL
  452. _GL_WARN_ON_USE (floorl, "floorl is unportable - "
  453. "use gnulib module floorl for portability");
  454. # endif
  455. #endif
  456. #if @GNULIB_FMODF@
  457. # if !@HAVE_FMODF@
  458. # undef fmodf
  459. _GL_FUNCDECL_SYS (fmodf, float, (float x, float y));
  460. # endif
  461. _GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
  462. _GL_CXXALIASWARN (fmodf);
  463. #elif defined GNULIB_POSIXCHECK
  464. # undef fmodf
  465. # if HAVE_RAW_DECL_FMODF
  466. _GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
  467. "use gnulib module fmodf for portability");
  468. # endif
  469. #endif
  470. /* Write x as
  471. x = mantissa * 2^exp
  472. where
  473. If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
  474. If x is zero: mantissa = x, exp = 0.
  475. If x is infinite or NaN: mantissa = x, exp unspecified.
  476. Store exp in *EXPPTR and return mantissa. */
  477. #if @GNULIB_FREXPF@
  478. # if @REPLACE_FREXPF@
  479. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  480. # undef frexpf
  481. # define frexpf rpl_frexpf
  482. # endif
  483. _GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
  484. _GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr));
  485. # else
  486. # if !@HAVE_FREXPF@
  487. # undef frexpf
  488. _GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
  489. # endif
  490. _GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
  491. # endif
  492. _GL_CXXALIASWARN (frexpf);
  493. #elif defined GNULIB_POSIXCHECK
  494. # undef frexpf
  495. # if HAVE_RAW_DECL_FREXPF
  496. _GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
  497. "use gnulib module frexpf for portability");
  498. # endif
  499. #endif
  500. /* Write x as
  501. x = mantissa * 2^exp
  502. where
  503. If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
  504. If x is zero: mantissa = x, exp = 0.
  505. If x is infinite or NaN: mantissa = x, exp unspecified.
  506. Store exp in *EXPPTR and return mantissa. */
  507. #if @GNULIB_FREXP@
  508. # if @REPLACE_FREXP@
  509. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  510. # define frexp rpl_frexp
  511. # endif
  512. _GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
  513. _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
  514. # else
  515. _GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
  516. # endif
  517. _GL_CXXALIASWARN (frexp);
  518. #elif defined GNULIB_POSIXCHECK
  519. # undef frexp
  520. /* Assume frexp is always declared. */
  521. _GL_WARN_ON_USE (frexp, "frexp is unportable - "
  522. "use gnulib module frexp for portability");
  523. #endif
  524. /* Write x as
  525. x = mantissa * 2^exp
  526. where
  527. If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
  528. If x is zero: mantissa = x, exp = 0.
  529. If x is infinite or NaN: mantissa = x, exp unspecified.
  530. Store exp in *EXPPTR and return mantissa. */
  531. #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
  532. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  533. # undef frexpl
  534. # define frexpl rpl_frexpl
  535. # endif
  536. _GL_FUNCDECL_RPL (frexpl, long double,
  537. (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
  538. _GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
  539. #else
  540. # if !@HAVE_DECL_FREXPL@
  541. _GL_FUNCDECL_SYS (frexpl, long double,
  542. (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
  543. # endif
  544. # if @GNULIB_FREXPL@
  545. _GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
  546. # endif
  547. #endif
  548. #if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@)
  549. _GL_CXXALIASWARN (frexpl);
  550. #endif
  551. #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
  552. # undef frexpl
  553. # if HAVE_RAW_DECL_FREXPL
  554. _GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
  555. "use gnulib module frexpl for portability");
  556. # endif
  557. #endif
  558. /* Return x * 2^exp. */
  559. #if @GNULIB_LDEXPF@
  560. # if !@HAVE_LDEXPF@
  561. # undef ldexpf
  562. _GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp));
  563. # endif
  564. _GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
  565. _GL_CXXALIASWARN (ldexpf);
  566. #elif defined GNULIB_POSIXCHECK
  567. # undef ldexpf
  568. # if HAVE_RAW_DECL_LDEXPF
  569. _GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
  570. "use gnulib module ldexpf for portability");
  571. # endif
  572. #endif
  573. /* Return x * 2^exp. */
  574. #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
  575. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  576. # undef ldexpl
  577. # define ldexpl rpl_ldexpl
  578. # endif
  579. _GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
  580. _GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
  581. #else
  582. # if !@HAVE_DECL_LDEXPL@
  583. _GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp));
  584. # endif
  585. # if @GNULIB_LDEXPL@
  586. _GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
  587. # endif
  588. #endif
  589. #if @GNULIB_LDEXPL@
  590. _GL_CXXALIASWARN (ldexpl);
  591. #endif
  592. #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
  593. # undef ldexpl
  594. # if HAVE_RAW_DECL_LDEXPL
  595. _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
  596. "use gnulib module ldexpl for portability");
  597. # endif
  598. #endif
  599. #if @GNULIB_LOGB@
  600. # if !@HAVE_DECL_LOGB@
  601. _GL_EXTERN_C double logb (double x);
  602. # endif
  603. #elif defined GNULIB_POSIXCHECK
  604. # undef logb
  605. # if HAVE_RAW_DECL_LOGB
  606. _GL_WARN_ON_USE (logb, "logb is unportable - "
  607. "use gnulib module logb for portability");
  608. # endif
  609. #endif
  610. #if @GNULIB_LOGF@
  611. # if !@HAVE_LOGF@
  612. # undef logf
  613. _GL_FUNCDECL_SYS (logf, float, (float x));
  614. # endif
  615. _GL_CXXALIAS_SYS (logf, float, (float x));
  616. _GL_CXXALIASWARN (logf);
  617. #elif defined GNULIB_POSIXCHECK
  618. # undef logf
  619. # if HAVE_RAW_DECL_LOGF
  620. _GL_WARN_ON_USE (logf, "logf is unportable - "
  621. "use gnulib module logf for portability");
  622. # endif
  623. #endif
  624. #if @GNULIB_LOGL@
  625. # if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
  626. _GL_FUNCDECL_SYS (logl, long double, (long double x));
  627. # endif
  628. _GL_CXXALIAS_SYS (logl, long double, (long double x));
  629. _GL_CXXALIASWARN (logl);
  630. #elif defined GNULIB_POSIXCHECK
  631. # undef logl
  632. # if HAVE_RAW_DECL_LOGL
  633. _GL_WARN_ON_USE (logl, "logl is unportable - "
  634. "use gnulib module mathl for portability");
  635. # endif
  636. #endif
  637. #if @GNULIB_LOG10F@
  638. # if !@HAVE_LOG10F@
  639. # undef log10f
  640. _GL_FUNCDECL_SYS (log10f, float, (float x));
  641. # endif
  642. _GL_CXXALIAS_SYS (log10f, float, (float x));
  643. _GL_CXXALIASWARN (log10f);
  644. #elif defined GNULIB_POSIXCHECK
  645. # undef log10f
  646. # if HAVE_RAW_DECL_LOG10F
  647. _GL_WARN_ON_USE (log10f, "log10f is unportable - "
  648. "use gnulib module log10f for portability");
  649. # endif
  650. #endif
  651. #if @GNULIB_MODFF@
  652. # if !@HAVE_MODFF@
  653. # undef modff
  654. _GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
  655. # endif
  656. _GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
  657. _GL_CXXALIASWARN (modff);
  658. #elif defined GNULIB_POSIXCHECK
  659. # undef modff
  660. # if HAVE_RAW_DECL_MODFF
  661. _GL_WARN_ON_USE (modff, "modff is unportable - "
  662. "use gnulib module modff for portability");
  663. # endif
  664. #endif
  665. #if @GNULIB_POWF@
  666. # if !@HAVE_POWF@
  667. # undef powf
  668. _GL_FUNCDECL_SYS (powf, float, (float x, float y));
  669. # endif
  670. _GL_CXXALIAS_SYS (powf, float, (float x, float y));
  671. _GL_CXXALIASWARN (powf);
  672. #elif defined GNULIB_POSIXCHECK
  673. # undef powf
  674. # if HAVE_RAW_DECL_POWF
  675. _GL_WARN_ON_USE (powf, "powf is unportable - "
  676. "use gnulib module powf for portability");
  677. # endif
  678. #endif
  679. #if @GNULIB_RINTF@
  680. # if !@HAVE_RINTF@
  681. _GL_FUNCDECL_SYS (rintf, float, (float x));
  682. # endif
  683. _GL_CXXALIAS_SYS (rintf, float, (float x));
  684. _GL_CXXALIASWARN (rintf);
  685. #elif defined GNULIB_POSIXCHECK
  686. # undef rintf
  687. # if HAVE_RAW_DECL_RINTF
  688. _GL_WARN_ON_USE (rintf, "rintf is unportable - "
  689. "use gnulib module rintf for portability");
  690. # endif
  691. #endif
  692. #if @GNULIB_RINT@
  693. # if !@HAVE_RINT@
  694. _GL_FUNCDECL_SYS (rint, double, (double x));
  695. # endif
  696. _GL_CXXALIAS_SYS (rint, double, (double x));
  697. _GL_CXXALIASWARN (rint);
  698. #elif defined GNULIB_POSIXCHECK
  699. # undef rint
  700. # if HAVE_RAW_DECL_RINT
  701. _GL_WARN_ON_USE (rint, "rint is unportable - "
  702. "use gnulib module rint for portability");
  703. # endif
  704. #endif
  705. #if @GNULIB_RINTL@
  706. # if !@HAVE_RINTL@
  707. _GL_FUNCDECL_SYS (rintl, long double, (long double x));
  708. # endif
  709. _GL_CXXALIAS_SYS (rintl, long double, (long double x));
  710. _GL_CXXALIASWARN (rintl);
  711. #elif defined GNULIB_POSIXCHECK
  712. # undef rintl
  713. # if HAVE_RAW_DECL_RINTL
  714. _GL_WARN_ON_USE (rintl, "rintl is unportable - "
  715. "use gnulib module rintl for portability");
  716. # endif
  717. #endif
  718. #if @GNULIB_ROUNDF@
  719. # if @REPLACE_ROUNDF@
  720. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  721. # undef roundf
  722. # define roundf rpl_roundf
  723. # endif
  724. _GL_FUNCDECL_RPL (roundf, float, (float x));
  725. _GL_CXXALIAS_RPL (roundf, float, (float x));
  726. # else
  727. # if !@HAVE_DECL_ROUNDF@
  728. _GL_FUNCDECL_SYS (roundf, float, (float x));
  729. # endif
  730. _GL_CXXALIAS_SYS (roundf, float, (float x));
  731. # endif
  732. _GL_CXXALIASWARN (roundf);
  733. #elif defined GNULIB_POSIXCHECK
  734. # undef roundf
  735. # if HAVE_RAW_DECL_ROUNDF
  736. _GL_WARN_ON_USE (roundf, "roundf is unportable - "
  737. "use gnulib module roundf for portability");
  738. # endif
  739. #endif
  740. #if @GNULIB_ROUND@
  741. # if @REPLACE_ROUND@
  742. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  743. # undef round
  744. # define round rpl_round
  745. # endif
  746. _GL_FUNCDECL_RPL (round, double, (double x));
  747. _GL_CXXALIAS_RPL (round, double, (double x));
  748. # else
  749. # if !@HAVE_DECL_ROUND@
  750. _GL_FUNCDECL_SYS (round, double, (double x));
  751. # endif
  752. _GL_CXXALIAS_SYS (round, double, (double x));
  753. # endif
  754. _GL_CXXALIASWARN (round);
  755. #elif defined GNULIB_POSIXCHECK
  756. # undef round
  757. # if HAVE_RAW_DECL_ROUND
  758. _GL_WARN_ON_USE (round, "round is unportable - "
  759. "use gnulib module round for portability");
  760. # endif
  761. #endif
  762. #if @GNULIB_ROUNDL@
  763. # if @REPLACE_ROUNDL@
  764. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  765. # undef roundl
  766. # define roundl rpl_roundl
  767. # endif
  768. _GL_FUNCDECL_RPL (roundl, long double, (long double x));
  769. _GL_CXXALIAS_RPL (roundl, long double, (long double x));
  770. # else
  771. # if !@HAVE_DECL_ROUNDL@
  772. _GL_FUNCDECL_SYS (roundl, long double, (long double x));
  773. # endif
  774. _GL_CXXALIAS_SYS (roundl, long double, (long double x));
  775. # endif
  776. _GL_CXXALIASWARN (roundl);
  777. #elif defined GNULIB_POSIXCHECK
  778. # undef roundl
  779. # if HAVE_RAW_DECL_ROUNDL
  780. _GL_WARN_ON_USE (roundl, "roundl is unportable - "
  781. "use gnulib module roundl for portability");
  782. # endif
  783. #endif
  784. #if @GNULIB_SINF@
  785. # if !@HAVE_SINF@
  786. # undef sinf
  787. _GL_FUNCDECL_SYS (sinf, float, (float x));
  788. # endif
  789. _GL_CXXALIAS_SYS (sinf, float, (float x));
  790. _GL_CXXALIASWARN (sinf);
  791. #elif defined GNULIB_POSIXCHECK
  792. # undef sinf
  793. # if HAVE_RAW_DECL_SINF
  794. _GL_WARN_ON_USE (sinf, "sinf is unportable - "
  795. "use gnulib module sinf for portability");
  796. # endif
  797. #endif
  798. #if @GNULIB_SINL@
  799. # if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
  800. _GL_FUNCDECL_SYS (sinl, long double, (long double x));
  801. # endif
  802. _GL_CXXALIAS_SYS (sinl, long double, (long double x));
  803. _GL_CXXALIASWARN (sinl);
  804. #elif defined GNULIB_POSIXCHECK
  805. # undef sinl
  806. # if HAVE_RAW_DECL_SINL
  807. _GL_WARN_ON_USE (sinl, "sinl is unportable - "
  808. "use gnulib module mathl for portability");
  809. # endif
  810. #endif
  811. #if @GNULIB_SINHF@
  812. # if !@HAVE_SINHF@
  813. # undef sinhf
  814. _GL_FUNCDECL_SYS (sinhf, float, (float x));
  815. # endif
  816. _GL_CXXALIAS_SYS (sinhf, float, (float x));
  817. _GL_CXXALIASWARN (sinhf);
  818. #elif defined GNULIB_POSIXCHECK
  819. # undef sinhf
  820. # if HAVE_RAW_DECL_SINHF
  821. _GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
  822. "use gnulib module sinhf for portability");
  823. # endif
  824. #endif
  825. #if @GNULIB_SQRTF@
  826. # if !@HAVE_SQRTF@
  827. # undef sqrtf
  828. _GL_FUNCDECL_SYS (sqrtf, float, (float x));
  829. # endif
  830. _GL_CXXALIAS_SYS (sqrtf, float, (float x));
  831. _GL_CXXALIASWARN (sqrtf);
  832. #elif defined GNULIB_POSIXCHECK
  833. # undef sqrtf
  834. # if HAVE_RAW_DECL_SQRTF
  835. _GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
  836. "use gnulib module sqrtf for portability");
  837. # endif
  838. #endif
  839. #if @GNULIB_SQRTL@
  840. # if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
  841. _GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
  842. # endif
  843. _GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
  844. _GL_CXXALIASWARN (sqrtl);
  845. #elif defined GNULIB_POSIXCHECK
  846. # undef sqrtl
  847. # if HAVE_RAW_DECL_SQRTL
  848. _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
  849. "use gnulib module mathl for portability");
  850. # endif
  851. #endif
  852. #if @GNULIB_TANF@
  853. # if !@HAVE_TANF@
  854. # undef tanf
  855. _GL_FUNCDECL_SYS (tanf, float, (float x));
  856. # endif
  857. _GL_CXXALIAS_SYS (tanf, float, (float x));
  858. _GL_CXXALIASWARN (tanf);
  859. #elif defined GNULIB_POSIXCHECK
  860. # undef tanf
  861. # if HAVE_RAW_DECL_TANF
  862. _GL_WARN_ON_USE (tanf, "tanf is unportable - "
  863. "use gnulib module tanf for portability");
  864. # endif
  865. #endif
  866. #if @GNULIB_TANL@
  867. # if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
  868. _GL_FUNCDECL_SYS (tanl, long double, (long double x));
  869. # endif
  870. _GL_CXXALIAS_SYS (tanl, long double, (long double x));
  871. _GL_CXXALIASWARN (tanl);
  872. #elif defined GNULIB_POSIXCHECK
  873. # undef tanl
  874. # if HAVE_RAW_DECL_TANL
  875. _GL_WARN_ON_USE (tanl, "tanl is unportable - "
  876. "use gnulib module mathl for portability");
  877. # endif
  878. #endif
  879. #if @GNULIB_TANHF@
  880. # if !@HAVE_TANHF@
  881. # undef tanhf
  882. _GL_FUNCDECL_SYS (tanhf, float, (float x));
  883. # endif
  884. _GL_CXXALIAS_SYS (tanhf, float, (float x));
  885. _GL_CXXALIASWARN (tanhf);
  886. #elif defined GNULIB_POSIXCHECK
  887. # undef tanhf
  888. # if HAVE_RAW_DECL_TANHF
  889. _GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
  890. "use gnulib module tanhf for portability");
  891. # endif
  892. #endif
  893. #if @GNULIB_TRUNCF@
  894. # if @REPLACE_TRUNCF@
  895. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  896. # define truncf rpl_truncf
  897. # endif
  898. _GL_FUNCDECL_RPL (truncf, float, (float x));
  899. _GL_CXXALIAS_RPL (truncf, float, (float x));
  900. # else
  901. # if !@HAVE_DECL_TRUNCF@
  902. _GL_FUNCDECL_SYS (truncf, float, (float x));
  903. # endif
  904. _GL_CXXALIAS_SYS (truncf, float, (float x));
  905. # endif
  906. _GL_CXXALIASWARN (truncf);
  907. #elif defined GNULIB_POSIXCHECK
  908. # undef truncf
  909. # if HAVE_RAW_DECL_TRUNCF
  910. _GL_WARN_ON_USE (truncf, "truncf is unportable - "
  911. "use gnulib module truncf for portability");
  912. # endif
  913. #endif
  914. #if @GNULIB_TRUNC@
  915. # if @REPLACE_TRUNC@
  916. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  917. # define trunc rpl_trunc
  918. # endif
  919. _GL_FUNCDECL_RPL (trunc, double, (double x));
  920. _GL_CXXALIAS_RPL (trunc, double, (double x));
  921. # else
  922. # if !@HAVE_DECL_TRUNC@
  923. _GL_FUNCDECL_SYS (trunc, double, (double x));
  924. # endif
  925. _GL_CXXALIAS_SYS (trunc, double, (double x));
  926. # endif
  927. _GL_CXXALIASWARN (trunc);
  928. #elif defined GNULIB_POSIXCHECK
  929. # undef trunc
  930. # if HAVE_RAW_DECL_TRUNC
  931. _GL_WARN_ON_USE (trunc, "trunc is unportable - "
  932. "use gnulib module trunc for portability");
  933. # endif
  934. #endif
  935. #if @GNULIB_TRUNCL@
  936. # if @REPLACE_TRUNCL@
  937. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  938. # undef truncl
  939. # define truncl rpl_truncl
  940. # endif
  941. _GL_FUNCDECL_RPL (truncl, long double, (long double x));
  942. _GL_CXXALIAS_RPL (truncl, long double, (long double x));
  943. # else
  944. # if !@HAVE_DECL_TRUNCL@
  945. _GL_FUNCDECL_SYS (truncl, long double, (long double x));
  946. # endif
  947. _GL_CXXALIAS_SYS (truncl, long double, (long double x));
  948. # endif
  949. _GL_CXXALIASWARN (truncl);
  950. #elif defined GNULIB_POSIXCHECK
  951. # undef truncl
  952. # if HAVE_RAW_DECL_TRUNCL
  953. _GL_WARN_ON_USE (truncl, "truncl is unportable - "
  954. "use gnulib module truncl for portability");
  955. # endif
  956. #endif
  957. /* Definitions of function-like macros come here, after the function
  958. declarations. */
  959. #if @GNULIB_ISFINITE@
  960. # if @REPLACE_ISFINITE@
  961. _GL_EXTERN_C int gl_isfinitef (float x);
  962. _GL_EXTERN_C int gl_isfinited (double x);
  963. _GL_EXTERN_C int gl_isfinitel (long double x);
  964. # undef isfinite
  965. # define isfinite(x) \
  966. (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
  967. sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
  968. gl_isfinitef (x))
  969. # endif
  970. # ifdef __cplusplus
  971. # ifdef isfinite
  972. _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
  973. # undef isfinite
  974. _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
  975. # endif
  976. # endif
  977. #elif defined GNULIB_POSIXCHECK
  978. # if defined isfinite
  979. _GL_WARN_REAL_FLOATING_DECL (isfinite);
  980. # undef isfinite
  981. # define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
  982. # endif
  983. #endif
  984. #if @GNULIB_ISINF@
  985. # if @REPLACE_ISINF@
  986. _GL_EXTERN_C int gl_isinff (float x);
  987. _GL_EXTERN_C int gl_isinfd (double x);
  988. _GL_EXTERN_C int gl_isinfl (long double x);
  989. # undef isinf
  990. # define isinf(x) \
  991. (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
  992. sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
  993. gl_isinff (x))
  994. # endif
  995. # ifdef __cplusplus
  996. # ifdef isinf
  997. _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
  998. # undef isinf
  999. _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
  1000. # endif
  1001. # endif
  1002. #elif defined GNULIB_POSIXCHECK
  1003. # if defined isinf
  1004. _GL_WARN_REAL_FLOATING_DECL (isinf);
  1005. # undef isinf
  1006. # define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
  1007. # endif
  1008. #endif
  1009. #if @GNULIB_ISNANF@
  1010. /* Test for NaN for 'float' numbers. */
  1011. # if @HAVE_ISNANF@
  1012. /* The original <math.h> included above provides a declaration of isnan macro
  1013. or (older) isnanf function. */
  1014. # if __GNUC__ >= 4
  1015. /* GCC 4.0 and newer provides three built-ins for isnan. */
  1016. # undef isnanf
  1017. # define isnanf(x) __builtin_isnanf ((float)(x))
  1018. # elif defined isnan
  1019. # undef isnanf
  1020. # define isnanf(x) isnan ((float)(x))
  1021. # endif
  1022. # else
  1023. /* Test whether X is a NaN. */
  1024. # undef isnanf
  1025. # define isnanf rpl_isnanf
  1026. _GL_EXTERN_C int isnanf (float x);
  1027. # endif
  1028. #endif
  1029. #if @GNULIB_ISNAND@
  1030. /* Test for NaN for 'double' numbers.
  1031. This function is a gnulib extension, unlike isnan() which applied only
  1032. to 'double' numbers earlier but now is a type-generic macro. */
  1033. # if @HAVE_ISNAND@
  1034. /* The original <math.h> included above provides a declaration of isnan
  1035. macro. */
  1036. # if __GNUC__ >= 4
  1037. /* GCC 4.0 and newer provides three built-ins for isnan. */
  1038. # undef isnand
  1039. # define isnand(x) __builtin_isnan ((double)(x))
  1040. # else
  1041. # undef isnand
  1042. # define isnand(x) isnan ((double)(x))
  1043. # endif
  1044. # else
  1045. /* Test whether X is a NaN. */
  1046. # undef isnand
  1047. # define isnand rpl_isnand
  1048. _GL_EXTERN_C int isnand (double x);
  1049. # endif
  1050. #endif
  1051. #if @GNULIB_ISNANL@
  1052. /* Test for NaN for 'long double' numbers. */
  1053. # if @HAVE_ISNANL@
  1054. /* The original <math.h> included above provides a declaration of isnan
  1055. macro or (older) isnanl function. */
  1056. # if __GNUC__ >= 4
  1057. /* GCC 4.0 and newer provides three built-ins for isnan. */
  1058. # undef isnanl
  1059. # define isnanl(x) __builtin_isnanl ((long double)(x))
  1060. # elif defined isnan
  1061. # undef isnanl
  1062. # define isnanl(x) isnan ((long double)(x))
  1063. # endif
  1064. # else
  1065. /* Test whether X is a NaN. */
  1066. # undef isnanl
  1067. # define isnanl rpl_isnanl
  1068. _GL_EXTERN_C int isnanl (long double x);
  1069. # endif
  1070. #endif
  1071. /* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL! */
  1072. #if @GNULIB_ISNAN@
  1073. # if @REPLACE_ISNAN@
  1074. /* We can't just use the isnanf macro (e.g.) as exposed by
  1075. isnanf.h (e.g.) here, because those may end up being macros
  1076. that recursively expand back to isnan. So use the gnulib
  1077. replacements for them directly. */
  1078. # if @HAVE_ISNANF@ && __GNUC__ >= 4
  1079. # define gl_isnan_f(x) __builtin_isnanf ((float)(x))
  1080. # else
  1081. _GL_EXTERN_C int rpl_isnanf (float x);
  1082. # define gl_isnan_f(x) rpl_isnanf (x)
  1083. # endif
  1084. # if @HAVE_ISNAND@ && __GNUC__ >= 4
  1085. # define gl_isnan_d(x) __builtin_isnan ((double)(x))
  1086. # else
  1087. _GL_EXTERN_C int rpl_isnand (double x);
  1088. # define gl_isnan_d(x) rpl_isnand (x)
  1089. # endif
  1090. # if @HAVE_ISNANL@ && __GNUC__ >= 4
  1091. # define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
  1092. # else
  1093. _GL_EXTERN_C int rpl_isnanl (long double x);
  1094. # define gl_isnan_l(x) rpl_isnanl (x)
  1095. # endif
  1096. # undef isnan
  1097. # define isnan(x) \
  1098. (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
  1099. sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
  1100. gl_isnan_f (x))
  1101. # elif __GNUC__ >= 4
  1102. # undef isnan
  1103. # define isnan(x) \
  1104. (sizeof (x) == sizeof (long double) ? __builtin_isnanl ((long double)(x)) : \
  1105. sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
  1106. __builtin_isnanf ((float)(x)))
  1107. # endif
  1108. # ifdef __cplusplus
  1109. # ifdef isnan
  1110. _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
  1111. # undef isnan
  1112. _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
  1113. # endif
  1114. # else
  1115. /* Ensure isnan is a macro. */
  1116. # ifndef isnan
  1117. # define isnan isnan
  1118. # endif
  1119. # endif
  1120. #elif defined GNULIB_POSIXCHECK
  1121. # if defined isnan
  1122. _GL_WARN_REAL_FLOATING_DECL (isnan);
  1123. # undef isnan
  1124. # define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
  1125. # endif
  1126. #endif
  1127. #if @GNULIB_SIGNBIT@
  1128. # if @REPLACE_SIGNBIT_USING_GCC@
  1129. # undef signbit
  1130. /* GCC 4.0 and newer provides three built-ins for signbit. */
  1131. # define signbit(x) \
  1132. (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
  1133. sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
  1134. __builtin_signbitf (x))
  1135. # endif
  1136. # if @REPLACE_SIGNBIT@
  1137. # undef signbit
  1138. _GL_EXTERN_C int gl_signbitf (float arg);
  1139. _GL_EXTERN_C int gl_signbitd (double arg);
  1140. _GL_EXTERN_C int gl_signbitl (long double arg);
  1141. # if __GNUC__ >= 2 && !defined __STRICT_ANSI__
  1142. # define _GL_NUM_UINT_WORDS(type) \
  1143. ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
  1144. # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
  1145. # define gl_signbitf_OPTIMIZED_MACRO
  1146. # define gl_signbitf(arg) \
  1147. ({ union { float _value; \
  1148. unsigned int _word[_GL_NUM_UINT_WORDS (float)]; \
  1149. } _m; \
  1150. _m._value = (arg); \
  1151. (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \
  1152. })
  1153. # endif
  1154. # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
  1155. # define gl_signbitd_OPTIMIZED_MACRO
  1156. # define gl_signbitd(arg) \
  1157. ({ union { double _value; \
  1158. unsigned int _word[_GL_NUM_UINT_WORDS (double)]; \
  1159. } _m; \
  1160. _m._value = (arg); \
  1161. (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \
  1162. })
  1163. # endif
  1164. # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl
  1165. # define gl_signbitl_OPTIMIZED_MACRO
  1166. # define gl_signbitl(arg) \
  1167. ({ union { long double _value; \
  1168. unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \
  1169. } _m; \
  1170. _m._value = (arg); \
  1171. (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \
  1172. })
  1173. # endif
  1174. # endif
  1175. # define signbit(x) \
  1176. (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
  1177. sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
  1178. gl_signbitf (x))
  1179. # endif
  1180. # ifdef __cplusplus
  1181. # ifdef signbit
  1182. _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
  1183. # undef signbit
  1184. _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
  1185. # endif
  1186. # endif
  1187. #elif defined GNULIB_POSIXCHECK
  1188. # if defined signbit
  1189. _GL_WARN_REAL_FLOATING_DECL (signbit);
  1190. # undef signbit
  1191. # define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
  1192. # endif
  1193. #endif
  1194. #endif /* _@GUARD_PREFIX@_MATH_H */
  1195. #endif /* _@GUARD_PREFIX@_MATH_H */