root/maint/gnulib/tests/test-math-c++.cc

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. main

   1 /* Test of <math.h> substitute in C++ mode.
   2    Copyright (C) 2010-2021 Free Software Foundation, Inc.
   3 
   4    This program is free software: you can redistribute it and/or modify
   5    it under the terms of the GNU General Public License as published by
   6    the Free Software Foundation; either version 3 of the License, or
   7    (at your option) any later version.
   8 
   9    This program is distributed in the hope that it will be useful,
  10    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12    GNU General Public License for more details.
  13 
  14    You should have received a copy of the GNU General Public License
  15    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  16 
  17 /* Written by Bruno Haible <bruno@clisp.org>, 2010.  */
  18 
  19 #define GNULIB_NAMESPACE gnulib
  20 #include <config.h>
  21 
  22 #include <math.h>
  23 
  24 #include "signature.h"
  25 
  26 /* Signature check for a function that takes a real-floating argument.
  27    Check that each overloaded function with the specified signature
  28    exists in the GNULIB_NAMESPACE namespace.  */
  29 #define REAL_FLOATING_CHECK(func,\
  30                             rettype1, parameters1,\
  31                             rettype2, parameters2,\
  32                             rettype3, parameters3) \
  33   OVERLOADED_CHECK (func, rettype1, parameters1, _1); \
  34   OVERLOADED_CHECK (func, rettype2, parameters2, _2); \
  35   OVERLOADED_CHECK (func, rettype3, parameters3, _3)
  36 #define OVERLOADED_CHECK(func, rettype, parameters, suffix) \
  37   _GL_UNUSED static rettype (* signature_check_ ## func ## suffix) parameters \
  38     = static_cast<rettype(*)parameters>(GNULIB_NAMESPACE::func)
  39 
  40 
  41 /* Keep these checks in the same order as math.in.h!  */
  42 
  43 #if GNULIB_TEST_ACOSF
  44 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosf, float, (float));
  45 #endif
  46 //SIGNATURE_CHECK (GNULIB_NAMESPACE::acos, double, (double));
  47 #if GNULIB_TEST_ACOSL
  48 SIGNATURE_CHECK (GNULIB_NAMESPACE::acosl, long double, (long double));
  49 #endif
  50 
  51 #if GNULIB_TEST_ASINF
  52 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinf, float, (float));
  53 #endif
  54 //SIGNATURE_CHECK (GNULIB_NAMESPACE::asin, double, (double));
  55 #if GNULIB_TEST_ASINL
  56 SIGNATURE_CHECK (GNULIB_NAMESPACE::asinl, long double, (long double));
  57 #endif
  58 
  59 #if GNULIB_TEST_ATANF
  60 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanf, float, (float));
  61 #endif
  62 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan, double, (double));
  63 #if GNULIB_TEST_ATANL
  64 SIGNATURE_CHECK (GNULIB_NAMESPACE::atanl, long double, (long double));
  65 #endif
  66 
  67 #if GNULIB_TEST_ATAN2F
  68 SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2f, float, (float, float));
  69 #endif
  70 //SIGNATURE_CHECK (GNULIB_NAMESPACE::atan2, double, (double, double));
  71 
  72 #if GNULIB_TEST_CBRTF
  73 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtf, float, (float));
  74 #endif
  75 #if GNULIB_TEST_CBRT
  76 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrt, double, (double));
  77 #endif
  78 #if GNULIB_TEST_CBRTL
  79 SIGNATURE_CHECK (GNULIB_NAMESPACE::cbrtl, long double, (long double));
  80 #endif
  81 
  82 #if GNULIB_TEST_CEILF
  83 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceilf, float, (float));
  84 #endif
  85 #if GNULIB_TEST_CEIL
  86 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceil, double, (double));
  87 #endif
  88 #if GNULIB_TEST_CEILL
  89 SIGNATURE_CHECK (GNULIB_NAMESPACE::ceill, long double, (long double));
  90 #endif
  91 
  92 #if GNULIB_TEST_COPYSIGNF
  93 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignf, float, (float, float));
  94 #endif
  95 #if GNULIB_TEST_COPYSIGN
  96 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysign, double, (double, double));
  97 #endif
  98 #if GNULIB_TEST_COPYSIGNL
  99 SIGNATURE_CHECK (GNULIB_NAMESPACE::copysignl, long double,
 100                  (long double, long double));
 101 #endif
 102 
 103 #if GNULIB_TEST_COSF
 104 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosf, float, (float));
 105 #endif
 106 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cos, double, (double));
 107 #if GNULIB_TEST_COSL
 108 SIGNATURE_CHECK (GNULIB_NAMESPACE::cosl, long double, (long double));
 109 #endif
 110 
 111 #if GNULIB_TEST_COSHF
 112 SIGNATURE_CHECK (GNULIB_NAMESPACE::coshf, float, (float));
 113 #endif
 114 //SIGNATURE_CHECK (GNULIB_NAMESPACE::cosh, double, (double));
 115 
 116 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erf, double, (double));
 117 
 118 //SIGNATURE_CHECK (GNULIB_NAMESPACE::erfc, double, (double));
 119 
 120 #if GNULIB_TEST_EXPF
 121 SIGNATURE_CHECK (GNULIB_NAMESPACE::expf, float, (float));
 122 #endif
 123 //SIGNATURE_CHECK (GNULIB_NAMESPACE::exp, double, (double));
 124 #if GNULIB_TEST_EXPL
 125 SIGNATURE_CHECK (GNULIB_NAMESPACE::expl, long double, (long double));
 126 #endif
 127 
 128 #if GNULIB_TEST_EXP2F
 129 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2f, float, (float));
 130 #endif
 131 #if GNULIB_TEST_EXP2
 132 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2, double, (double));
 133 #endif
 134 #if GNULIB_TEST_EXP2L
 135 SIGNATURE_CHECK (GNULIB_NAMESPACE::exp2l, long double, (long double));
 136 #endif
 137 
 138 #if GNULIB_TEST_EXPM1F
 139 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1f, float, (float));
 140 #endif
 141 #if GNULIB_TEST_EXPM1
 142 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1, double, (double));
 143 #endif
 144 #if GNULIB_TEST_EXPM1L
 145 SIGNATURE_CHECK (GNULIB_NAMESPACE::expm1l, long double, (long double));
 146 #endif
 147 
 148 #if GNULIB_TEST_FABSF
 149 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsf, float, (float));
 150 #endif
 151 //SIGNATURE_CHECK (GNULIB_NAMESPACE::fabs, double, (double));
 152 #if GNULIB_TEST_FABSL
 153 SIGNATURE_CHECK (GNULIB_NAMESPACE::fabsl, long double, (long double));
 154 #endif
 155 
 156 #if GNULIB_TEST_FLOORF
 157 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorf, float, (float));
 158 #endif
 159 #if GNULIB_TEST_FLOOR
 160 SIGNATURE_CHECK (GNULIB_NAMESPACE::floor, double, (double));
 161 #endif
 162 #if GNULIB_TEST_FLOORL
 163 SIGNATURE_CHECK (GNULIB_NAMESPACE::floorl, long double, (long double));
 164 #endif
 165 
 166 #if GNULIB_TEST_FMAF
 167 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmaf, float, (float, float, float));
 168 #endif
 169 #if GNULIB_TEST_FMA
 170 SIGNATURE_CHECK (GNULIB_NAMESPACE::fma, double, (double, double, double));
 171 #endif
 172 #if GNULIB_TEST_FMAL
 173 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmal, long double,
 174                  (long double, long double, long double));
 175 #endif
 176 
 177 #if GNULIB_TEST_FMODF
 178 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodf, float, (float, float));
 179 #endif
 180 #if GNULIB_TEST_FMOD
 181 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmod, double, (double, double));
 182 #endif
 183 #if GNULIB_TEST_FMODL
 184 SIGNATURE_CHECK (GNULIB_NAMESPACE::fmodl, long double,
 185                  (long double, long double));
 186 #endif
 187 
 188 #if GNULIB_TEST_FREXPF
 189 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpf, float, (float, int *));
 190 #endif
 191 #if GNULIB_TEST_FREXP
 192 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexp, double, (double, int *));
 193 #endif
 194 #if GNULIB_TEST_FREXPL
 195 SIGNATURE_CHECK (GNULIB_NAMESPACE::frexpl, long double, (long double, int *));
 196 #endif
 197 
 198 #if GNULIB_TEST_HYPOTF
 199 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotf, float, (float, float));
 200 #endif
 201 #if GNULIB_TEST_HYPOT
 202 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypot, double, (double, double));
 203 #endif
 204 #if GNULIB_TEST_HYPOTL
 205 SIGNATURE_CHECK (GNULIB_NAMESPACE::hypotl, long double,
 206                  (long double, long double));
 207 #endif
 208 
 209 #if GNULIB_TEST_ILOGBF
 210 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbf, int, (float));
 211 #endif
 212 #if GNULIB_TEST_ILOGB
 213 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogb, int, (double));
 214 #endif
 215 #if GNULIB_TEST_ILOGBL
 216 SIGNATURE_CHECK (GNULIB_NAMESPACE::ilogbl, int, (long double));
 217 #endif
 218 
 219 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j0, double, (double));
 220 
 221 //SIGNATURE_CHECK (GNULIB_NAMESPACE::j1, double, (double));
 222 
 223 //SIGNATURE_CHECK (GNULIB_NAMESPACE::jn, double, (int, double));
 224 
 225 #if GNULIB_TEST_LDEXPF
 226 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpf, float, (float, int));
 227 #endif
 228 //SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexp, double, (double, int));
 229 #if GNULIB_TEST_LDEXPL
 230 SIGNATURE_CHECK (GNULIB_NAMESPACE::ldexpl, long double, (long double, int));
 231 #endif
 232 
 233 //SIGNATURE_CHECK (GNULIB_NAMESPACE::lgamma, double, (double));
 234 
 235 #if GNULIB_TEST_LOGF
 236 SIGNATURE_CHECK (GNULIB_NAMESPACE::logf, float, (float));
 237 #endif
 238 #if GNULIB_TEST_LOG
 239 SIGNATURE_CHECK (GNULIB_NAMESPACE::log, double, (double));
 240 #endif
 241 #if GNULIB_TEST_LOGL
 242 SIGNATURE_CHECK (GNULIB_NAMESPACE::logl, long double, (long double));
 243 #endif
 244 
 245 #if GNULIB_TEST_LOG10F
 246 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10f, float, (float));
 247 #endif
 248 #if GNULIB_TEST_LOG10
 249 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10, double, (double));
 250 #endif
 251 #if GNULIB_TEST_LOG10L
 252 SIGNATURE_CHECK (GNULIB_NAMESPACE::log10l, long double, (long double));
 253 #endif
 254 
 255 #if GNULIB_TEST_LOG1PF
 256 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pf, float, (float));
 257 #endif
 258 #if GNULIB_TEST_LOG1P
 259 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1p, double, (double));
 260 #endif
 261 #if GNULIB_TEST_LOG1PL
 262 SIGNATURE_CHECK (GNULIB_NAMESPACE::log1pl, long double, (long double));
 263 #endif
 264 
 265 #if GNULIB_TEST_LOG2F
 266 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2f, float, (float));
 267 #endif
 268 #if GNULIB_TEST_LOG2
 269 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2, double, (double));
 270 #endif
 271 #if GNULIB_TEST_LOG2L
 272 SIGNATURE_CHECK (GNULIB_NAMESPACE::log2l, long double, (long double));
 273 #endif
 274 
 275 #if GNULIB_TEST_LOGBF
 276 SIGNATURE_CHECK (GNULIB_NAMESPACE::logbf, float, (float));
 277 #endif
 278 #if GNULIB_TEST_LOGB
 279 SIGNATURE_CHECK (GNULIB_NAMESPACE::logb, double, (double));
 280 #endif
 281 #if GNULIB_TEST_LOGBL
 282 SIGNATURE_CHECK (GNULIB_NAMESPACE::logbl, long double, (long double));
 283 #endif
 284 
 285 #if GNULIB_TEST_MODFF
 286 SIGNATURE_CHECK (GNULIB_NAMESPACE::modff, float, (float, float *));
 287 #endif
 288 #if GNULIB_TEST_MODF
 289 SIGNATURE_CHECK (GNULIB_NAMESPACE::modf, double, (double, double *));
 290 #endif
 291 #if GNULIB_TEST_MODFL
 292 SIGNATURE_CHECK (GNULIB_NAMESPACE::modfl, long double,
 293                  (long double, long double *));
 294 #endif
 295 
 296 //SIGNATURE_CHECK (GNULIB_NAMESPACE::nextafter, double, (double, double));
 297 
 298 #if GNULIB_TEST_POWF
 299 SIGNATURE_CHECK (GNULIB_NAMESPACE::powf, float, (float, float));
 300 #endif
 301 //SIGNATURE_CHECK (GNULIB_NAMESPACE::pow, double, (double, double));
 302 
 303 #if GNULIB_TEST_REMAINDERF
 304 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderf, float, (float, float));
 305 #endif
 306 #if GNULIB_TEST_REMAINDER
 307 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainder, double, (double, double));
 308 #endif
 309 #if GNULIB_TEST_REMAINDERL
 310 SIGNATURE_CHECK (GNULIB_NAMESPACE::remainderl, long double,
 311                  (long double, long double));
 312 #endif
 313 
 314 #if GNULIB_TEST_RINTF
 315 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintf, float, (float));
 316 #endif
 317 #if GNULIB_TEST_RINT
 318 SIGNATURE_CHECK (GNULIB_NAMESPACE::rint, double, (double));
 319 #endif
 320 #if GNULIB_TEST_RINTL
 321 SIGNATURE_CHECK (GNULIB_NAMESPACE::rintl, long double, (long double));
 322 #endif
 323 
 324 #if GNULIB_TEST_ROUNDF
 325 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundf, float, (float));
 326 #endif
 327 #if GNULIB_TEST_ROUND
 328 SIGNATURE_CHECK (GNULIB_NAMESPACE::round, double, (double));
 329 #endif
 330 #if GNULIB_TEST_ROUNDL
 331 SIGNATURE_CHECK (GNULIB_NAMESPACE::roundl, long double, (long double));
 332 #endif
 333 
 334 #if GNULIB_TEST_SINF
 335 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinf, float, (float));
 336 #endif
 337 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sin, double, (double));
 338 #if GNULIB_TEST_SINL
 339 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinl, long double, (long double));
 340 #endif
 341 
 342 #if GNULIB_TEST_SINHF
 343 SIGNATURE_CHECK (GNULIB_NAMESPACE::sinhf, float, (float));
 344 #endif
 345 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sinh, double, (double));
 346 
 347 #if GNULIB_TEST_SQRTF
 348 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtf, float, (float));
 349 #endif
 350 //SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrt, double, (double));
 351 #if GNULIB_TEST_SQRTL
 352 SIGNATURE_CHECK (GNULIB_NAMESPACE::sqrtl, long double, (long double));
 353 #endif
 354 
 355 #if GNULIB_TEST_TANF
 356 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanf, float, (float));
 357 #endif
 358 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tan, double, (double));
 359 #if GNULIB_TEST_TANL
 360 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanl, long double, (long double));
 361 #endif
 362 
 363 #if GNULIB_TEST_TANHF
 364 SIGNATURE_CHECK (GNULIB_NAMESPACE::tanhf, float, (float));
 365 #endif
 366 //SIGNATURE_CHECK (GNULIB_NAMESPACE::tanh, double, (double));
 367 
 368 #if GNULIB_TEST_TRUNCF
 369 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncf, float, (float));
 370 #endif
 371 #if GNULIB_TEST_TRUNC
 372 SIGNATURE_CHECK (GNULIB_NAMESPACE::trunc, double, (double));
 373 #endif
 374 #if GNULIB_TEST_TRUNCL
 375 SIGNATURE_CHECK (GNULIB_NAMESPACE::truncl, long double, (long double));
 376 #endif
 377 
 378 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y0, double, (double));
 379 
 380 //SIGNATURE_CHECK (GNULIB_NAMESPACE::y1, double, (double));
 381 
 382 //SIGNATURE_CHECK (GNULIB_NAMESPACE::yn, double, (int, double));
 383 
 384 #if GNULIB_TEST_ISFINITE
 385 # ifdef isfinite
 386 #  warning "isfinite should not be a macro in C++"
 387 # endif
 388 REAL_FLOATING_CHECK (isfinite, bool, (float), bool, (double), bool, (long double));
 389 #endif
 390 
 391 #if GNULIB_TEST_ISINF
 392 # ifdef isinf
 393 #  warning "isinf should not be a macro in C++"
 394 # endif
 395 REAL_FLOATING_CHECK (isinf, bool, (float), bool, (double), bool, (long double));
 396 #endif
 397 
 398 #if GNULIB_TEST_ISNAN
 399 # ifdef isnan
 400 #  warning "isnan should not be a macro in C++"
 401 # endif
 402 REAL_FLOATING_CHECK (isnan, bool, (float), bool, (double), bool, (long double));
 403 #endif
 404 
 405 #if GNULIB_TEST_SIGNBIT
 406 # ifdef signbit
 407 #  warning "signbit should not be a macro in C++"
 408 # endif
 409 REAL_FLOATING_CHECK (signbit, bool, (float), bool, (double), bool, (long double));
 410 #endif
 411 
 412 
 413 int
 414 main ()
     /* [previous][next][first][last][top][bottom][index][help] */
 415 {
 416 }

/* [previous][next][first][last][top][bottom][index][help] */