math.in.h 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382
  1. /* A GNU-like <math.h>.
  2. Copyright (C) 2002-2003, 2007-2012 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_FMAF@
  457. # if @REPLACE_FMAF@
  458. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  459. # undef fmaf
  460. # define fmaf rpl_fmaf
  461. # endif
  462. _GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z));
  463. _GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
  464. # else
  465. # if !@HAVE_FMAF@
  466. _GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z));
  467. # endif
  468. _GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
  469. # endif
  470. _GL_CXXALIASWARN (fmaf);
  471. #elif defined GNULIB_POSIXCHECK
  472. # undef fmaf
  473. # if HAVE_RAW_DECL_FMAF
  474. _GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
  475. "use gnulib module fmaf for portability");
  476. # endif
  477. #endif
  478. #if @GNULIB_FMA@
  479. # if @REPLACE_FMA@
  480. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  481. # undef fma
  482. # define fma rpl_fma
  483. # endif
  484. _GL_FUNCDECL_RPL (fma, double, (double x, double y, double z));
  485. _GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
  486. # else
  487. # if !@HAVE_FMA@
  488. _GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
  489. # endif
  490. _GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
  491. # endif
  492. _GL_CXXALIASWARN (fma);
  493. #elif defined GNULIB_POSIXCHECK
  494. # undef fma
  495. # if HAVE_RAW_DECL_FMA
  496. _GL_WARN_ON_USE (fma, "fma is unportable - "
  497. "use gnulib module fma for portability");
  498. # endif
  499. #endif
  500. #if @GNULIB_FMAL@
  501. # if @REPLACE_FMAL@
  502. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  503. # undef fmal
  504. # define fmal rpl_fmal
  505. # endif
  506. _GL_FUNCDECL_RPL (fmal, long double,
  507. (long double x, long double y, long double z));
  508. _GL_CXXALIAS_RPL (fmal, long double,
  509. (long double x, long double y, long double z));
  510. # else
  511. # if !@HAVE_FMAL@
  512. _GL_FUNCDECL_SYS (fmal, long double,
  513. (long double x, long double y, long double z));
  514. # endif
  515. _GL_CXXALIAS_SYS (fmal, long double,
  516. (long double x, long double y, long double z));
  517. # endif
  518. _GL_CXXALIASWARN (fmal);
  519. #elif defined GNULIB_POSIXCHECK
  520. # undef fmal
  521. # if HAVE_RAW_DECL_FMAL
  522. _GL_WARN_ON_USE (fmal, "fmal is unportable - "
  523. "use gnulib module fmal for portability");
  524. # endif
  525. #endif
  526. #if @GNULIB_FMODF@
  527. # if !@HAVE_FMODF@
  528. # undef fmodf
  529. _GL_FUNCDECL_SYS (fmodf, float, (float x, float y));
  530. # endif
  531. _GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
  532. _GL_CXXALIASWARN (fmodf);
  533. #elif defined GNULIB_POSIXCHECK
  534. # undef fmodf
  535. # if HAVE_RAW_DECL_FMODF
  536. _GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
  537. "use gnulib module fmodf for portability");
  538. # endif
  539. #endif
  540. /* Write x as
  541. x = mantissa * 2^exp
  542. where
  543. If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
  544. If x is zero: mantissa = x, exp = 0.
  545. If x is infinite or NaN: mantissa = x, exp unspecified.
  546. Store exp in *EXPPTR and return mantissa. */
  547. #if @GNULIB_FREXPF@
  548. # if @REPLACE_FREXPF@
  549. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  550. # undef frexpf
  551. # define frexpf rpl_frexpf
  552. # endif
  553. _GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
  554. _GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr));
  555. # else
  556. # if !@HAVE_FREXPF@
  557. # undef frexpf
  558. _GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
  559. # endif
  560. _GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
  561. # endif
  562. _GL_CXXALIASWARN (frexpf);
  563. #elif defined GNULIB_POSIXCHECK
  564. # undef frexpf
  565. # if HAVE_RAW_DECL_FREXPF
  566. _GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
  567. "use gnulib module frexpf for portability");
  568. # endif
  569. #endif
  570. /* Write x as
  571. x = mantissa * 2^exp
  572. where
  573. If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
  574. If x is zero: mantissa = x, exp = 0.
  575. If x is infinite or NaN: mantissa = x, exp unspecified.
  576. Store exp in *EXPPTR and return mantissa. */
  577. #if @GNULIB_FREXP@
  578. # if @REPLACE_FREXP@
  579. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  580. # define frexp rpl_frexp
  581. # endif
  582. _GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
  583. _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
  584. # else
  585. _GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
  586. # endif
  587. _GL_CXXALIASWARN (frexp);
  588. #elif defined GNULIB_POSIXCHECK
  589. # undef frexp
  590. /* Assume frexp is always declared. */
  591. _GL_WARN_ON_USE (frexp, "frexp is unportable - "
  592. "use gnulib module frexp for portability");
  593. #endif
  594. /* Write x as
  595. x = mantissa * 2^exp
  596. where
  597. If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
  598. If x is zero: mantissa = x, exp = 0.
  599. If x is infinite or NaN: mantissa = x, exp unspecified.
  600. Store exp in *EXPPTR and return mantissa. */
  601. #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
  602. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  603. # undef frexpl
  604. # define frexpl rpl_frexpl
  605. # endif
  606. _GL_FUNCDECL_RPL (frexpl, long double,
  607. (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
  608. _GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
  609. #else
  610. # if !@HAVE_DECL_FREXPL@
  611. _GL_FUNCDECL_SYS (frexpl, long double,
  612. (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
  613. # endif
  614. # if @GNULIB_FREXPL@
  615. _GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
  616. # endif
  617. #endif
  618. #if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@)
  619. _GL_CXXALIASWARN (frexpl);
  620. #endif
  621. #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
  622. # undef frexpl
  623. # if HAVE_RAW_DECL_FREXPL
  624. _GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
  625. "use gnulib module frexpl for portability");
  626. # endif
  627. #endif
  628. /* Return x * 2^exp. */
  629. #if @GNULIB_LDEXPF@
  630. # if !@HAVE_LDEXPF@
  631. # undef ldexpf
  632. _GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp));
  633. # endif
  634. _GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
  635. _GL_CXXALIASWARN (ldexpf);
  636. #elif defined GNULIB_POSIXCHECK
  637. # undef ldexpf
  638. # if HAVE_RAW_DECL_LDEXPF
  639. _GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
  640. "use gnulib module ldexpf for portability");
  641. # endif
  642. #endif
  643. /* Return x * 2^exp. */
  644. #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
  645. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  646. # undef ldexpl
  647. # define ldexpl rpl_ldexpl
  648. # endif
  649. _GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
  650. _GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
  651. #else
  652. # if !@HAVE_DECL_LDEXPL@
  653. _GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp));
  654. # endif
  655. # if @GNULIB_LDEXPL@
  656. _GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
  657. # endif
  658. #endif
  659. #if @GNULIB_LDEXPL@
  660. _GL_CXXALIASWARN (ldexpl);
  661. #endif
  662. #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
  663. # undef ldexpl
  664. # if HAVE_RAW_DECL_LDEXPL
  665. _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
  666. "use gnulib module ldexpl for portability");
  667. # endif
  668. #endif
  669. #if @GNULIB_LOGB@
  670. # if !@HAVE_DECL_LOGB@
  671. _GL_EXTERN_C double logb (double x);
  672. # endif
  673. #elif defined GNULIB_POSIXCHECK
  674. # undef logb
  675. # if HAVE_RAW_DECL_LOGB
  676. _GL_WARN_ON_USE (logb, "logb is unportable - "
  677. "use gnulib module logb for portability");
  678. # endif
  679. #endif
  680. #if @GNULIB_LOGF@
  681. # if !@HAVE_LOGF@
  682. # undef logf
  683. _GL_FUNCDECL_SYS (logf, float, (float x));
  684. # endif
  685. _GL_CXXALIAS_SYS (logf, float, (float x));
  686. _GL_CXXALIASWARN (logf);
  687. #elif defined GNULIB_POSIXCHECK
  688. # undef logf
  689. # if HAVE_RAW_DECL_LOGF
  690. _GL_WARN_ON_USE (logf, "logf is unportable - "
  691. "use gnulib module logf for portability");
  692. # endif
  693. #endif
  694. #if @GNULIB_LOGL@
  695. # if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
  696. _GL_FUNCDECL_SYS (logl, long double, (long double x));
  697. # endif
  698. _GL_CXXALIAS_SYS (logl, long double, (long double x));
  699. _GL_CXXALIASWARN (logl);
  700. #elif defined GNULIB_POSIXCHECK
  701. # undef logl
  702. # if HAVE_RAW_DECL_LOGL
  703. _GL_WARN_ON_USE (logl, "logl is unportable - "
  704. "use gnulib module mathl for portability");
  705. # endif
  706. #endif
  707. #if @GNULIB_LOG10F@
  708. # if !@HAVE_LOG10F@
  709. # undef log10f
  710. _GL_FUNCDECL_SYS (log10f, float, (float x));
  711. # endif
  712. _GL_CXXALIAS_SYS (log10f, float, (float x));
  713. _GL_CXXALIASWARN (log10f);
  714. #elif defined GNULIB_POSIXCHECK
  715. # undef log10f
  716. # if HAVE_RAW_DECL_LOG10F
  717. _GL_WARN_ON_USE (log10f, "log10f is unportable - "
  718. "use gnulib module log10f for portability");
  719. # endif
  720. #endif
  721. #if @GNULIB_MODFF@
  722. # if !@HAVE_MODFF@
  723. # undef modff
  724. _GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
  725. # endif
  726. _GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
  727. _GL_CXXALIASWARN (modff);
  728. #elif defined GNULIB_POSIXCHECK
  729. # undef modff
  730. # if HAVE_RAW_DECL_MODFF
  731. _GL_WARN_ON_USE (modff, "modff is unportable - "
  732. "use gnulib module modff for portability");
  733. # endif
  734. #endif
  735. #if @GNULIB_POWF@
  736. # if !@HAVE_POWF@
  737. # undef powf
  738. _GL_FUNCDECL_SYS (powf, float, (float x, float y));
  739. # endif
  740. _GL_CXXALIAS_SYS (powf, float, (float x, float y));
  741. _GL_CXXALIASWARN (powf);
  742. #elif defined GNULIB_POSIXCHECK
  743. # undef powf
  744. # if HAVE_RAW_DECL_POWF
  745. _GL_WARN_ON_USE (powf, "powf is unportable - "
  746. "use gnulib module powf for portability");
  747. # endif
  748. #endif
  749. #if @GNULIB_RINTF@
  750. # if !@HAVE_RINTF@
  751. _GL_FUNCDECL_SYS (rintf, float, (float x));
  752. # endif
  753. _GL_CXXALIAS_SYS (rintf, float, (float x));
  754. _GL_CXXALIASWARN (rintf);
  755. #elif defined GNULIB_POSIXCHECK
  756. # undef rintf
  757. # if HAVE_RAW_DECL_RINTF
  758. _GL_WARN_ON_USE (rintf, "rintf is unportable - "
  759. "use gnulib module rintf for portability");
  760. # endif
  761. #endif
  762. #if @GNULIB_RINT@
  763. # if !@HAVE_RINT@
  764. _GL_FUNCDECL_SYS (rint, double, (double x));
  765. # endif
  766. _GL_CXXALIAS_SYS (rint, double, (double x));
  767. _GL_CXXALIASWARN (rint);
  768. #elif defined GNULIB_POSIXCHECK
  769. # undef rint
  770. # if HAVE_RAW_DECL_RINT
  771. _GL_WARN_ON_USE (rint, "rint is unportable - "
  772. "use gnulib module rint for portability");
  773. # endif
  774. #endif
  775. #if @GNULIB_RINTL@
  776. # if !@HAVE_RINTL@
  777. _GL_FUNCDECL_SYS (rintl, long double, (long double x));
  778. # endif
  779. _GL_CXXALIAS_SYS (rintl, long double, (long double x));
  780. _GL_CXXALIASWARN (rintl);
  781. #elif defined GNULIB_POSIXCHECK
  782. # undef rintl
  783. # if HAVE_RAW_DECL_RINTL
  784. _GL_WARN_ON_USE (rintl, "rintl is unportable - "
  785. "use gnulib module rintl for portability");
  786. # endif
  787. #endif
  788. #if @GNULIB_ROUNDF@
  789. # if @REPLACE_ROUNDF@
  790. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  791. # undef roundf
  792. # define roundf rpl_roundf
  793. # endif
  794. _GL_FUNCDECL_RPL (roundf, float, (float x));
  795. _GL_CXXALIAS_RPL (roundf, float, (float x));
  796. # else
  797. # if !@HAVE_DECL_ROUNDF@
  798. _GL_FUNCDECL_SYS (roundf, float, (float x));
  799. # endif
  800. _GL_CXXALIAS_SYS (roundf, float, (float x));
  801. # endif
  802. _GL_CXXALIASWARN (roundf);
  803. #elif defined GNULIB_POSIXCHECK
  804. # undef roundf
  805. # if HAVE_RAW_DECL_ROUNDF
  806. _GL_WARN_ON_USE (roundf, "roundf is unportable - "
  807. "use gnulib module roundf for portability");
  808. # endif
  809. #endif
  810. #if @GNULIB_ROUND@
  811. # if @REPLACE_ROUND@
  812. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  813. # undef round
  814. # define round rpl_round
  815. # endif
  816. _GL_FUNCDECL_RPL (round, double, (double x));
  817. _GL_CXXALIAS_RPL (round, double, (double x));
  818. # else
  819. # if !@HAVE_DECL_ROUND@
  820. _GL_FUNCDECL_SYS (round, double, (double x));
  821. # endif
  822. _GL_CXXALIAS_SYS (round, double, (double x));
  823. # endif
  824. _GL_CXXALIASWARN (round);
  825. #elif defined GNULIB_POSIXCHECK
  826. # undef round
  827. # if HAVE_RAW_DECL_ROUND
  828. _GL_WARN_ON_USE (round, "round is unportable - "
  829. "use gnulib module round for portability");
  830. # endif
  831. #endif
  832. #if @GNULIB_ROUNDL@
  833. # if @REPLACE_ROUNDL@
  834. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  835. # undef roundl
  836. # define roundl rpl_roundl
  837. # endif
  838. _GL_FUNCDECL_RPL (roundl, long double, (long double x));
  839. _GL_CXXALIAS_RPL (roundl, long double, (long double x));
  840. # else
  841. # if !@HAVE_DECL_ROUNDL@
  842. _GL_FUNCDECL_SYS (roundl, long double, (long double x));
  843. # endif
  844. _GL_CXXALIAS_SYS (roundl, long double, (long double x));
  845. # endif
  846. _GL_CXXALIASWARN (roundl);
  847. #elif defined GNULIB_POSIXCHECK
  848. # undef roundl
  849. # if HAVE_RAW_DECL_ROUNDL
  850. _GL_WARN_ON_USE (roundl, "roundl is unportable - "
  851. "use gnulib module roundl for portability");
  852. # endif
  853. #endif
  854. #if @GNULIB_SINF@
  855. # if !@HAVE_SINF@
  856. # undef sinf
  857. _GL_FUNCDECL_SYS (sinf, float, (float x));
  858. # endif
  859. _GL_CXXALIAS_SYS (sinf, float, (float x));
  860. _GL_CXXALIASWARN (sinf);
  861. #elif defined GNULIB_POSIXCHECK
  862. # undef sinf
  863. # if HAVE_RAW_DECL_SINF
  864. _GL_WARN_ON_USE (sinf, "sinf is unportable - "
  865. "use gnulib module sinf for portability");
  866. # endif
  867. #endif
  868. #if @GNULIB_SINL@
  869. # if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
  870. _GL_FUNCDECL_SYS (sinl, long double, (long double x));
  871. # endif
  872. _GL_CXXALIAS_SYS (sinl, long double, (long double x));
  873. _GL_CXXALIASWARN (sinl);
  874. #elif defined GNULIB_POSIXCHECK
  875. # undef sinl
  876. # if HAVE_RAW_DECL_SINL
  877. _GL_WARN_ON_USE (sinl, "sinl is unportable - "
  878. "use gnulib module mathl for portability");
  879. # endif
  880. #endif
  881. #if @GNULIB_SINHF@
  882. # if !@HAVE_SINHF@
  883. # undef sinhf
  884. _GL_FUNCDECL_SYS (sinhf, float, (float x));
  885. # endif
  886. _GL_CXXALIAS_SYS (sinhf, float, (float x));
  887. _GL_CXXALIASWARN (sinhf);
  888. #elif defined GNULIB_POSIXCHECK
  889. # undef sinhf
  890. # if HAVE_RAW_DECL_SINHF
  891. _GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
  892. "use gnulib module sinhf for portability");
  893. # endif
  894. #endif
  895. #if @GNULIB_SQRTF@
  896. # if !@HAVE_SQRTF@
  897. # undef sqrtf
  898. _GL_FUNCDECL_SYS (sqrtf, float, (float x));
  899. # endif
  900. _GL_CXXALIAS_SYS (sqrtf, float, (float x));
  901. _GL_CXXALIASWARN (sqrtf);
  902. #elif defined GNULIB_POSIXCHECK
  903. # undef sqrtf
  904. # if HAVE_RAW_DECL_SQRTF
  905. _GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
  906. "use gnulib module sqrtf for portability");
  907. # endif
  908. #endif
  909. #if @GNULIB_SQRTL@
  910. # if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
  911. _GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
  912. # endif
  913. _GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
  914. _GL_CXXALIASWARN (sqrtl);
  915. #elif defined GNULIB_POSIXCHECK
  916. # undef sqrtl
  917. # if HAVE_RAW_DECL_SQRTL
  918. _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
  919. "use gnulib module mathl for portability");
  920. # endif
  921. #endif
  922. #if @GNULIB_TANF@
  923. # if !@HAVE_TANF@
  924. # undef tanf
  925. _GL_FUNCDECL_SYS (tanf, float, (float x));
  926. # endif
  927. _GL_CXXALIAS_SYS (tanf, float, (float x));
  928. _GL_CXXALIASWARN (tanf);
  929. #elif defined GNULIB_POSIXCHECK
  930. # undef tanf
  931. # if HAVE_RAW_DECL_TANF
  932. _GL_WARN_ON_USE (tanf, "tanf is unportable - "
  933. "use gnulib module tanf for portability");
  934. # endif
  935. #endif
  936. #if @GNULIB_TANL@
  937. # if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
  938. _GL_FUNCDECL_SYS (tanl, long double, (long double x));
  939. # endif
  940. _GL_CXXALIAS_SYS (tanl, long double, (long double x));
  941. _GL_CXXALIASWARN (tanl);
  942. #elif defined GNULIB_POSIXCHECK
  943. # undef tanl
  944. # if HAVE_RAW_DECL_TANL
  945. _GL_WARN_ON_USE (tanl, "tanl is unportable - "
  946. "use gnulib module mathl for portability");
  947. # endif
  948. #endif
  949. #if @GNULIB_TANHF@
  950. # if !@HAVE_TANHF@
  951. # undef tanhf
  952. _GL_FUNCDECL_SYS (tanhf, float, (float x));
  953. # endif
  954. _GL_CXXALIAS_SYS (tanhf, float, (float x));
  955. _GL_CXXALIASWARN (tanhf);
  956. #elif defined GNULIB_POSIXCHECK
  957. # undef tanhf
  958. # if HAVE_RAW_DECL_TANHF
  959. _GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
  960. "use gnulib module tanhf for portability");
  961. # endif
  962. #endif
  963. #if @GNULIB_TRUNCF@
  964. # if @REPLACE_TRUNCF@
  965. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  966. # define truncf rpl_truncf
  967. # endif
  968. _GL_FUNCDECL_RPL (truncf, float, (float x));
  969. _GL_CXXALIAS_RPL (truncf, float, (float x));
  970. # else
  971. # if !@HAVE_DECL_TRUNCF@
  972. _GL_FUNCDECL_SYS (truncf, float, (float x));
  973. # endif
  974. _GL_CXXALIAS_SYS (truncf, float, (float x));
  975. # endif
  976. _GL_CXXALIASWARN (truncf);
  977. #elif defined GNULIB_POSIXCHECK
  978. # undef truncf
  979. # if HAVE_RAW_DECL_TRUNCF
  980. _GL_WARN_ON_USE (truncf, "truncf is unportable - "
  981. "use gnulib module truncf for portability");
  982. # endif
  983. #endif
  984. #if @GNULIB_TRUNC@
  985. # if @REPLACE_TRUNC@
  986. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  987. # define trunc rpl_trunc
  988. # endif
  989. _GL_FUNCDECL_RPL (trunc, double, (double x));
  990. _GL_CXXALIAS_RPL (trunc, double, (double x));
  991. # else
  992. # if !@HAVE_DECL_TRUNC@
  993. _GL_FUNCDECL_SYS (trunc, double, (double x));
  994. # endif
  995. _GL_CXXALIAS_SYS (trunc, double, (double x));
  996. # endif
  997. _GL_CXXALIASWARN (trunc);
  998. #elif defined GNULIB_POSIXCHECK
  999. # undef trunc
  1000. # if HAVE_RAW_DECL_TRUNC
  1001. _GL_WARN_ON_USE (trunc, "trunc is unportable - "
  1002. "use gnulib module trunc for portability");
  1003. # endif
  1004. #endif
  1005. #if @GNULIB_TRUNCL@
  1006. # if @REPLACE_TRUNCL@
  1007. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  1008. # undef truncl
  1009. # define truncl rpl_truncl
  1010. # endif
  1011. _GL_FUNCDECL_RPL (truncl, long double, (long double x));
  1012. _GL_CXXALIAS_RPL (truncl, long double, (long double x));
  1013. # else
  1014. # if !@HAVE_DECL_TRUNCL@
  1015. _GL_FUNCDECL_SYS (truncl, long double, (long double x));
  1016. # endif
  1017. _GL_CXXALIAS_SYS (truncl, long double, (long double x));
  1018. # endif
  1019. _GL_CXXALIASWARN (truncl);
  1020. #elif defined GNULIB_POSIXCHECK
  1021. # undef truncl
  1022. # if HAVE_RAW_DECL_TRUNCL
  1023. _GL_WARN_ON_USE (truncl, "truncl is unportable - "
  1024. "use gnulib module truncl for portability");
  1025. # endif
  1026. #endif
  1027. /* Definitions of function-like macros come here, after the function
  1028. declarations. */
  1029. #if @GNULIB_ISFINITE@
  1030. # if @REPLACE_ISFINITE@
  1031. _GL_EXTERN_C int gl_isfinitef (float x);
  1032. _GL_EXTERN_C int gl_isfinited (double x);
  1033. _GL_EXTERN_C int gl_isfinitel (long double x);
  1034. # undef isfinite
  1035. # define isfinite(x) \
  1036. (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
  1037. sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
  1038. gl_isfinitef (x))
  1039. # endif
  1040. # ifdef __cplusplus
  1041. # ifdef isfinite
  1042. _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
  1043. # undef isfinite
  1044. _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
  1045. # endif
  1046. # endif
  1047. #elif defined GNULIB_POSIXCHECK
  1048. # if defined isfinite
  1049. _GL_WARN_REAL_FLOATING_DECL (isfinite);
  1050. # undef isfinite
  1051. # define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
  1052. # endif
  1053. #endif
  1054. #if @GNULIB_ISINF@
  1055. # if @REPLACE_ISINF@
  1056. _GL_EXTERN_C int gl_isinff (float x);
  1057. _GL_EXTERN_C int gl_isinfd (double x);
  1058. _GL_EXTERN_C int gl_isinfl (long double x);
  1059. # undef isinf
  1060. # define isinf(x) \
  1061. (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
  1062. sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
  1063. gl_isinff (x))
  1064. # endif
  1065. # ifdef __cplusplus
  1066. # ifdef isinf
  1067. _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
  1068. # undef isinf
  1069. _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
  1070. # endif
  1071. # endif
  1072. #elif defined GNULIB_POSIXCHECK
  1073. # if defined isinf
  1074. _GL_WARN_REAL_FLOATING_DECL (isinf);
  1075. # undef isinf
  1076. # define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
  1077. # endif
  1078. #endif
  1079. #if @GNULIB_ISNANF@
  1080. /* Test for NaN for 'float' numbers. */
  1081. # if @HAVE_ISNANF@
  1082. /* The original <math.h> included above provides a declaration of isnan macro
  1083. or (older) isnanf function. */
  1084. # if __GNUC__ >= 4
  1085. /* GCC 4.0 and newer provides three built-ins for isnan. */
  1086. # undef isnanf
  1087. # define isnanf(x) __builtin_isnanf ((float)(x))
  1088. # elif defined isnan
  1089. # undef isnanf
  1090. # define isnanf(x) isnan ((float)(x))
  1091. # endif
  1092. # else
  1093. /* Test whether X is a NaN. */
  1094. # undef isnanf
  1095. # define isnanf rpl_isnanf
  1096. _GL_EXTERN_C int isnanf (float x);
  1097. # endif
  1098. #endif
  1099. #if @GNULIB_ISNAND@
  1100. /* Test for NaN for 'double' numbers.
  1101. This function is a gnulib extension, unlike isnan() which applied only
  1102. to 'double' numbers earlier but now is a type-generic macro. */
  1103. # if @HAVE_ISNAND@
  1104. /* The original <math.h> included above provides a declaration of isnan
  1105. macro. */
  1106. # if __GNUC__ >= 4
  1107. /* GCC 4.0 and newer provides three built-ins for isnan. */
  1108. # undef isnand
  1109. # define isnand(x) __builtin_isnan ((double)(x))
  1110. # else
  1111. # undef isnand
  1112. # define isnand(x) isnan ((double)(x))
  1113. # endif
  1114. # else
  1115. /* Test whether X is a NaN. */
  1116. # undef isnand
  1117. # define isnand rpl_isnand
  1118. _GL_EXTERN_C int isnand (double x);
  1119. # endif
  1120. #endif
  1121. #if @GNULIB_ISNANL@
  1122. /* Test for NaN for 'long double' numbers. */
  1123. # if @HAVE_ISNANL@
  1124. /* The original <math.h> included above provides a declaration of isnan
  1125. macro or (older) isnanl function. */
  1126. # if __GNUC__ >= 4
  1127. /* GCC 4.0 and newer provides three built-ins for isnan. */
  1128. # undef isnanl
  1129. # define isnanl(x) __builtin_isnanl ((long double)(x))
  1130. # elif defined isnan
  1131. # undef isnanl
  1132. # define isnanl(x) isnan ((long double)(x))
  1133. # endif
  1134. # else
  1135. /* Test whether X is a NaN. */
  1136. # undef isnanl
  1137. # define isnanl rpl_isnanl
  1138. _GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
  1139. # endif
  1140. #endif
  1141. /* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL! */
  1142. #if @GNULIB_ISNAN@
  1143. # if @REPLACE_ISNAN@
  1144. /* We can't just use the isnanf macro (e.g.) as exposed by
  1145. isnanf.h (e.g.) here, because those may end up being macros
  1146. that recursively expand back to isnan. So use the gnulib
  1147. replacements for them directly. */
  1148. # if @HAVE_ISNANF@ && __GNUC__ >= 4
  1149. # define gl_isnan_f(x) __builtin_isnanf ((float)(x))
  1150. # else
  1151. _GL_EXTERN_C int rpl_isnanf (float x);
  1152. # define gl_isnan_f(x) rpl_isnanf (x)
  1153. # endif
  1154. # if @HAVE_ISNAND@ && __GNUC__ >= 4
  1155. # define gl_isnan_d(x) __builtin_isnan ((double)(x))
  1156. # else
  1157. _GL_EXTERN_C int rpl_isnand (double x);
  1158. # define gl_isnan_d(x) rpl_isnand (x)
  1159. # endif
  1160. # if @HAVE_ISNANL@ && __GNUC__ >= 4
  1161. # define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
  1162. # else
  1163. _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
  1164. # define gl_isnan_l(x) rpl_isnanl (x)
  1165. # endif
  1166. # undef isnan
  1167. # define isnan(x) \
  1168. (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
  1169. sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
  1170. gl_isnan_f (x))
  1171. # elif __GNUC__ >= 4
  1172. # undef isnan
  1173. # define isnan(x) \
  1174. (sizeof (x) == sizeof (long double) ? __builtin_isnanl ((long double)(x)) : \
  1175. sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
  1176. __builtin_isnanf ((float)(x)))
  1177. # endif
  1178. # ifdef __cplusplus
  1179. # ifdef isnan
  1180. _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
  1181. # undef isnan
  1182. _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
  1183. # endif
  1184. # else
  1185. /* Ensure isnan is a macro. */
  1186. # ifndef isnan
  1187. # define isnan isnan
  1188. # endif
  1189. # endif
  1190. #elif defined GNULIB_POSIXCHECK
  1191. # if defined isnan
  1192. _GL_WARN_REAL_FLOATING_DECL (isnan);
  1193. # undef isnan
  1194. # define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
  1195. # endif
  1196. #endif
  1197. #if @GNULIB_SIGNBIT@
  1198. # if @REPLACE_SIGNBIT_USING_GCC@
  1199. # undef signbit
  1200. /* GCC 4.0 and newer provides three built-ins for signbit. */
  1201. # define signbit(x) \
  1202. (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
  1203. sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
  1204. __builtin_signbitf (x))
  1205. # endif
  1206. # if @REPLACE_SIGNBIT@
  1207. # undef signbit
  1208. _GL_EXTERN_C int gl_signbitf (float arg);
  1209. _GL_EXTERN_C int gl_signbitd (double arg);
  1210. _GL_EXTERN_C int gl_signbitl (long double arg);
  1211. # if __GNUC__ >= 2 && !defined __STRICT_ANSI__
  1212. # define _GL_NUM_UINT_WORDS(type) \
  1213. ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
  1214. # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
  1215. # define gl_signbitf_OPTIMIZED_MACRO
  1216. # define gl_signbitf(arg) \
  1217. ({ union { float _value; \
  1218. unsigned int _word[_GL_NUM_UINT_WORDS (float)]; \
  1219. } _m; \
  1220. _m._value = (arg); \
  1221. (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \
  1222. })
  1223. # endif
  1224. # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
  1225. # define gl_signbitd_OPTIMIZED_MACRO
  1226. # define gl_signbitd(arg) \
  1227. ({ union { double _value; \
  1228. unsigned int _word[_GL_NUM_UINT_WORDS (double)]; \
  1229. } _m; \
  1230. _m._value = (arg); \
  1231. (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \
  1232. })
  1233. # endif
  1234. # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl
  1235. # define gl_signbitl_OPTIMIZED_MACRO
  1236. # define gl_signbitl(arg) \
  1237. ({ union { long double _value; \
  1238. unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \
  1239. } _m; \
  1240. _m._value = (arg); \
  1241. (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \
  1242. })
  1243. # endif
  1244. # endif
  1245. # define signbit(x) \
  1246. (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
  1247. sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
  1248. gl_signbitf (x))
  1249. # endif
  1250. # ifdef __cplusplus
  1251. # ifdef signbit
  1252. _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
  1253. # undef signbit
  1254. _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
  1255. # endif
  1256. # endif
  1257. #elif defined GNULIB_POSIXCHECK
  1258. # if defined signbit
  1259. _GL_WARN_REAL_FLOATING_DECL (signbit);
  1260. # undef signbit
  1261. # define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
  1262. # endif
  1263. #endif
  1264. #endif /* _@GUARD_PREFIX@_MATH_H */
  1265. #endif /* _@GUARD_PREFIX@_MATH_H */