Branch
Hash :
7b089321
Author :
Date :
2025-01-01T09:24:36
maint: run 'make update-copyright'
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876
/* A GNU-like <fenv.h>.
Copyright (C) 1997-2025 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of the
License, or (at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* Based on glibc/sysdeps/<cpu>/bits/fenv.h. */
#if __GNUC__ >= 3
@PRAGMA_SYSTEM_HEADER@
#endif
@PRAGMA_COLUMNS@
#ifndef _@GUARD_PREFIX@_FENV_H
/* The include_next requires a split double-inclusion guard. */
#if @HAVE_FENV_H@
# @INCLUDE_NEXT@ @NEXT_FENV_H@
#endif
#ifndef _@GUARD_PREFIX@_FENV_H
#define _@GUARD_PREFIX@_FENV_H
/* This file uses GNULIB_POSIXCHECK. */
#if !_GL_CONFIG_H_INCLUDED
#error "Please include config.h first."
#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
/* The definition of _GL_WARN_ON_USE is copied here. */
/* We cannot implement the #pragmas here; this needs to be done in the
compiler. */
/* ISO C 99 § 7.6.4 Environment
ISO C 23 § 7.6.6 Environment */
#if !@HAVE_FENV_H@
# if (defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86)
typedef struct
{
/* 7 32-bit words, see <https://stackoverflow.com/questions/10337750/> */
unsigned short __control_word; /* fctrl register */
unsigned short __reserved1;
unsigned short __status_word; /* fstat register */
unsigned short __reserved2;
unsigned short __tags;
unsigned short __reserved3;
unsigned int __instruction_pointer; /* eip register */
unsigned short __instruction_selector; /* cs register */
unsigned int __opcode : 11;
unsigned int __reserved4 : 5;
unsigned int __data_pointer;
unsigned short __data_selector;
unsigned short __reserved5;
# ifdef __x86_64__
unsigned int __mxcsr; /* mxcsr register */
# endif
}
fenv_t;
# elif defined __aarch64__ /* arm64 */
typedef struct
{
unsigned int __fpcr; /* fpcr register */
unsigned int __fpsr; /* fpsr register */
}
fenv_t;
# elif defined __arm__
typedef struct
{
unsigned int __cw; /* fpscr register */
}
fenv_t;
# elif defined __alpha
typedef unsigned long fenv_t;
# elif defined __hppa
typedef struct
{
unsigned int __status_word; /* floating point status register */
} fenv_t;
# elif defined __ia64__
typedef unsigned long fenv_t; /* fpsr = floating point status register */
# elif defined __m68k__
typedef struct
{
unsigned int __control_register; /* fpcr = floating point control register */
unsigned int __status_register; /* fpsr = floating point status register */
unsigned int __instruction_address; /* floating point instruction register */
}
fenv_t;
# elif defined __mips__ || defined __loongarch__
typedef struct
{
unsigned int __fp_control_register; /* floating point control and status register */
}
fenv_t;
# elif defined __powerpc__
typedef double /* yuck! */ fenv_t; /* fpscr register */
# elif defined __riscv
typedef unsigned int fenv_t; /* fcsr register */
# elif defined __s390__ || defined __s390x__
typedef struct
{
unsigned int __fpc; /* fpc = floating point control register */
}
fenv_t;
# elif defined __sh__
typedef struct
{
unsigned int __fpscr; /* fpscr register */
}
fenv_t;
# elif defined __sparc
typedef unsigned long fenv_t; /* fsr = floating point state register */
#else
/* A dummy fallback. */
typedef unsigned long fenv_t;
# endif
# define FE_DFL_ENV ((const fenv_t *) (-1))
#else
# if !HAVE_FE_DFL_ENV
# undef FE_DFL_ENV
# define FE_DFL_ENV ((const fenv_t *) (-1))
# endif
#endif
#if @GNULIB_FEGETENV@
/* Stores the thread's current floating-point environment in *ENVP and
returns zero. Upon failure, it returns non-zero. */
# if @REPLACE_FEGETENV@ || (!@HAVE_FEGETENV@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fegetenv
# define fegetenv rpl_fegetenv
# endif
_GL_FUNCDECL_RPL (fegetenv, int, (fenv_t *envp), );
_GL_CXXALIAS_RPL (fegetenv, int, (fenv_t *envp));
# else
# if !@HAVE_FEGETENV@
_GL_FUNCDECL_SYS (fegetenv, int, (fenv_t *envp), );
# endif
_GL_CXXALIAS_SYS (fegetenv, int, (fenv_t *envp));
# endif
_GL_CXXALIASWARN (fegetenv);
#endif
#if @GNULIB_FESETENV@
/* Activates the given object *ENVP as the thread's current floating-point
environment, without raising floating-point exceptions, and returns zero.
ENVP may be FE_DFL_ENV.
Upon failure, it returns non-zero. */
# if @REPLACE_FESETENV@ || (!@HAVE_FESETENV@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fesetenv
# define fesetenv rpl_fesetenv
# endif
_GL_FUNCDECL_RPL (fesetenv, int, (fenv_t const *envp), );
_GL_CXXALIAS_RPL (fesetenv, int, (fenv_t const *envp));
# else
# if !@HAVE_FESETENV@
_GL_FUNCDECL_SYS (fesetenv, int, (fenv_t const *envp), );
# endif
_GL_CXXALIAS_SYS (fesetenv, int, (fenv_t const *envp));
# endif
_GL_CXXALIASWARN (fesetenv);
#endif
#if @GNULIB_FEUPDATEENV@
/* Activates the given object *ENVP as the thread's current floating-point
environment, raising exactly those floating-point exceptions that were
raised before, and returns zero.
ENVP may be FE_DFL_ENV.
Upon failure, it returns non-zero. */
# if @REPLACE_FEUPDATEENV@ || (!@HAVE_FEUPDATEENV@ && (defined __FreeBSD__ || defined _MSC_VER)) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef feupdateenv
# define feupdateenv rpl_feupdateenv
# endif
_GL_FUNCDECL_RPL (feupdateenv, int, (fenv_t const *envp), );
_GL_CXXALIAS_RPL (feupdateenv, int, (fenv_t const *envp));
# else
# if !@HAVE_FEUPDATEENV@
_GL_FUNCDECL_SYS (feupdateenv, int, (fenv_t const *envp), );
# endif
_GL_CXXALIAS_SYS (feupdateenv, int, (fenv_t const *envp));
# endif
_GL_CXXALIASWARN (feupdateenv);
#endif
#if @GNULIB_FEHOLDEXCEPT@
/* Stores the thread's current floating-point environment in *ENVP, clears
the floating-point exception status flags, disables trapping for all
floating-point exceptions, and returns zero. Upon failure, it returns
non-zero. */
# if @REPLACE_FEHOLDEXCEPT@ || (!@HAVE_FEHOLDEXCEPT@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef feholdexcept
# define feholdexcept rpl_feholdexcept
# endif
_GL_FUNCDECL_RPL (feholdexcept, int, (fenv_t *envp), );
_GL_CXXALIAS_RPL (feholdexcept, int, (fenv_t *envp));
# else
# if !@HAVE_FEHOLDEXCEPT@
_GL_FUNCDECL_SYS (feholdexcept, int, (fenv_t *envp), );
# endif
_GL_CXXALIAS_SYS (feholdexcept, int, (fenv_t *envp));
# endif
_GL_CXXALIASWARN (feholdexcept);
#endif
/* ISO C 99 § 7.6.3 Rounding
ISO C 23 § 7.6.5 Rounding */
#if !@HAVE_FENV_H@
# if (defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86)
/* Attention: MSVC has different values for these macros! */
# define FE_TONEAREST (0 << 10)
# define FE_DOWNWARD (1 << 10)
# define FE_UPWARD (2 << 10)
# define FE_TOWARDZERO (3 << 10)
# elif defined __aarch64__ /* arm64 */
/* Attention: FreeBSD libc has these values shifted right by 22 bits! */
# define FE_TONEAREST (0 << 22)
# define FE_UPWARD (1 << 22)
# define FE_DOWNWARD (2 << 22)
# define FE_TOWARDZERO (3 << 22)
# elif defined __arm__
# define FE_TONEAREST (0 << 22)
# if !defined __SOFTFP__
# define FE_UPWARD (1 << 22)
# define FE_DOWNWARD (2 << 22)
# define FE_TOWARDZERO (3 << 22)
# endif
# elif defined __alpha
# define FE_TOWARDZERO 0
# define FE_DOWNWARD 1
# define FE_TONEAREST 2
# define FE_UPWARD 3
# elif defined __hppa
# define FE_TONEAREST (0 << 9)
# define FE_TOWARDZERO (1 << 9)
# define FE_UPWARD (2 << 9)
# define FE_DOWNWARD (3 << 9)
# elif defined __ia64__
# define FE_TONEAREST 0
# define FE_DOWNWARD 1
# define FE_UPWARD 2
# define FE_TOWARDZERO 3
# elif defined __m68k__
# define FE_TONEAREST (0 << 4)
# define FE_TOWARDZERO (1 << 4)
# define FE_DOWNWARD (2 << 4)
# define FE_UPWARD (3 << 4)
# elif defined __mips__
# define FE_TONEAREST 0
# define FE_TOWARDZERO 1
# define FE_UPWARD 2
# define FE_DOWNWARD 3
# elif defined __loongarch__
# define FE_TONEAREST (0 << 8)
# define FE_TOWARDZERO (1 << 8)
# define FE_UPWARD (2 << 8)
# define FE_DOWNWARD (3 << 8)
# elif defined __powerpc__
/* Attention: AIX has different values for these macros! */
# define FE_TONEAREST 0
# define FE_TOWARDZERO 1
# define FE_UPWARD 2
# define FE_DOWNWARD 3
# elif defined __riscv
/* Attention: FreeBSD libc has these values shifted left by 5 bits! */
# define FE_TONEAREST 0
# define FE_TOWARDZERO 1
# define FE_DOWNWARD 2
# define FE_UPWARD 3
# if 0 /* non-standard */
# define FE_TONEARESTMAXMAGNITUDE 4
# endif
# elif defined __s390__ || defined __s390x__
# define FE_TONEAREST 0
# define FE_TOWARDZERO 1
# define FE_UPWARD 2
# define FE_DOWNWARD 3
# elif defined __sh__
# define FE_TONEAREST 0
# define FE_TOWARDZERO 1
# elif defined __sparc
/* Attention: FreeBSD libc has these values shifted right by 30 bits! */
# define FE_TONEAREST (0U << 30)
# define FE_TOWARDZERO (1U << 30)
# define FE_UPWARD (2U << 30)
# define FE_DOWNWARD (3U << 30)
#else
/* A dummy fallback. */
# define FE_TONEAREST 0
# endif
#endif
#if @GNULIB_FEGETROUND@
/* Returns the current rounding direction. */
# if @REPLACE_FEGETROUND@ || (!@HAVE_FEGETROUND@ && (defined __GLIBC__ || defined __FreeBSD__)) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fegetround
# define fegetround rpl_fegetround
# endif
_GL_FUNCDECL_RPL (fegetround, int, (void), );
_GL_CXXALIAS_RPL (fegetround, int, (void));
# else
# if !@HAVE_FEGETROUND@
_GL_FUNCDECL_SYS (fegetround, int, (void), );
# endif
_GL_CXXALIAS_SYS (fegetround, int, (void));
# endif
_GL_CXXALIASWARN (fegetround);
#endif
#if @GNULIB_FESETROUND@
/* Sets the rounding direction of the current thread.
Returns zero if the argument is valid and the operation was thus successful.
Returns non-zero upon failure. */
# if @REPLACE_FESETROUND@ || (!@HAVE_FESETROUND@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fesetround
# define fesetround rpl_fesetround
# endif
_GL_FUNCDECL_RPL (fesetround, int, (int rounding_direction), );
_GL_CXXALIAS_RPL (fesetround, int, (int rounding_direction));
# else
# if !@HAVE_FESETROUND@
_GL_FUNCDECL_SYS (fesetround, int, (int rounding_direction), );
# endif
_GL_CXXALIAS_SYS (fesetround, int, (int rounding_direction));
# endif
_GL_CXXALIASWARN (fesetround);
#endif
/* ISO C 99 § 7.6.2 Floating-point exceptions
ISO C 23 § 7.6.4 Floating-point exceptions
API without fexcept_t */
#if !@HAVE_FENV_H@
# if (defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86)
/* Attention: MSVC has different values for these macros! */
# define FE_INVALID (1 << 0)
# if 0 /* non-standard */
# define FE_DENORMAL (1 << 1)
# endif
# define FE_DIVBYZERO (1 << 2)
# define FE_OVERFLOW (1 << 3)
# define FE_UNDERFLOW (1 << 4)
# define FE_INEXACT (1 << 5)
# elif defined __aarch64__ /* arm64 */ || defined __arm__
# define FE_INVALID (1U << 0)
# define FE_DIVBYZERO (1U << 1)
# define FE_OVERFLOW (1U << 2)
# define FE_UNDERFLOW (1U << 3)
# define FE_INEXACT (1U << 4)
# elif defined __alpha
/* Attention: The *BSDs have these values shifted right by 17 bits! */
# define FE_INVALID (1UL << 17)
# define FE_DIVBYZERO (1UL << 18)
# define FE_OVERFLOW (1UL << 19)
# define FE_UNDERFLOW (1UL << 20)
# define FE_INEXACT (1UL << 21)
# if 0 /* non-standard */
# define FE_DENORMAL (1UL << 22)
# endif
# elif defined __hppa
# define FE_INEXACT (1U << 0)
# define FE_UNDERFLOW (1U << 1)
# define FE_OVERFLOW (1U << 2)
# define FE_DIVBYZERO (1U << 3)
# define FE_INVALID (1U << 4)
# elif defined __ia64__
# define FE_INVALID (1UL << 0)
# if 0 /* non-standard */
# define FE_UNNORMAL (1UL << 1)
# endif
# define FE_DIVBYZERO (1UL << 2)
# define FE_OVERFLOW (1UL << 3)
# define FE_UNDERFLOW (1UL << 4)
# define FE_INEXACT (1UL << 5)
# elif defined __m68k__
# define FE_INEXACT (1U << 3)
# define FE_DIVBYZERO (1U << 4)
# define FE_UNDERFLOW (1U << 5)
# define FE_OVERFLOW (1U << 6)
# define FE_INVALID (1U << 7)
# elif defined __mips__
# define FE_INEXACT (1 << 2)
# define FE_UNDERFLOW (1 << 3)
# define FE_OVERFLOW (1 << 4)
# define FE_DIVBYZERO (1 << 5)
# define FE_INVALID (1 << 6)
# elif defined __loongarch__
# define FE_INEXACT (1U << 16)
# define FE_UNDERFLOW (1U << 17)
# define FE_OVERFLOW (1U << 18)
# define FE_DIVBYZERO (1U << 19)
# define FE_INVALID (1U << 20)
# elif defined __powerpc__
# define FE_INEXACT (1U << 25)
# define FE_DIVBYZERO (1U << 26)
# define FE_UNDERFLOW (1U << 27)
# define FE_OVERFLOW (1U << 28)
# define FE_INVALID (1U << 29)
# elif defined __riscv
# define FE_INEXACT (1U << 0)
# define FE_UNDERFLOW (1U << 1)
# define FE_OVERFLOW (1U << 2)
# define FE_DIVBYZERO (1U << 3)
# define FE_INVALID (1U << 4)
# elif defined __s390__ || defined __s390x__
/* Attention: musl libc has these values shifted left by 16 bits! */
# define FE_INEXACT (1U << 3)
# define FE_UNDERFLOW (1U << 4)
# define FE_OVERFLOW (1U << 5)
# define FE_DIVBYZERO (1U << 6)
# define FE_INVALID (1U << 7)
# elif defined __sh__
# define FE_INEXACT (1 << 2)
# define FE_UNDERFLOW (1 << 3)
# define FE_OVERFLOW (1 << 4)
# define FE_DIVBYZERO (1 << 5)
# define FE_INVALID (1 << 6)
# elif defined __sparc
/* Attention: Solaris has these values shifted right by 5 bits! */
# define FE_INEXACT (1UL << 5)
# define FE_DIVBYZERO (1UL << 6)
# define FE_UNDERFLOW (1UL << 7)
# define FE_OVERFLOW (1UL << 8)
# define FE_INVALID (1UL << 9)
# endif
# define FE_ALL_EXCEPT \
(FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
#endif
#if @GNULIB_FECLEAREXCEPT@
/* Clears the specified exception flags, and returns 0.
Upon failure, it returns non-zero. */
# if @REPLACE_FECLEAREXCEPT@ || (!@HAVE_FECLEAREXCEPT@ && (defined __GLIBC__ || defined __FreeBSD__)) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef feclearexcept
# define feclearexcept rpl_feclearexcept
# endif
_GL_FUNCDECL_RPL (feclearexcept, int, (int exceptions), );
_GL_CXXALIAS_RPL (feclearexcept, int, (int exceptions));
# else
# if !@HAVE_FECLEAREXCEPT@
_GL_FUNCDECL_SYS (feclearexcept, int, (int exceptions), );
# endif
_GL_CXXALIAS_SYS (feclearexcept, int, (int exceptions));
# endif
_GL_CXXALIASWARN (feclearexcept);
#endif
#if @GNULIB_FERAISEEXCEPT@
/* Sets the specified exception flags, triggering handlers or traps if enabled,
and returns 0. Upon failure, it returns non-zero. */
# if @REPLACE_FERAISEEXCEPT@ || (!@HAVE_FERAISEEXCEPT@ && (defined __GLIBC__ || defined __FreeBSD__ || defined _MSC_VER)) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef feraiseexcept
# define feraiseexcept rpl_feraiseexcept
# endif
_GL_FUNCDECL_RPL (feraiseexcept, int, (int exceptions), );
_GL_CXXALIAS_RPL (feraiseexcept, int, (int exceptions));
# else
# if !@HAVE_FERAISEEXCEPT@
_GL_FUNCDECL_SYS (feraiseexcept, int, (int exceptions), );
# endif
_GL_CXXALIAS_SYS (feraiseexcept, int, (int exceptions));
# endif
_GL_CXXALIASWARN (feraiseexcept);
#endif
#if @GNULIB_FETESTEXCEPT@
/* Returns a bitmask of those exception flags among EXCEPTIONS that are
currently set. */
# if @REPLACE_FETESTEXCEPT@ || (!@HAVE_FETESTEXCEPT@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fetestexcept
# define fetestexcept rpl_fetestexcept
# endif
_GL_FUNCDECL_RPL (fetestexcept, int, (int exceptions), );
_GL_CXXALIAS_RPL (fetestexcept, int, (int exceptions));
# else
# if !@HAVE_FETESTEXCEPT@
_GL_FUNCDECL_SYS (fetestexcept, int, (int exceptions), );
# endif
_GL_CXXALIAS_SYS (fetestexcept, int, (int exceptions));
# endif
_GL_CXXALIASWARN (fetestexcept);
#endif
/* Added in ISO C 23 § 7.6.4 Floating-point exceptions. */
#if @GNULIB_FESETEXCEPT@
/* Sets the specified exception flags, without triggering handlers or traps,
and returns 0. Upon failure, it returns non-zero. */
# if @REPLACE_FESETEXCEPT@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fesetexcept
# define fesetexcept rpl_fesetexcept
# endif
_GL_FUNCDECL_RPL (fesetexcept, int, (int exceptions), );
_GL_CXXALIAS_RPL (fesetexcept, int, (int exceptions));
# else
# if !@HAVE_FESETEXCEPT@
_GL_FUNCDECL_SYS (fesetexcept, int, (int exceptions), );
# endif
_GL_CXXALIAS_SYS (fesetexcept, int, (int exceptions));
# endif
_GL_CXXALIASWARN (fesetexcept);
#elif defined GNULIB_POSIXCHECK
# undef fesetexcept
# if HAVE_RAW_DECL_FESETEXCEPT
_GL_WARN_ON_USE (fesetexcept, "fesetexcept is unportable - "
"use gnulib module fenv-exceptions-tracking-c23 for portability");
# endif
#endif
/* GNU extensions. */
#if @GNULIB_FEENABLEEXCEPT@
/* Enables trapping for the floating-point exceptions denoted by the bit mask
EXCEPTIONS.
Returns the bit mask of floating-point exceptions for which trapping was
enabled before the call, or -1 upon failure.
Note: This function is a misnomer. It does not enable the specified
floating-point exceptions; it enables *trapping* on them. It should better
be called 'feenabletraps'. */
# if @REPLACE_FEENABLEEXCEPT@ || (!@HAVE_FEENABLEEXCEPT@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef feenableexcept
# define feenableexcept rpl_feenableexcept
# endif
_GL_FUNCDECL_RPL (feenableexcept, int, (int exceptions), );
_GL_CXXALIAS_RPL (feenableexcept, int, (int exceptions));
# else
# if !@HAVE_FEENABLEEXCEPT@
_GL_FUNCDECL_SYS (feenableexcept, int, (int exceptions), );
# endif
_GL_CXXALIAS_SYS (feenableexcept, int, (int exceptions));
# endif
_GL_CXXALIASWARN (feenableexcept);
#elif defined GNULIB_POSIXCHECK
# undef feenableexcept
# if HAVE_RAW_DECL_FEENABLEEXCEPT
_GL_WARN_ON_USE (feenableexcept, "feenableexcept is unportable - "
"use gnulib module fenv-exceptions-trapping for portability");
# endif
#endif
#if @GNULIB_FEDISABLEEXCEPT@
/* Disables trapping for the floating-point exceptions denoted by the bit mask
EXCEPTIONS.
Returns the bit mask of floating-point exceptions for which trapping was
enabled before the call, or -1 upon failure.
Note: This function is a misnomer. It does not disable the specified
floating-point exceptions; it disables *trapping* on them. It should better
be called 'fedisabletraps'. */
# if @REPLACE_FEDISABLEEXCEPT@ || (!@HAVE_FEDISABLEEXCEPT@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fedisableexcept
# define fedisableexcept rpl_fedisableexcept
# endif
_GL_FUNCDECL_RPL (fedisableexcept, int, (int exceptions), );
_GL_CXXALIAS_RPL (fedisableexcept, int, (int exceptions));
# else
# if !@HAVE_FEDISABLEEXCEPT@
_GL_FUNCDECL_SYS (fedisableexcept, int, (int exceptions), );
# endif
_GL_CXXALIAS_SYS (fedisableexcept, int, (int exceptions));
# endif
_GL_CXXALIASWARN (fedisableexcept);
#elif defined GNULIB_POSIXCHECK
# undef fedisableexcept
# if HAVE_RAW_DECL_FEDISABLEEXCEPT
_GL_WARN_ON_USE (fedisableexcept, "fedisableexcept is unportable - "
"use gnulib module fenv-exceptions-trapping for portability");
# endif
#endif
#if @GNULIB_FEGETEXCEPT@
/* Returns the bit mask of floating-point exceptions for which trapping is
enabled.
Note: This function is an even bigger misnomer:
- It does not test for the specified floating-point exceptions;
fetestexcept() does that. It tests whether *trapping* on these
exceptions is enabled.
- It is in no way the opposite of fesetexcept().
It should better be called 'fegettraps'. */
# if @REPLACE_FEGETEXCEPT@ || (!@HAVE_FEGETEXCEPT@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fegetexcept
# define fegetexcept rpl_fegetexcept
# endif
_GL_FUNCDECL_RPL (fegetexcept, int, (void), );
_GL_CXXALIAS_RPL (fegetexcept, int, (void));
# else
# if !@HAVE_FEGETEXCEPT@
_GL_FUNCDECL_SYS (fegetexcept, int, (void), );
# endif
_GL_CXXALIAS_SYS (fegetexcept, int, (void));
# endif
_GL_CXXALIASWARN (fegetexcept);
#elif defined GNULIB_POSIXCHECK
# undef fegetexcept
# if HAVE_RAW_DECL_FEGETEXCEPT
_GL_WARN_ON_USE (fegetexcept, "fegetexcept is unportable - "
"use gnulib module fenv-exceptions-trapping for portability");
# endif
#endif
/* ISO C 99 § 7.6.2 Floating-point exceptions
ISO C 23 § 7.6.4 Floating-point exceptions
API with fexcept_t.
The return type changed from 'void' to 'int' in ISO C 11. */
#if !@HAVE_FENV_H@
# if (defined __x86_64__ || defined _M_X64) || (defined __i386 || defined _M_IX86)
typedef unsigned short fexcept_t;
# elif defined __aarch64__ /* arm64 */ || defined __arm__
typedef unsigned int fexcept_t;
# elif defined __alpha
typedef unsigned long fexcept_t;
# elif defined __hppa
typedef unsigned int fexcept_t;
# elif defined __ia64__
typedef unsigned long fexcept_t;
# elif defined __m68k__
typedef unsigned int fexcept_t;
# elif defined __mips__
typedef unsigned short fexcept_t;
# elif defined __loongarch__
typedef unsigned int fexcept_t;
# elif defined __powerpc__
typedef unsigned int fexcept_t;
# elif defined __riscv
typedef unsigned int fexcept_t;
# elif defined __s390__ || defined __s390x__
typedef unsigned int fexcept_t;
# elif defined __sh__
typedef unsigned short fexcept_t;
# elif defined __sparc
typedef unsigned long fexcept_t;
# else
/* A dummy fallback. */
typedef unsigned long fexcept_t;
# endif
#endif
#if @GNULIB_FEGETEXCEPTFLAG@
/* Stores the current floating-point exception status flags denoted
by EXCEPTIONS in *SAVED_FLAGS. */
# if @REPLACE_FEGETEXCEPTFLAG@ || (!@HAVE_FEGETEXCEPTFLAG@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fegetexceptflag
# define fegetexceptflag rpl_fegetexceptflag
# endif
_GL_FUNCDECL_RPL (fegetexceptflag, int,
(fexcept_t *saved_flags, int exceptions), );
_GL_CXXALIAS_RPL (fegetexceptflag, int,
(fexcept_t *saved_flags, int exceptions));
# else
# if !@HAVE_FEGETEXCEPTFLAG@
_GL_FUNCDECL_SYS (fegetexceptflag, int,
(fexcept_t *saved_flags, int exceptions), );
# endif
_GL_CXXALIAS_SYS (fegetexceptflag, int,
(fexcept_t *saved_flags, int exceptions));
# endif
_GL_CXXALIASWARN (fegetexceptflag);
#endif
#if @GNULIB_FESETEXCEPTFLAG@
/* Copies the flags denoted by EXCEPTIONS from *SAVED_FLAGS to the
floating-point exception status flags. */
# if @REPLACE_FESETEXCEPTFLAG@ || (!@HAVE_FESETEXCEPTFLAG@ && defined __FreeBSD__) /* has an inline definition */
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fesetexceptflag
# define fesetexceptflag rpl_fesetexceptflag
# endif
_GL_FUNCDECL_RPL (fesetexceptflag, int,
(fexcept_t const *saved_flags, int exceptions), );
_GL_CXXALIAS_RPL (fesetexceptflag, int,
(fexcept_t const *saved_flags, int exceptions));
# else
# if !@HAVE_FESETEXCEPTFLAG@
_GL_FUNCDECL_SYS (fesetexceptflag, int,
(fexcept_t const *saved_flags, int exceptions), );
# endif
_GL_CXXALIAS_SYS (fesetexceptflag, int,
(fexcept_t const *saved_flags, int exceptions));
# endif
_GL_CXXALIASWARN (fesetexceptflag);
#endif
/* Added in ISO C 23 § 7.6.4 Floating-point exceptions. */
#if @GNULIB_FETESTEXCEPTFLAG@
/* Copies the flags denoted by EXCEPTIONS from *SAVED_FLAGS to the
floating-point exception status flags. */
# if 0
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef fetestexceptflag
# define fetestexceptflag rpl_fetestexceptflag
# endif
_GL_FUNCDECL_RPL (fetestexceptflag, int,
(fexcept_t const *saved_flags, int exceptions), );
_GL_CXXALIAS_RPL (fetestexceptflag, int,
(fexcept_t const *saved_flags, int exceptions));
# else
# if !@HAVE_FETESTEXCEPTFLAG@
_GL_FUNCDECL_SYS (fetestexceptflag, int,
(fexcept_t const *saved_flags, int exceptions), );
# endif
_GL_CXXALIAS_SYS (fetestexceptflag, int,
(fexcept_t const *saved_flags, int exceptions));
# endif
_GL_CXXALIASWARN (fetestexceptflag);
#elif defined GNULIB_POSIXCHECK
# undef fetestexceptflag
# if HAVE_RAW_DECL_FETESTEXCEPTFLAG
_GL_WARN_ON_USE (fetestexceptflag, "fetestexceptflag is unportable - "
"use gnulib module fenv-exceptions-state-c23 for portability");
# endif
#endif
#endif /* _@GUARD_PREFIX@_FENV_H */
#endif /* _@GUARD_PREFIX@_FENV_H */