[
  {
    "sourcePath": "LICENSE.txt",
    "sha256": "ab6eec6caf0fa5775e411c7a8bc6a45c4ef2956b0980b157ab74fc5cd62a928b",
    "text": "The compiler-builtins crate is available for use under both the MIT license\nand the Apache-2.0 license with the LLVM exception (MIT AND Apache-2.0 WITH\nLLVM-exception).\n\nThe libm crate is available for use under the MIT license.\n\nAs a contributor, you agree that your code may be used under any of the\nfollowing: the MIT license, the Apache-2.0 license, or the Apache-2.0 license\nwith the LLVM exception. In other words, original (non-derivative) work is\nlicensed under MIT OR Apache-2.0 OR Apache-2.0 WITH LLVM-exception. This is\nthe default license for all other source in this repository.\n\nText of the relevant licenses is provided below:\n\n------------------------------------------------------------------------------\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n------------------------------------------------------------------------------\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n    1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n    2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n    3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n    4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n    5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n    6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n    7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n    8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n    9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n    END OF TERMS AND CONDITIONS\n\n    APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n\n---- LLVM Exceptions to the Apache 2.0 License ----\n\nAs an exception, if, as a result of your compiling your source code, portions\nof this Software are embedded into an Object form of such source code, you\nmay redistribute such embedded portions in such Object form without complying\nwith the conditions of Sections 4(a), 4(b) and 4(d) of the License.\n\nIn addition, if you combine or link compiled forms of this Software with\nsoftware that is licensed under the GPLv2 (\"Combined Software\") and if a\ncourt of competent jurisdiction determines that the patent provision (Section\n3), the indemnity provision (Section 9) or other Section of the License\nconflicts with the conditions of the GPLv2, you may retroactively and\nprospectively choose to deem waived or otherwise exclude such Section(s) of\nthe License, but only in their entirety and only with respect to the Combined\nSoftware.\n------------------------------------------------------------------------------\n\nPortions of this software are derived from third-party works licensed under\nterms compatible with the above Apache-2.0 WITH LLVM-exception AND MIT\nlicense:\n\n* compiler-builtins is derived from LLVM's compiler-rt (https://llvm.org/).\n  Work derived from compiler-rt prior to 2019-01-19 is usable under the MIT\n  license, with the following copyright:\n\n      Copyright (c) 2009-2016 by the contributors listed in CREDITS.TXT\n\n  The relevant CREDITS.TXT is located at\n  https://github.com/llvm/llvm-project/blob/main/compiler-rt/CREDITS.TXT.\n\n* Work derived from compiler-rt after 2019-01-19 is usable under the\n  Apache-2.0 license with the LLVM exception.\n\n* The bundled `math` module is from the libm crate, usable under the MIT\n  license. For further details and copyrights, see see libm/LICENSE.txt at\n  https://github.com/rust-lang/compiler-builtins.\n\nAdditionally, some source files may contain comments with specific copyrights\nor licenses.\n"
  },
  {
    "sourcePath": "README.md",
    "sha256": "211afdc20ec0b017731fc5c972db678320689f054c414d38b312f31fde3da60d",
    "text": "# `compiler-builtins`\n\nThis crate provides external symbols that the compiler expects to be available\nwhen building Rust projects, typically software routines for basic operations\nthat do not have hardware support. It is largely a port of LLVM's\n[`compiler-rt`].\n\nIt is distributed as part of Rust's sysroot. `compiler-builtins` does not need\nto be added as an explicit dependency in `Cargo.toml`.\n\n[`compiler-rt`]: https://github.com/llvm/llvm-project/tree/1b1dc505057322f4fa1110ef4f53c44347f52986/compiler-rt\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Progress\n\n- [x] aarch64/chkstk.S\n- [x] adddf3.c\n- [x] addsf3.c\n- [x] arm/addsf3.S\n- [x] arm/aeabi_dcmp.S\n- [x] arm/aeabi_fcmp.S\n- [x] arm/aeabi_idivmod.S\n- [x] arm/aeabi_ldivmod.S\n- [x] arm/aeabi_memcpy.S\n- [x] arm/aeabi_memmove.S\n- [x] arm/aeabi_memset.S\n- [x] arm/aeabi_uidivmod.S\n- [x] arm/aeabi_uldivmod.S\n- [ ] arm/chkstk.S\n- [ ] arm/divmodsi4.S (generic version is done)\n- [ ] arm/divsi3.S (generic version is done)\n- [ ] arm/modsi3.S (generic version is done)\n- [x] arm/softfloat-alias.list\n- [ ] arm/udivmodsi4.S (generic version is done)\n- [ ] arm/udivsi3.S (generic version is done)\n- [ ] arm/umodsi3.S (generic version is done)\n- [x] ashldi3.c\n- [x] ashrdi3.c\n- [ ] avr/divmodhi4.S\n- [ ] avr/divmodqi4.S\n- [ ] avr/mulhi3.S\n- [ ] avr/mulqi3.S\n- [ ] avr/udivmodhi4.S\n- [ ] avr/udivmodqi4.S\n- [x] bswapdi2.c\n- [x] bswapsi2.c\n- [x] bswapti2.c\n- [x] clzdi2.c\n- [x] clzsi2.c\n- [x] clzti2.c\n- [x] comparedf2.c\n- [x] comparesf2.c\n- [x] ctzdi2.c\n- [x] ctzsi2.c\n- [x] ctzti2.c\n- [x] divdf3.c\n- [x] divdi3.c\n- [x] divmoddi4.c\n- [x] divmodsi4.c\n- [x] divmodti4.c\n- [x] divsf3.c\n- [x] divsi3.c\n- [x] extendsfdf2.c\n- [x] fixdfdi.c\n- [x] fixdfsi.c\n- [x] fixsfdi.c\n- [x] fixsfsi.c\n- [x] fixunsdfdi.c\n- [x] fixunsdfsi.c\n- [x] fixunssfdi.c\n- [x] fixunssfsi.c\n- [x] floatdidf.c\n- [x] floatdisf.c\n- [x] floatsidf.c\n- [x] floatsisf.c\n- [x] floatundidf.c\n- [x] floatundisf.c\n- [x] floatunsidf.c\n- [x] floatunsisf.c\n- [ ] i386/ashldi3.S\n- [ ] i386/ashrdi3.S\n- [x] i386/chkstk.S\n- [ ] i386/divdi3.S\n- [ ] i386/lshrdi3.S\n- [ ] i386/moddi3.S\n- [ ] i386/muldi3.S\n- [ ] i386/udivdi3.S\n- [ ] i386/umoddi3.S\n- [x] lshrdi3.c\n- [x] moddi3.c\n- [x] modsi3.c\n- [x] muldf3.c\n- [x] muldi3.c\n- [x] mulodi4.c\n- [x] mulosi4.c\n- [x] mulsf3.c\n- [x] powidf2.c\n- [x] powisf2.c\n- [ ] riscv/muldi3.S\n- [ ] riscv/mulsi3.S\n- [x] subdf3.c\n- [x] subsf3.c\n- [x] truncdfsf2.c\n- [x] udivdi3.c\n- [x] udivmoddi4.c\n- [x] udivmodsi4.c\n- [x] udivsi3.c\n- [x] umoddi3.c\n- [x] umodsi3.c\n- [x] x86_64/chkstk.S\n\nThese builtins are needed to support 128-bit integers.\n\n- [x] ashlti3.c\n- [x] ashrti3.c\n- [x] divti3.c\n- [x] fixdfti.c\n- [x] fixsfti.c\n- [x] fixunsdfti.c\n- [x] fixunssfti.c\n- [x] floattidf.c\n- [x] floattisf.c\n- [x] floatuntidf.c\n- [x] floatuntisf.c\n- [x] lshrti3.c\n- [x] modti3.c\n- [x] muloti4.c\n- [x] multi3.c\n- [x] udivmodti4.c\n- [x] udivti3.c\n- [x] umodti3.c\n\nThese builtins are needed to support `f16` and `f128`, which are in the process\nof being added to Rust.\n\n- [x] addtf3.c\n- [x] comparetf2.c\n- [x] divtf3.c\n- [x] extenddftf2.c\n- [x] extendhfsf2.c\n- [x] extendhftf2.c\n- [x] extendsftf2.c\n- [x] fixtfdi.c\n- [x] fixtfsi.c\n- [x] fixtfti.c\n- [x] fixunstfdi.c\n- [x] fixunstfsi.c\n- [x] fixunstfti.c\n- [x] floatditf.c\n- [x] floatsitf.c\n- [x] floattitf.c\n- [x] floatunditf.c\n- [x] floatunsitf.c\n- [x] floatuntitf.c\n- [x] multf3.c\n- [x] powitf2.c\n- [x] subtf3.c\n- [x] truncdfhf2.c\n- [x] truncsfhf2.c\n- [x] trunctfdf2.c\n- [x] trunctfhf2.c\n- [x] trunctfsf2.c\n\n\nThese builtins are used by the Hexagon DSP\n\n- [ ] hexagon/common_entry_exit_abi1.S\n- [ ] hexagon/common_entry_exit_abi2.S\n- [ ] hexagon/common_entry_exit_legacy.S\n- [x] hexagon/dfaddsub.S~~\n- [x] hexagon/dfdiv.S~~\n- [x] hexagon/dffma.S~~\n- [x] hexagon/dfminmax.S~~\n- [x] hexagon/dfmul.S~~\n- [x] hexagon/dfsqrt.S~~\n- [x] hexagon/divdi3.S~~\n- [x] hexagon/divsi3.S~~\n- [x] hexagon/fastmath2_dlib_asm.S~~\n- [x] hexagon/fastmath2_ldlib_asm.S~~\n- [x] hexagon/fastmath_dlib_asm.S~~\n- [x] hexagon/memcpy_forward_vp4cp4n2.S~~\n- [x] hexagon/memcpy_likely_aligned.S~~\n- [x] hexagon/moddi3.S~~\n- [x] hexagon/modsi3.S~~\n- [x] hexagon/sfdiv_opt.S~~\n- [x] hexagon/sfsqrt_opt.S~~\n- [x] hexagon/udivdi3.S~~\n- [x] hexagon/udivmoddi4.S~~\n- [x] hexagon/udivmodsi4.S~~\n- [x] hexagon/udivsi3.S~~\n- [x] hexagon/umoddi3.S~~\n- [x] hexagon/umodsi3.S~~\n\n## Unimplemented functions\n\nThese builtins are for x87 `f80` floating-point numbers that are not supported\nby Rust.\n\n- ~~extendxftf2.c~~\n- ~~fixunsxfdi.c~~\n- ~~fixunsxfsi.c~~\n- ~~fixunsxfti.c~~\n- ~~fixxfdi.c~~\n- ~~fixxfti.c~~\n- ~~floatdixf.c~~\n- ~~floattixf.c~~\n- ~~floatundixf.c~~\n- ~~floatuntixf.c~~\n- ~~i386/floatdixf.S~~\n- ~~i386/floatundixf.S~~\n- ~~x86_64/floatdixf.c~~\n- ~~x86_64/floatundixf.S~~\n\nThese builtins are for IBM \"extended double\" non-IEEE 128-bit floating-point\nnumbers.\n\n- ~~ppc/divtc3.c~~\n- ~~ppc/fixtfdi.c~~\n- ~~ppc/fixtfti.c~~\n- ~~ppc/fixunstfdi.c~~\n- ~~ppc/fixunstfti.c~~\n- ~~ppc/floatditf.c~~\n- ~~ppc/floattitf.c~~\n- ~~ppc/floatunditf.c~~\n- ~~ppc/gcc_qadd.c~~\n- ~~ppc/gcc_qdiv.c~~\n- ~~ppc/gcc_qmul.c~~\n- ~~ppc/gcc_qsub.c~~\n- ~~ppc/multc3.c~~\n\nThese builtins are for 16-bit brain floating-point numbers that are not\nsupported by Rust.\n\n- ~~truncdfbf2.c~~\n- ~~truncsfbf2.c~~\n- ~~trunctfxf2.c~~\n\nThese builtins involve complex floating-point types that are not supported by\nRust.\n\n- ~~divdc3.c~~\n- ~~divsc3.c~~\n- ~~divtc3.c~~\n- ~~divxc3.c~~\n- ~~muldc3.c~~\n- ~~mulsc3.c~~\n- ~~multc3.c~~\n- ~~mulxc3.c~~\n- ~~powixf2.c~~\n\nThese builtins are never called by LLVM.\n\n- ~~absvdi2.c~~\n- ~~absvsi2.c~~\n- ~~absvti2.c~~\n- ~~addvdi3.c~~\n- ~~addvsi3.c~~\n- ~~addvti3.c~~\n- ~~arm/aeabi_cdcmp.S~~\n- ~~arm/aeabi_cdcmpeq_check_nan.c~~\n- ~~arm/aeabi_cfcmp.S~~\n- ~~arm/aeabi_cfcmpeq_check_nan.c~~\n- ~~arm/aeabi_div0.c~~\n- ~~arm/aeabi_drsub.c~~\n- ~~arm/aeabi_frsub.c~~\n- ~~arm/aeabi_memcmp.S~~\n- ~~arm/bswapdi2.S~~\n- ~~arm/bswapsi2.S~~\n- ~~arm/clzdi2.S~~\n- ~~arm/clzsi2.S~~\n- ~~arm/comparesf2.S~~\n- ~~arm/restore_vfp_d8_d15_regs.S~~\n- ~~arm/save_vfp_d8_d15_regs.S~~\n- ~~arm/switch16.S~~\n- ~~arm/switch32.S~~\n- ~~arm/switch8.S~~\n- ~~arm/switchu8.S~~\n- ~~cmpdi2.c~~\n- ~~cmpti2.c~~\n- ~~ffssi2.c~~\n- ~~ffsdi2.c~~ - this is [called by gcc][jemalloc-fail] though!\n- ~~ffsti2.c~~\n- ~~mulvdi3.c~~\n- ~~mulvsi3.c~~\n- ~~mulvti3.c~~\n- ~~negdf2.c~~\n- ~~negdi2.c~~\n- ~~negsf2.c~~\n- ~~negti2.c~~\n- ~~negvdi2.c~~\n- ~~negvsi2.c~~\n- ~~negvti2.c~~\n- ~~paritydi2.c~~\n- ~~paritysi2.c~~\n- ~~parityti2.c~~\n- ~~popcountdi2.c~~\n- ~~popcountsi2.c~~\n- ~~popcountti2.c~~\n- ~~ppc/restFP.S~~\n- ~~ppc/saveFP.S~~\n- ~~subvdi3.c~~\n- ~~subvsi3.c~~\n- ~~subvti3.c~~\n- ~~ucmpdi2.c~~\n- ~~ucmpti2.c~~\n- ~~udivmodti4.c~~\n\n[jemalloc-fail]: https://travis-ci.org/rust-lang/rust/jobs/249772758\n\nRust only exposes atomic types on platforms that support them, and therefore does not need to fall back to software implementations.\n\n- ~~arm/sync_fetch_and_add_4.S~~\n- ~~arm/sync_fetch_and_add_8.S~~\n- ~~arm/sync_fetch_and_and_4.S~~\n- ~~arm/sync_fetch_and_and_8.S~~\n- ~~arm/sync_fetch_and_max_4.S~~\n- ~~arm/sync_fetch_and_max_8.S~~\n- ~~arm/sync_fetch_and_min_4.S~~\n- ~~arm/sync_fetch_and_min_8.S~~\n- ~~arm/sync_fetch_and_nand_4.S~~\n- ~~arm/sync_fetch_and_nand_8.S~~\n- ~~arm/sync_fetch_and_or_4.S~~\n- ~~arm/sync_fetch_and_or_8.S~~\n- ~~arm/sync_fetch_and_sub_4.S~~\n- ~~arm/sync_fetch_and_sub_8.S~~\n- ~~arm/sync_fetch_and_umax_4.S~~\n- ~~arm/sync_fetch_and_umax_8.S~~\n- ~~arm/sync_fetch_and_umin_4.S~~\n- ~~arm/sync_fetch_and_umin_8.S~~\n- ~~arm/sync_fetch_and_xor_4.S~~\n- ~~arm/sync_fetch_and_xor_8.S~~\n- ~~arm/sync_synchronize.S~~\n- ~~atomic.c~~\n- ~~atomic_flag_clear.c~~\n- ~~atomic_flag_clear_explicit.c~~\n- ~~atomic_flag_test_and_set.c~~\n- ~~atomic_flag_test_and_set_explicit.c~~\n- ~~atomic_signal_fence.c~~\n- ~~atomic_thread_fence.c~~\n\nMiscellaneous functionality that is not used by Rust.\n\n- ~~aarch64/fp_mode.c~~\n- ~~aarch64/lse.S~~ (LSE atomics)\n- ~~aarch64/sme-abi-init.c~~ (matrix extension)\n- ~~aarch64/sme-abi.S~~ (matrix extension)\n- ~~aarch64/sme-libc-routines.c~~ (matrix extension)\n- ~~apple_versioning.c~~\n- ~~arm/fp_mode.c~~\n- ~~avr/exit.S~~\n- ~~clear_cache.c~~\n- ~~cpu_model/aarch64.c~~\n- ~~cpu_model/x86.c~~\n- ~~crtbegin.c~~\n- ~~crtend.c~~\n- ~~emutls.c~~\n- ~~enable_execute_stack.c~~\n- ~~eprintf.c~~\n- ~~fp_mode.c~~ (float exception handling)\n- ~~gcc_personality_v0.c~~\n- ~~i386/fp_mode.c~~\n- ~~int_util.c~~\n- ~~loongarch/fp_mode.c~~\n- ~~os_version_check.c~~\n- ~~riscv/fp_mode.c~~\n- ~~riscv/restore.S~~ (callee-saved registers)\n- ~~riscv/save.S~~ (callee-saved registers)\n- ~~trampoline_setup.c~~\n- ~~ve/grow_stack.S~~\n- ~~ve/grow_stack_align.S~~\n\nFloating-point implementations of builtins that are only called from soft-float code. It would be better to simply use the generic soft-float versions in this case.\n\n- ~~i386/floatdidf.S~~\n- ~~i386/floatdisf.S~~\n- ~~i386/floatundidf.S~~\n- ~~i386/floatundisf.S~~\n- ~~x86_64/floatundidf.S~~\n- ~~x86_64/floatundisf.S~~\n- ~~x86_64/floatdidf.c~~\n- ~~x86_64/floatdisf.c~~\n\nUnsupported in any current target: used on old versions of 32-bit iOS with ARMv5.\n\n- ~~arm/adddf3vfp.S~~\n- ~~arm/addsf3vfp.S~~\n- ~~arm/divdf3vfp.S~~\n- ~~arm/divsf3vfp.S~~\n- ~~arm/eqdf2vfp.S~~\n- ~~arm/eqsf2vfp.S~~\n- ~~arm/extendsfdf2vfp.S~~\n- ~~arm/fixdfsivfp.S~~\n- ~~arm/fixsfsivfp.S~~\n- ~~arm/fixunsdfsivfp.S~~\n- ~~arm/fixunssfsivfp.S~~\n- ~~arm/floatsidfvfp.S~~\n- ~~arm/floatsisfvfp.S~~\n- ~~arm/floatunssidfvfp.S~~\n- ~~arm/floatunssisfvfp.S~~\n- ~~arm/gedf2vfp.S~~\n- ~~arm/gesf2vfp.S~~\n- ~~arm/gtdf2vfp.S~~\n- ~~arm/gtsf2vfp.S~~\n- ~~arm/ledf2vfp.S~~\n- ~~arm/lesf2vfp.S~~\n- ~~arm/ltdf2vfp.S~~\n- ~~arm/ltsf2vfp.S~~\n- ~~arm/muldf3vfp.S~~\n- ~~arm/mulsf3vfp.S~~\n- ~~arm/nedf2vfp.S~~\n- ~~arm/negdf2vfp.S~~\n- ~~arm/negsf2vfp.S~~\n- ~~arm/nesf2vfp.S~~\n- ~~arm/subdf3vfp.S~~\n- ~~arm/subsf3vfp.S~~\n- ~~arm/truncdfsf2vfp.S~~\n- ~~arm/unorddf2vfp.S~~\n- ~~arm/unordsf2vfp.S~~\n\n## License\n\nUsage is allowed under the [MIT License] and the [Apache License, Version 2.0]\nwith the LLVM exception.\n\n[MIT License]: https://opensource.org/license/mit\n[Apache License, Version 2.0]: htps://www.apache.org/licenses/LICENSE-2.0\n\n### Contribution\n\nContributions are licensed under the MIT License, the Apache License,\nVersion 2.0, and the Apache-2.0 license with the LLVM exception.\n\nSee [LICENSE.txt](../LICENSE.txt) for full details.\n"
  },
  {
    "sourcePath": "src/math/libm_math/acos.rs",
    "sha256": "fb066ba84aba1372d706425ec14f35ff8d971756d15eeebd22ecf42a716493bb",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_acos.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* acos(x)\n * Method :\n *      acos(x)  = pi/2 - asin(x)\n *      acos(-x) = pi/2 + asin(x)\n * For |x|<=0.5\n *      acos(x) = pi/2 - (x + x*x^2*R(x^2))     (see asin.c)\n * For x>0.5\n *      acos(x) = pi/2 - (pi/2 - 2asin(sqrt((1-x)/2)))\n *              = 2asin(sqrt((1-x)/2))\n *              = 2s + 2s*z*R(z)        ...z=(1-x)/2, s=sqrt(z)\n *              = 2f + (2c + 2s*z*R(z))\n *     where f=hi part of s, and c = (z-f*f)/(s+f) is the correction term\n *     for f so that f+c ~ sqrt(z).\n * For x<-0.5\n *      acos(x) = pi - 2asin(sqrt((1-|x|)/2))\n *              = pi - 0.5*(s+s*z*R(z)), where z=(1-|x|)/2,s=sqrt(z)\n *\n * Special cases:\n *      if x is NaN, return x itself;\n *      if |x|>1, return NaN with invalid signal.\n *\n * Function needed: sqrt\n */\n\nuse super::sqrt;\n\nconst PIO2_HI: f64 = 1.57079632679489655800e+00; /* 0x3FF921FB, 0x54442D18 */\nconst PIO2_LO: f64 = 6.12323399573676603587e-17; /* 0x3C91A626, 0x33145C07 */\nconst PS0: f64 = 1.66666666666666657415e-01; /* 0x3FC55555, 0x55555555 */\nconst PS1: f64 = -3.25565818622400915405e-01; /* 0xBFD4D612, 0x03EB6F7D */\nconst PS2: f64 = 2.01212532134862925881e-01; /* 0x3FC9C155, 0x0E884455 */\nconst PS3: f64 = -4.00555345006794114027e-02; /* 0xBFA48228, 0xB5688F3B */\nconst PS4: f64 = 7.91534994289814532176e-04; /* 0x3F49EFE0, 0x7501B288 */\nconst PS5: f64 = 3.47933107596021167570e-05; /* 0x3F023DE1, 0x0DFDF709 */\nconst QS1: f64 = -2.40339491173441421878e+00; /* 0xC0033A27, 0x1C8A2D4B */\nconst QS2: f64 = 2.02094576023350569471e+00; /* 0x40002AE5, 0x9C598AC8 */\nconst QS3: f64 = -6.88283971605453293030e-01; /* 0xBFE6066C, 0x1B8D0159 */\nconst QS4: f64 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */\n\nfn r(z: f64) -> f64 {\n    let p: f64 = z * (PS0 + z * (PS1 + z * (PS2 + z * (PS3 + z * (PS4 + z * PS5)))));\n    let q: f64 = 1.0 + z * (QS1 + z * (QS2 + z * (QS3 + z * QS4)));\n    p / q\n}\n\n/// Arccosine (f64)\n///\n/// Computes the inverse cosine (arc cosine) of the input value.\n/// Arguments must be in the range -1 to 1.\n/// Returns values in radians, in the range of 0 to pi.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn acos(x: f64) -> f64 {\n    let x1p_120f = f64::from_bits(0x3870000000000000); // 0x1p-120 === 2 ^ -120\n    let z: f64;\n    let w: f64;\n    let s: f64;\n    let c: f64;\n    let df: f64;\n    let hx: u32;\n    let ix: u32;\n\n    hx = (x.to_bits() >> 32) as u32;\n    ix = hx & 0x7fffffff;\n    /* |x| >= 1 or nan */\n    if ix >= 0x3ff00000 {\n        let lx: u32 = x.to_bits() as u32;\n\n        if ((ix - 0x3ff00000) | lx) == 0 {\n            /* acos(1)=0, acos(-1)=pi */\n            if (hx >> 31) != 0 {\n                return 2. * PIO2_HI + x1p_120f;\n            }\n            return 0.;\n        }\n        return 0. / (x - x);\n    }\n    /* |x| < 0.5 */\n    if ix < 0x3fe00000 {\n        if ix <= 0x3c600000 {\n            /* |x| < 2**-57 */\n            return PIO2_HI + x1p_120f;\n        }\n        return PIO2_HI - (x - (PIO2_LO - x * r(x * x)));\n    }\n    /* x < -0.5 */\n    if (hx >> 31) != 0 {\n        z = (1.0 + x) * 0.5;\n        s = sqrt(z);\n        w = r(z) * s - PIO2_LO;\n        return 2. * (PIO2_HI - (s + w));\n    }\n    /* x > 0.5 */\n    z = (1.0 - x) * 0.5;\n    s = sqrt(z);\n    // Set the low 4 bytes to zero\n    df = f64::from_bits(s.to_bits() & 0xff_ff_ff_ff_00_00_00_00);\n\n    c = (z - df * df) / (s + df);\n    w = r(z) * s + c;\n    2. * (df + w)\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/acosf.rs",
    "sha256": "2025aa64cc3f3a0c2855939798cdb4db8b8e8c38abca73bf7c29161bc5f589e3",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_acosf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::sqrt::sqrtf;\n\nconst PIO2_HI: f32 = 1.5707962513e+00; /* 0x3fc90fda */\nconst PIO2_LO: f32 = 7.5497894159e-08; /* 0x33a22168 */\nconst P_S0: f32 = 1.6666586697e-01;\nconst P_S1: f32 = -4.2743422091e-02;\nconst P_S2: f32 = -8.6563630030e-03;\nconst Q_S1: f32 = -7.0662963390e-01;\n\nfn r(z: f32) -> f32 {\n    let p = z * (P_S0 + z * (P_S1 + z * P_S2));\n    let q = 1. + z * Q_S1;\n    p / q\n}\n\n/// Arccosine (f32)\n///\n/// Computes the inverse cosine (arc cosine) of the input value.\n/// Arguments must be in the range -1 to 1.\n/// Returns values in radians, in the range of 0 to pi.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn acosf(x: f32) -> f32 {\n    let x1p_120 = f32::from_bits(0x03800000); // 0x1p-120 === 2 ^ (-120)\n\n    let z: f32;\n    let w: f32;\n    let s: f32;\n\n    let mut hx = x.to_bits();\n    let ix = hx & 0x7fffffff;\n    /* |x| >= 1 or nan */\n    if ix >= 0x3f800000 {\n        if ix == 0x3f800000 {\n            if (hx >> 31) != 0 {\n                return 2. * PIO2_HI + x1p_120;\n            }\n            return 0.;\n        }\n        return 0. / (x - x);\n    }\n    /* |x| < 0.5 */\n    if ix < 0x3f000000 {\n        if ix <= 0x32800000 {\n            /* |x| < 2**-26 */\n            return PIO2_HI + x1p_120;\n        }\n        return PIO2_HI - (x - (PIO2_LO - x * r(x * x)));\n    }\n    /* x < -0.5 */\n    if (hx >> 31) != 0 {\n        z = (1. + x) * 0.5;\n        s = sqrtf(z);\n        w = r(z) * s - PIO2_LO;\n        return 2. * (PIO2_HI - (s + w));\n    }\n    /* x > 0.5 */\n    z = (1. - x) * 0.5;\n    s = sqrtf(z);\n    hx = s.to_bits();\n    let df = f32::from_bits(hx & 0xfffff000);\n    let c = (z - df * df) / (s + df);\n    w = r(z) * s + c;\n    2. * (df + w)\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/asin.rs",
    "sha256": "fa0a75355e36bf28269f1119e5e17babbee106158a910f3ffddc76acb88a9473",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_asin.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* asin(x)\n * Method :\n *      Since  asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ...\n *      we approximate asin(x) on [0,0.5] by\n *              asin(x) = x + x*x^2*R(x^2)\n *      where\n *              R(x^2) is a rational approximation of (asin(x)-x)/x^3\n *      and its remez error is bounded by\n *              |(asin(x)-x)/x^3 - R(x^2)| < 2^(-58.75)\n *\n *      For x in [0.5,1]\n *              asin(x) = pi/2-2*asin(sqrt((1-x)/2))\n *      Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2;\n *      then for x>0.98\n *              asin(x) = pi/2 - 2*(s+s*z*R(z))\n *                      = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo)\n *      For x<=0.98, let pio4_hi = pio2_hi/2, then\n *              f = hi part of s;\n *              c = sqrt(z) - f = (z-f*f)/(s+f)         ...f+c=sqrt(z)\n *      and\n *              asin(x) = pi/2 - 2*(s+s*z*R(z))\n *                      = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo)\n *                      = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c))\n *\n * Special cases:\n *      if x is NaN, return x itself;\n *      if |x|>1, return NaN with invalid signal.\n *\n */\n\nuse super::{fabs, get_high_word, get_low_word, sqrt, with_set_low_word};\n\nconst PIO2_HI: f64 = 1.57079632679489655800e+00; /* 0x3FF921FB, 0x54442D18 */\nconst PIO2_LO: f64 = 6.12323399573676603587e-17; /* 0x3C91A626, 0x33145C07 */\n/* coefficients for R(x^2) */\nconst P_S0: f64 = 1.66666666666666657415e-01; /* 0x3FC55555, 0x55555555 */\nconst P_S1: f64 = -3.25565818622400915405e-01; /* 0xBFD4D612, 0x03EB6F7D */\nconst P_S2: f64 = 2.01212532134862925881e-01; /* 0x3FC9C155, 0x0E884455 */\nconst P_S3: f64 = -4.00555345006794114027e-02; /* 0xBFA48228, 0xB5688F3B */\nconst P_S4: f64 = 7.91534994289814532176e-04; /* 0x3F49EFE0, 0x7501B288 */\nconst P_S5: f64 = 3.47933107596021167570e-05; /* 0x3F023DE1, 0x0DFDF709 */\nconst Q_S1: f64 = -2.40339491173441421878e+00; /* 0xC0033A27, 0x1C8A2D4B */\nconst Q_S2: f64 = 2.02094576023350569471e+00; /* 0x40002AE5, 0x9C598AC8 */\nconst Q_S3: f64 = -6.88283971605453293030e-01; /* 0xBFE6066C, 0x1B8D0159 */\nconst Q_S4: f64 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */\n\nfn comp_r(z: f64) -> f64 {\n    let p = z * (P_S0 + z * (P_S1 + z * (P_S2 + z * (P_S3 + z * (P_S4 + z * P_S5)))));\n    let q = 1.0 + z * (Q_S1 + z * (Q_S2 + z * (Q_S3 + z * Q_S4)));\n    p / q\n}\n\n/// Arcsine (f64)\n///\n/// Computes the inverse sine (arc sine) of the argument `x`.\n/// Arguments to asin must be in the range -1 to 1.\n/// Returns values in radians, in the range of -pi/2 to pi/2.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn asin(mut x: f64) -> f64 {\n    let z: f64;\n    let r: f64;\n    let s: f64;\n    let hx: u32;\n    let ix: u32;\n\n    hx = get_high_word(x);\n    ix = hx & 0x7fffffff;\n    /* |x| >= 1 or nan */\n    if ix >= 0x3ff00000 {\n        let lx: u32;\n        lx = get_low_word(x);\n        if ((ix - 0x3ff00000) | lx) == 0 {\n            /* asin(1) = +-pi/2 with inexact */\n            return x * PIO2_HI + f64::from_bits(0x3870000000000000);\n        } else {\n            return 0.0 / (x - x);\n        }\n    }\n    /* |x| < 0.5 */\n    if ix < 0x3fe00000 {\n        /* if 0x1p-1022 <= |x| < 0x1p-26, avoid raising underflow */\n        if (0x00100000..0x3e500000).contains(&ix) {\n            return x;\n        } else {\n            return x + x * comp_r(x * x);\n        }\n    }\n    /* 1 > |x| >= 0.5 */\n    z = (1.0 - fabs(x)) * 0.5;\n    s = sqrt(z);\n    r = comp_r(z);\n    if ix >= 0x3fef3333 {\n        /* if |x| > 0.975 */\n        x = PIO2_HI - (2. * (s + s * r) - PIO2_LO);\n    } else {\n        let f: f64;\n        let c: f64;\n        /* f+c = sqrt(z) */\n        f = with_set_low_word(s, 0);\n        c = (z - f * f) / (s + f);\n        x = 0.5 * PIO2_HI - (2.0 * s * r - (PIO2_LO - 2.0 * c) - (0.5 * PIO2_HI - 2.0 * f));\n    }\n    if hx >> 31 != 0 { -x } else { x }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/asinf.rs",
    "sha256": "842cf2f174cd3dfd0099e5dc7996138dfcd388764ae09179ed8ae5dfb5651d14",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_asinf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::sqrt::sqrt;\nuse super::support::Float;\n\nconst PIO2: f64 = 1.570796326794896558e+00;\n\n/* coefficients for R(x^2) */\nconst P_S0: f32 = 1.6666586697e-01;\nconst P_S1: f32 = -4.2743422091e-02;\nconst P_S2: f32 = -8.6563630030e-03;\nconst Q_S1: f32 = -7.0662963390e-01;\n\nfn r(z: f32) -> f32 {\n    let p = z * (P_S0 + z * (P_S1 + z * P_S2));\n    let q = 1. + z * Q_S1;\n    p / q\n}\n\n/// Arcsine (f32)\n///\n/// Computes the inverse sine (arc sine) of the argument `x`.\n/// Arguments to asin must be in the range -1 to 1.\n/// Returns values in radians, in the range of -pi/2 to pi/2.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn asinf(mut x: f32) -> f32 {\n    let x1p_120 = f64::from_bits(0x3870000000000000); // 0x1p-120 === 2 ^ (-120)\n\n    let hx = x.to_bits();\n    let ix = hx & 0x7fffffff;\n\n    if ix >= 0x3f800000 {\n        /* |x| >= 1 */\n        if ix == 0x3f800000 {\n            /* |x| == 1 */\n            return ((x as f64) * PIO2 + x1p_120) as f32; /* asin(+-1) = +-pi/2 with inexact */\n        }\n        return 0. / (x - x); /* asin(|x|>1) is NaN */\n    }\n\n    if ix < 0x3f000000 {\n        /* |x| < 0.5 */\n        /* if 0x1p-126 <= |x| < 0x1p-12, avoid raising underflow */\n        if (0x00800000..0x39800000).contains(&ix) {\n            return x;\n        }\n        return x + x * r(x * x);\n    }\n\n    /* 1 > |x| >= 0.5 */\n    let z = (1. - Float::abs(x)) * 0.5;\n    let s = sqrt(z as f64);\n    x = (PIO2 - 2. * (s + s * (r(z) as f64))) as f32;\n    if (hx >> 31) != 0 { -x } else { x }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/atan.rs",
    "sha256": "7d590c8c31c300ab24cdbac393e1424ddde09e35c6eb2f33f2a533eaf1e427ac",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_atan.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* atan(x)\n * Method\n *   1. Reduce x to positive by atan(x) = -atan(-x).\n *   2. According to the integer k=4t+0.25 chopped, t=x, the argument\n *      is further reduced to one of the following intervals and the\n *      arctangent of t is evaluated by the corresponding formula:\n *\n *      [0,7/16]      atan(x) = t-t^3*(a1+t^2*(a2+...(a10+t^2*a11)...)\n *      [7/16,11/16]  atan(x) = atan(1/2) + atan( (t-0.5)/(1+t/2) )\n *      [11/16.19/16] atan(x) = atan( 1 ) + atan( (t-1)/(1+t) )\n *      [19/16,39/16] atan(x) = atan(3/2) + atan( (t-1.5)/(1+1.5t) )\n *      [39/16,INF]   atan(x) = atan(INF) + atan( -1/t )\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\nuse core::f64;\n\nuse super::fabs;\n\nconst ATANHI: [f64; 4] = [\n    4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */\n    7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */\n    9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */\n    1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */\n];\n\nconst ATANLO: [f64; 4] = [\n    2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */\n    3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */\n    1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */\n    6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */\n];\n\nconst AT: [f64; 11] = [\n    3.33333333333329318027e-01,  /* 0x3FD55555, 0x5555550D */\n    -1.99999999998764832476e-01, /* 0xBFC99999, 0x9998EBC4 */\n    1.42857142725034663711e-01,  /* 0x3FC24924, 0x920083FF */\n    -1.11111104054623557880e-01, /* 0xBFBC71C6, 0xFE231671 */\n    9.09088713343650656196e-02,  /* 0x3FB745CD, 0xC54C206E */\n    -7.69187620504482999495e-02, /* 0xBFB3B0F2, 0xAF749A6D */\n    6.66107313738753120669e-02,  /* 0x3FB10D66, 0xA0D03D51 */\n    -5.83357013379057348645e-02, /* 0xBFADDE2D, 0x52DEFD9A */\n    4.97687799461593236017e-02,  /* 0x3FA97B4B, 0x24760DEB */\n    -3.65315727442169155270e-02, /* 0xBFA2B444, 0x2C6A6C2F */\n    1.62858201153657823623e-02,  /* 0x3F90AD3A, 0xE322DA11 */\n];\n\n/// Arctangent (f64)\n///\n/// Computes the inverse tangent (arc tangent) of the input value.\n/// Returns a value in radians, in the range of -pi/2 to pi/2.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn atan(x: f64) -> f64 {\n    let mut x = x;\n    let mut ix = (x.to_bits() >> 32) as u32;\n    let sign = ix >> 31;\n    ix &= 0x7fff_ffff;\n    if ix >= 0x4410_0000 {\n        if x.is_nan() {\n            return x;\n        }\n\n        let z = ATANHI[3] + f64::from_bits(0x0380_0000); // 0x1p-120f\n        return if sign != 0 { -z } else { z };\n    }\n\n    let id = if ix < 0x3fdc_0000 {\n        /* |x| < 0.4375 */\n        if ix < 0x3e40_0000 {\n            /* |x| < 2^-27 */\n            if ix < 0x0010_0000 {\n                /* raise underflow for subnormal x */\n                force_eval!(x as f32);\n            }\n\n            return x;\n        }\n\n        -1\n    } else {\n        x = fabs(x);\n        if ix < 0x3ff30000 {\n            /* |x| < 1.1875 */\n            if ix < 0x3fe60000 {\n                /* 7/16 <= |x| < 11/16 */\n                x = (2. * x - 1.) / (2. + x);\n                0\n            } else {\n                /* 11/16 <= |x| < 19/16 */\n                x = (x - 1.) / (x + 1.);\n                1\n            }\n        } else if ix < 0x40038000 {\n            /* |x| < 2.4375 */\n            x = (x - 1.5) / (1. + 1.5 * x);\n            2\n        } else {\n            /* 2.4375 <= |x| < 2^66 */\n            x = -1. / x;\n            3\n        }\n    };\n\n    let z = x * x;\n    let w = z * z;\n    /* break sum from i=0 to 10 AT[i]z**(i+1) into odd and even poly */\n    let s1 = z * (AT[0] + w * (AT[2] + w * (AT[4] + w * (AT[6] + w * (AT[8] + w * AT[10])))));\n    let s2 = w * (AT[1] + w * (AT[3] + w * (AT[5] + w * (AT[7] + w * AT[9]))));\n\n    if id < 0 {\n        return x - x * (s1 + s2);\n    }\n\n    let z = i!(ATANHI, id as usize) - (x * (s1 + s2) - i!(ATANLO, id as usize) - x);\n\n    if sign != 0 { -z } else { z }\n}\n\n#[cfg(test)]\nmod tests {\n    use core::f64;\n\n    use super::atan;\n\n    #[test]\n    fn sanity_check() {\n        for (input, answer) in [\n            (3.0_f64.sqrt() / 3.0, f64::consts::FRAC_PI_6),\n            (1.0, f64::consts::FRAC_PI_4),\n            (3.0_f64.sqrt(), f64::consts::FRAC_PI_3),\n            (-3.0_f64.sqrt() / 3.0, -f64::consts::FRAC_PI_6),\n            (-1.0, -f64::consts::FRAC_PI_4),\n            (-3.0_f64.sqrt(), -f64::consts::FRAC_PI_3),\n        ]\n        .iter()\n        {\n            assert!(\n                (atan(*input) - answer) / answer < 1e-5,\n                \"\\natan({:.4}/16) = {:.4}, actual: {}\",\n                input * 16.0,\n                answer,\n                atan(*input)\n            );\n        }\n    }\n\n    #[test]\n    fn zero() {\n        assert_eq!(atan(0.0), 0.0);\n    }\n\n    #[test]\n    fn infinity() {\n        assert_eq!(atan(f64::INFINITY), f64::consts::FRAC_PI_2);\n    }\n\n    #[test]\n    fn minus_infinity() {\n        assert_eq!(atan(f64::NEG_INFINITY), -f64::consts::FRAC_PI_2);\n    }\n\n    #[test]\n    fn nan() {\n        assert!(atan(f64::NAN).is_nan());\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/atan2.rs",
    "sha256": "49bc632eaf35cf9688b79962b6587861ea1d8454883f03ff0ced5911454873ef",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_atan2.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n *\n */\n/* atan2(y,x)\n * Method :\n *      1. Reduce y to positive by atan2(y,x)=-atan2(-y,x).\n *      2. Reduce x to positive by (if x and y are unexceptional):\n *              ARG (x+iy) = arctan(y/x)           ... if x > 0,\n *              ARG (x+iy) = pi - arctan[y/(-x)]   ... if x < 0,\n *\n * Special cases:\n *\n *      ATAN2((anything), NaN ) is NaN;\n *      ATAN2(NAN , (anything) ) is NaN;\n *      ATAN2(+-0, +(anything but NaN)) is +-0  ;\n *      ATAN2(+-0, -(anything but NaN)) is +-pi ;\n *      ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2;\n *      ATAN2(+-(anything but INF and NaN), +INF) is +-0 ;\n *      ATAN2(+-(anything but INF and NaN), -INF) is +-pi;\n *      ATAN2(+-INF,+INF ) is +-pi/4 ;\n *      ATAN2(+-INF,-INF ) is +-3pi/4;\n *      ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2;\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\nuse super::{atan, fabs};\n\nconst PI: f64 = 3.1415926535897931160E+00; /* 0x400921FB, 0x54442D18 */\nconst PI_LO: f64 = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */\n\n/// Arctangent of y/x (f64)\n///\n/// Computes the inverse tangent (arc tangent) of `y/x`.\n/// Produces the correct result even for angles near pi/2 or -pi/2 (that is, when `x` is near 0).\n/// Returns a value in radians, in the range of -pi to pi.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn atan2(y: f64, x: f64) -> f64 {\n    if x.is_nan() || y.is_nan() {\n        return x + y;\n    }\n    let mut ix = (x.to_bits() >> 32) as u32;\n    let lx = x.to_bits() as u32;\n    let mut iy = (y.to_bits() >> 32) as u32;\n    let ly = y.to_bits() as u32;\n    if ((ix.wrapping_sub(0x3ff00000)) | lx) == 0 {\n        /* x = 1.0 */\n        return atan(y);\n    }\n    let m = ((iy >> 31) & 1) | ((ix >> 30) & 2); /* 2*sign(x)+sign(y) */\n    ix &= 0x7fffffff;\n    iy &= 0x7fffffff;\n\n    /* when y = 0 */\n    if (iy | ly) == 0 {\n        return match m {\n            0 | 1 => y, /* atan(+-0,+anything)=+-0 */\n            2 => PI,    /* atan(+0,-anything) = PI */\n            _ => -PI,   /* atan(-0,-anything) =-PI */\n        };\n    }\n    /* when x = 0 */\n    if (ix | lx) == 0 {\n        return if m & 1 != 0 { -PI / 2.0 } else { PI / 2.0 };\n    }\n    /* when x is INF */\n    if ix == 0x7ff00000 {\n        if iy == 0x7ff00000 {\n            return match m {\n                0 => PI / 4.0,        /* atan(+INF,+INF) */\n                1 => -PI / 4.0,       /* atan(-INF,+INF) */\n                2 => 3.0 * PI / 4.0,  /* atan(+INF,-INF) */\n                _ => -3.0 * PI / 4.0, /* atan(-INF,-INF) */\n            };\n        } else {\n            return match m {\n                0 => 0.0,  /* atan(+...,+INF) */\n                1 => -0.0, /* atan(-...,+INF) */\n                2 => PI,   /* atan(+...,-INF) */\n                _ => -PI,  /* atan(-...,-INF) */\n            };\n        }\n    }\n    /* |y/x| > 0x1p64 */\n    if ix.wrapping_add(64 << 20) < iy || iy == 0x7ff00000 {\n        return if m & 1 != 0 { -PI / 2.0 } else { PI / 2.0 };\n    }\n\n    /* z = atan(|y/x|) without spurious underflow */\n    let z = if (m & 2 != 0) && iy.wrapping_add(64 << 20) < ix {\n        /* |y/x| < 0x1p-64, x<0 */\n        0.0\n    } else {\n        atan(fabs(y / x))\n    };\n    match m {\n        0 => z,                /* atan(+,+) */\n        1 => -z,               /* atan(-,+) */\n        2 => PI - (z - PI_LO), /* atan(+,-) */\n        _ => (z - PI_LO) - PI, /* atan(-,-) */\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    #[cfg_attr(x86_no_sse, ignore = \"FIXME(i586): possible incorrect rounding\")]\n    fn sanity_check() {\n        assert_eq!(atan2(0.0, 1.0), 0.0);\n        assert_eq!(atan2(0.0, -1.0), PI);\n        assert_eq!(atan2(-0.0, -1.0), -PI);\n        assert_eq!(atan2(3.0, 2.0), atan(3.0 / 2.0));\n        assert_eq!(atan2(2.0, -1.0), atan(2.0 / -1.0) + PI);\n        assert_eq!(atan2(-2.0, -1.0), atan(-2.0 / -1.0) - PI);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/atan2f.rs",
    "sha256": "afc398fed6ebae60fb32713521fbb8e46ec842cc44bcaa1ca84ed0b3d3acd531",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_atan2f.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{atanf, fabsf};\n\nconst PI: f32 = 3.1415927410e+00; /* 0x40490fdb */\nconst PI_LO: f32 = -8.7422776573e-08; /* 0xb3bbbd2e */\n\n/// Arctangent of y/x (f32)\n///\n/// Computes the inverse tangent (arc tangent) of `y/x`.\n/// Produces the correct result even for angles near pi/2 or -pi/2 (that is, when `x` is near 0).\n/// Returns a value in radians, in the range of -pi to pi.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn atan2f(y: f32, x: f32) -> f32 {\n    if x.is_nan() || y.is_nan() {\n        return x + y;\n    }\n    let mut ix = x.to_bits();\n    let mut iy = y.to_bits();\n\n    if ix == 0x3f800000 {\n        /* x=1.0 */\n        return atanf(y);\n    }\n    let m = ((iy >> 31) & 1) | ((ix >> 30) & 2); /* 2*sign(x)+sign(y) */\n    ix &= 0x7fffffff;\n    iy &= 0x7fffffff;\n\n    /* when y = 0 */\n    if iy == 0 {\n        return match m {\n            0 | 1 => y, /* atan(+-0,+anything)=+-0 */\n            2 => PI,    /* atan(+0,-anything) = pi */\n            _ => -PI,   /* atan(-0,-anything) =-pi */\n        };\n    }\n    /* when x = 0 */\n    if ix == 0 {\n        return if m & 1 != 0 { -PI / 2. } else { PI / 2. };\n    }\n    /* when x is INF */\n    if ix == 0x7f800000 {\n        return if iy == 0x7f800000 {\n            match m {\n                0 => PI / 4.,       /* atan(+INF,+INF) */\n                1 => -PI / 4.,      /* atan(-INF,+INF) */\n                2 => 3. * PI / 4.,  /* atan(+INF,-INF)*/\n                _ => -3. * PI / 4., /* atan(-INF,-INF)*/\n            }\n        } else {\n            match m {\n                0 => 0.,  /* atan(+...,+INF) */\n                1 => -0., /* atan(-...,+INF) */\n                2 => PI,  /* atan(+...,-INF) */\n                _ => -PI, /* atan(-...,-INF) */\n            }\n        };\n    }\n    /* |y/x| > 0x1p26 */\n    if (ix + (26 << 23) < iy) || (iy == 0x7f800000) {\n        return if m & 1 != 0 { -PI / 2. } else { PI / 2. };\n    }\n\n    /* z = atan(|y/x|) with correct underflow */\n    let z = if (m & 2 != 0) && (iy + (26 << 23) < ix) {\n        /*|y/x| < 0x1p-26, x < 0 */\n        0.\n    } else {\n        atanf(fabsf(y / x))\n    };\n    match m {\n        0 => z,                /* atan(+,+) */\n        1 => -z,               /* atan(-,+) */\n        2 => PI - (z - PI_LO), /* atan(+,-) */\n        _ => (z - PI_LO) - PI, /* case 3 */ /* atan(-,-) */\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/atanf.rs",
    "sha256": "631bbf8e9560865728bcaa65bf42752103cd66901a2af64e60cd8982f1e277fc",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_atanf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::fabsf;\n\nconst ATAN_HI: [f32; 4] = [\n    4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */\n    7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */\n    9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */\n    1.5707962513e+00, /* atan(inf)hi 0x3fc90fda */\n];\n\nconst ATAN_LO: [f32; 4] = [\n    5.0121582440e-09, /* atan(0.5)lo 0x31ac3769 */\n    3.7748947079e-08, /* atan(1.0)lo 0x33222168 */\n    3.4473217170e-08, /* atan(1.5)lo 0x33140fb4 */\n    7.5497894159e-08, /* atan(inf)lo 0x33a22168 */\n];\n\nconst A_T: [f32; 5] = [\n    3.3333328366e-01,\n    -1.9999158382e-01,\n    1.4253635705e-01,\n    -1.0648017377e-01,\n    6.1687607318e-02,\n];\n\n/// Arctangent (f32)\n///\n/// Computes the inverse tangent (arc tangent) of the input value.\n/// Returns a value in radians, in the range of -pi/2 to pi/2.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn atanf(mut x: f32) -> f32 {\n    let x1p_120 = f32::from_bits(0x03800000); // 0x1p-120 === 2 ^ (-120)\n\n    let z: f32;\n\n    let mut ix = x.to_bits();\n    let sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n\n    if ix >= 0x4c800000 {\n        /* if |x| >= 2**26 */\n        if x.is_nan() {\n            return x;\n        }\n        z = i!(ATAN_HI, 3) + x1p_120;\n        return if sign { -z } else { z };\n    }\n    let id = if ix < 0x3ee00000 {\n        /* |x| < 0.4375 */\n        if ix < 0x39800000 {\n            /* |x| < 2**-12 */\n            if ix < 0x00800000 {\n                /* raise underflow for subnormal x */\n                force_eval!(x * x);\n            }\n            return x;\n        }\n        -1\n    } else {\n        x = fabsf(x);\n        if ix < 0x3f980000 {\n            /* |x| < 1.1875 */\n            if ix < 0x3f300000 {\n                /*  7/16 <= |x| < 11/16 */\n                x = (2. * x - 1.) / (2. + x);\n                0\n            } else {\n                /* 11/16 <= |x| < 19/16 */\n                x = (x - 1.) / (x + 1.);\n                1\n            }\n        } else if ix < 0x401c0000 {\n            /* |x| < 2.4375 */\n            x = (x - 1.5) / (1. + 1.5 * x);\n            2\n        } else {\n            /* 2.4375 <= |x| < 2**26 */\n            x = -1. / x;\n            3\n        }\n    };\n    /* end of argument reduction */\n    z = x * x;\n    let w = z * z;\n    /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */\n    let s1 = z * (i!(A_T, 0) + w * (i!(A_T, 2) + w * i!(A_T, 4)));\n    let s2 = w * (i!(A_T, 1) + w * i!(A_T, 3));\n    if id < 0 {\n        return x - x * (s1 + s2);\n    }\n    let id = id as usize;\n    let z = i!(ATAN_HI, id) - ((x * (s1 + s2) - i!(ATAN_LO, id)) - x);\n    if sign { -z } else { z }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/cbrt.rs",
    "sha256": "25f08448f762d7d6d3d951d3fcce487722670d5bbf7619dfb083c85bfd53a585",
    "text": "/* SPDX-License-Identifier: MIT */\n/* origin: core-math/src/binary64/cbrt/cbrt.c\n * Copyright (c) 2021-2022 Alexei Sibidanov.\n * Ported to Rust in 2025 by Trevor Gross.\n */\n\nuse super::Float;\nuse super::support::{FpResult, Round, cold_path};\n\n/// Compute the cube root of the argument.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn cbrt(x: f64) -> f64 {\n    cbrt_round(x, Round::Nearest).val\n}\n\npub fn cbrt_round(x: f64, round: Round) -> FpResult<f64> {\n    const ESCALE: [f64; 3] = [\n        1.0,\n        hf64!(\"0x1.428a2f98d728bp+0\"), /* 2^(1/3) */\n        hf64!(\"0x1.965fea53d6e3dp+0\"), /* 2^(2/3) */\n    ];\n\n    /* the polynomial c0+c1*x+c2*x^2+c3*x^3 approximates x^(1/3) on [1,2]\n    with maximal error < 9.2e-5 (attained at x=2) */\n    const C: [f64; 4] = [\n        hf64!(\"0x1.1b0babccfef9cp-1\"),\n        hf64!(\"0x1.2c9a3e94d1da5p-1\"),\n        hf64!(\"-0x1.4dc30b1a1ddbap-3\"),\n        hf64!(\"0x1.7a8d3e4ec9b07p-6\"),\n    ];\n\n    let u0: f64 = hf64!(\"0x1.5555555555555p-2\");\n    let u1: f64 = hf64!(\"0x1.c71c71c71c71cp-3\");\n\n    let rsc = [1.0, -1.0, 0.5, -0.5, 0.25, -0.25];\n\n    let off = [hf64!(\"0x1p-53\"), 0.0, 0.0, 0.0];\n\n    /* rm=0 for rounding to nearest, and other values for directed roundings */\n    let hx: u64 = x.to_bits();\n    let mut mant: u64 = hx & f64::SIG_MASK;\n    let sign: u64 = hx >> 63;\n\n    let mut e: u32 = (hx >> f64::SIG_BITS) as u32 & f64::EXP_SAT;\n\n    if ((e + 1) & f64::EXP_SAT) < 2 {\n        cold_path();\n\n        let ix: u64 = hx & !f64::SIGN_MASK;\n\n        /* 0, inf, nan: we return x + x instead of simply x,\n        to that for x a signaling NaN, it correctly triggers\n        the invalid exception. */\n        if e == f64::EXP_SAT || ix == 0 {\n            return FpResult::ok(x + x);\n        }\n\n        let nz = ix.leading_zeros() - 11; /* subnormal */\n        mant <<= nz;\n        mant &= f64::SIG_MASK;\n        e = e.wrapping_sub(nz - 1);\n    }\n\n    e = e.wrapping_add(3072);\n    let cvt1: u64 = mant | (0x3ffu64 << 52);\n    let mut cvt5: u64 = cvt1;\n\n    let et: u32 = e / 3;\n    let it: u32 = e % 3;\n\n    /* 2^(3k+it) <= x < 2^(3k+it+1), with 0 <= it <= 3 */\n    cvt5 += u64::from(it) << f64::SIG_BITS;\n    cvt5 |= sign << 63;\n    let zz: f64 = f64::from_bits(cvt5);\n\n    /* cbrt(x) = cbrt(zz)*2^(et-1365) where 1 <= zz < 8 */\n    let mut isc: u64 = ESCALE[it as usize].to_bits(); // todo: index\n    isc |= sign << 63;\n    let cvt2: u64 = isc;\n    let z: f64 = f64::from_bits(cvt1);\n\n    /* cbrt(zz) = cbrt(z)*isc, where isc encodes 1, 2^(1/3) or 2^(2/3),\n    and 1 <= z < 2 */\n    let r: f64 = 1.0 / z;\n    let rr: f64 = r * rsc[((it as usize) << 1) | sign as usize];\n    let z2: f64 = z * z;\n    let c0: f64 = C[0] + z * C[1];\n    let c2: f64 = C[2] + z * C[3];\n    let mut y: f64 = c0 + z2 * c2;\n    let mut y2: f64 = y * y;\n\n    /* y is an approximation of z^(1/3) */\n    let mut h: f64 = y2 * (y * r) - 1.0;\n\n    /* h determines the error between y and z^(1/3) */\n    y -= (h * y) * (u0 - u1 * h);\n\n    /* The correction y -= (h*y)*(u0 - u1*h) corresponds to a cubic variant\n    of Newton's method, with the function f(y) = 1-z/y^3. */\n    y *= f64::from_bits(cvt2);\n\n    /* Now y is an approximation of zz^(1/3),\n     * and rr an approximation of 1/zz. We now perform another iteration of\n     * Newton-Raphson, this time with a linear approximation only. */\n    y2 = y * y;\n    let mut y2l: f64 = y.fma(y, -y2);\n\n    /* y2 + y2l = y^2 exactly */\n    let mut y3: f64 = y2 * y;\n    let mut y3l: f64 = y.fma(y2, -y3) + y * y2l;\n\n    /* y3 + y3l approximates y^3 with about 106 bits of accuracy */\n    h = ((y3 - zz) + y3l) * rr;\n    let mut dy: f64 = h * (y * u0);\n\n    /* the approximation of zz^(1/3) is y - dy */\n    let mut y1: f64 = y - dy;\n    dy = (y - y1) - dy;\n\n    /* the approximation of zz^(1/3) is now y1 + dy, where |dy| < 1/2 ulp(y)\n     * (for rounding to nearest) */\n    let mut ady: f64 = dy.abs();\n\n    /* For directed roundings, ady0 is tiny when dy is tiny, or ady0 is near\n     * from ulp(1);\n     * for rounding to nearest, ady0 is tiny when dy is near from 1/2 ulp(1),\n     * or from 3/2 ulp(1). */\n    let mut ady0: f64 = (ady - off[round as usize]).abs();\n    let mut ady1: f64 = (ady - (hf64!(\"0x1p-52\") + off[round as usize])).abs();\n\n    if ady0 < hf64!(\"0x1p-75\") || ady1 < hf64!(\"0x1p-75\") {\n        cold_path();\n\n        y2 = y1 * y1;\n        y2l = y1.fma(y1, -y2);\n        y3 = y2 * y1;\n        y3l = y1.fma(y2, -y3) + y1 * y2l;\n        h = ((y3 - zz) + y3l) * rr;\n        dy = h * (y1 * u0);\n        y = y1 - dy;\n        dy = (y1 - y) - dy;\n        y1 = y;\n        ady = dy.abs();\n        ady0 = (ady - off[round as usize]).abs();\n        ady1 = (ady - (hf64!(\"0x1p-52\") + off[round as usize])).abs();\n\n        if ady0 < hf64!(\"0x1p-98\") || ady1 < hf64!(\"0x1p-98\") {\n            cold_path();\n            let azz: f64 = zz.abs();\n\n            // ~ 0x1.79d15d0e8d59b80000000000000ffc3dp+0\n            if azz == hf64!(\"0x1.9b78223aa307cp+1\") {\n                y1 = hf64!(\"0x1.79d15d0e8d59cp+0\").copysign(zz);\n            }\n\n            // ~ 0x1.de87aa837820e80000000000001c0f08p+0\n            if azz == hf64!(\"0x1.a202bfc89ddffp+2\") {\n                y1 = hf64!(\"0x1.de87aa837820fp+0\").copysign(zz);\n            }\n\n            if round != Round::Nearest {\n                let wlist = [\n                    (hf64!(\"0x1.3a9ccd7f022dbp+0\"), hf64!(\"0x1.1236160ba9b93p+0\")), // ~ 0x1.1236160ba9b930000000000001e7e8fap+0\n                    (hf64!(\"0x1.7845d2faac6fep+0\"), hf64!(\"0x1.23115e657e49cp+0\")), // ~ 0x1.23115e657e49c0000000000001d7a799p+0\n                    (hf64!(\"0x1.d1ef81cbbbe71p+0\"), hf64!(\"0x1.388fb44cdcf5ap+0\")), // ~ 0x1.388fb44cdcf5a0000000000002202c55p+0\n                    (hf64!(\"0x1.0a2014f62987cp+1\"), hf64!(\"0x1.46bcbf47dc1e8p+0\")), // ~ 0x1.46bcbf47dc1e8000000000000303aa2dp+0\n                    (hf64!(\"0x1.fe18a044a5501p+1\"), hf64!(\"0x1.95decfec9c904p+0\")), // ~ 0x1.95decfec9c9040000000000000159e8ep+0\n                    (hf64!(\"0x1.a6bb8c803147bp+2\"), hf64!(\"0x1.e05335a6401dep+0\")), // ~ 0x1.e05335a6401de00000000000027ca017p+0\n                    (hf64!(\"0x1.ac8538a031cbdp+2\"), hf64!(\"0x1.e281d87098de8p+0\")), // ~ 0x1.e281d87098de80000000000000ee9314p+0\n                ];\n\n                for (a, b) in wlist {\n                    if azz == a {\n                        let tmp = if round as u64 + sign == 2 {\n                            hf64!(\"0x1p-52\")\n                        } else {\n                            0.0\n                        };\n                        y1 = (b + tmp).copysign(zz);\n                    }\n                }\n            }\n        }\n    }\n\n    let mut cvt3: u64 = y1.to_bits();\n    cvt3 = cvt3.wrapping_add(((et.wrapping_sub(342).wrapping_sub(1023)) as u64) << 52);\n    let m0: u64 = cvt3 << 30;\n    let m1 = m0 >> 63;\n\n    if (m0 ^ m1) <= (1u64 << 30) {\n        cold_path();\n\n        let mut cvt4: u64 = y1.to_bits();\n        cvt4 = (cvt4 + (164 << 15)) & 0xffffffffffff0000u64;\n\n        if ((f64::from_bits(cvt4) - y1) - dy).abs() < hf64!(\"0x1p-60\") || (zz).abs() == 1.0 {\n            cvt3 = (cvt3 + (1u64 << 15)) & 0xffffffffffff0000u64;\n        }\n    }\n\n    FpResult::ok(f64::from_bits(cvt3))\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn spot_checks() {\n        if !cfg!(x86_no_sse) {\n            // Exposes a rounding mode problem. Ignored on i586 because of inaccurate FMA.\n            assert_biteq!(\n                cbrt(f64::from_bits(0xf7f792b28f600000)),\n                f64::from_bits(0xd29ce68655d962f3)\n            );\n        }\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/cbrtf.rs",
    "sha256": "ad0b483854aa9f17a44d36c049bf0e8ebab34c27e90b787c05f45cc230ec7d19",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_cbrtf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n * Debugged and optimized by Bruce D. Evans.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* cbrtf(x)\n * Return cube root of x\n */\n\nuse core::f32;\n\nconst B1: u32 = 709958130; /* B1 = (127-127.0/3-0.03306235651)*2**23 */\nconst B2: u32 = 642849266; /* B2 = (127-127.0/3-24/3-0.03306235651)*2**23 */\n\n/// Cube root (f32)\n///\n/// Computes the cube root of the argument.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn cbrtf(x: f32) -> f32 {\n    let x1p24 = f32::from_bits(0x4b800000); // 0x1p24f === 2 ^ 24\n\n    let mut r: f64;\n    let mut t: f64;\n    let mut ui: u32 = x.to_bits();\n    let mut hx: u32 = ui & 0x7fffffff;\n\n    if hx >= 0x7f800000 {\n        /* cbrt(NaN,INF) is itself */\n        return x + x;\n    }\n\n    /* rough cbrt to 5 bits */\n    if hx < 0x00800000 {\n        /* zero or subnormal? */\n        if hx == 0 {\n            return x; /* cbrt(+-0) is itself */\n        }\n        ui = (x * x1p24).to_bits();\n        hx = ui & 0x7fffffff;\n        hx = hx / 3 + B2;\n    } else {\n        hx = hx / 3 + B1;\n    }\n    ui &= 0x80000000;\n    ui |= hx;\n\n    /*\n     * First step Newton iteration (solving t*t-x/t == 0) to 16 bits.  In\n     * double precision so that its terms can be arranged for efficiency\n     * without causing overflow or underflow.\n     */\n    t = f32::from_bits(ui) as f64;\n    r = t * t * t;\n    t = t * (x as f64 + x as f64 + r) / (x as f64 + r + r);\n\n    /*\n     * Second step Newton iteration to 47 bits.  In double precision for\n     * efficiency and accuracy.\n     */\n    r = t * t * t;\n    t = t * (x as f64 + x as f64 + r) / (x as f64 + r + r);\n\n    /* rounding to 24 bits is perfect in round-to-nearest mode */\n    t as f32\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/cos.rs",
    "sha256": "05c7f45241a28169bfd9031e53d07450f9e869d0eff6dc9a1304efa1dd29234c",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/s_cos.c */\n//\n// ====================================================\n// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n//\n// Developed at SunPro, a Sun Microsystems, Inc. business.\n// Permission to use, copy, modify, and distribute this\n// software is freely granted, provided that this notice\n// is preserved.\n// ====================================================\n\nuse super::{k_cos, k_sin, rem_pio2};\n\n// cos(x)\n// Return cosine function of x.\n//\n// kernel function:\n//      k_sin           ... sine function on [-pi/4,pi/4]\n//      k_cos           ... cosine function on [-pi/4,pi/4]\n//      rem_pio2        ... argument reduction routine\n//\n// Method.\n//      Let S,C and T denote the sin, cos and tan respectively on\n//      [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2\n//      in [-pi/4 , +pi/4], and let n = k mod 4.\n//      We have\n//\n//          n        sin(x)      cos(x)        tan(x)\n//     ----------------------------------------------------------\n//          0          S           C             T\n//          1          C          -S            -1/T\n//          2         -S          -C             T\n//          3         -C           S            -1/T\n//     ----------------------------------------------------------\n//\n// Special cases:\n//      Let trig be any of sin, cos, or tan.\n//      trig(+-INF)  is NaN, with signals;\n//      trig(NaN)    is that NaN;\n//\n// Accuracy:\n//      TRIG(x) returns trig(x) nearly rounded\n//\n\n/// The cosine of `x` (f64).\n///\n/// `x` is specified in radians.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn cos(x: f64) -> f64 {\n    let ix = (f64::to_bits(x) >> 32) as u32 & 0x7fffffff;\n\n    /* |x| ~< pi/4 */\n    if ix <= 0x3fe921fb {\n        if ix < 0x3e46a09e {\n            /* if x < 2**-27 * sqrt(2) */\n            /* raise inexact if x != 0 */\n            if x as i32 == 0 {\n                return 1.0;\n            }\n        }\n        return k_cos(x, 0.0);\n    }\n\n    /* cos(Inf or NaN) is NaN */\n    if ix >= 0x7ff00000 {\n        return x - x;\n    }\n\n    /* argument reduction needed */\n    let (n, y0, y1) = rem_pio2(x);\n    match n & 3 {\n        0 => k_cos(y0, y1),\n        1 => -k_sin(y0, y1, 1),\n        2 => -k_cos(y0, y1),\n        _ => k_sin(y0, y1, 1),\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/cosf.rs",
    "sha256": "8ec9d03db02272178bee0fefa27acf6ec432e8d8e3d2e7e7ab10689b6491e920",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_cosf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n * Optimized by Bruce D. Evans.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse core::f64::consts::FRAC_PI_2;\n\nuse super::{k_cosf, k_sinf, rem_pio2f};\n\n/* Small multiples of pi/2 rounded to double precision. */\nconst C1_PIO2: f64 = 1. * FRAC_PI_2; /* 0x3FF921FB, 0x54442D18 */\nconst C2_PIO2: f64 = 2. * FRAC_PI_2; /* 0x400921FB, 0x54442D18 */\nconst C3_PIO2: f64 = 3. * FRAC_PI_2; /* 0x4012D97C, 0x7F3321D2 */\nconst C4_PIO2: f64 = 4. * FRAC_PI_2; /* 0x401921FB, 0x54442D18 */\n\n/// The cosine of `x` (f32).\n///\n/// `x` is specified in radians.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn cosf(x: f32) -> f32 {\n    let x64 = x as f64;\n\n    let x1p120 = f32::from_bits(0x7b800000); // 0x1p120f === 2 ^ 120\n\n    let mut ix = x.to_bits();\n    let sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n\n    if ix <= 0x3f490fda {\n        /* |x| ~<= pi/4 */\n        if ix < 0x39800000 {\n            /* |x| < 2**-12 */\n            /* raise inexact if x != 0 */\n            force_eval!(x + x1p120);\n            return 1.;\n        }\n        return k_cosf(x64);\n    }\n    if ix <= 0x407b53d1 {\n        /* |x| ~<= 5*pi/4 */\n        if ix > 0x4016cbe3 {\n            /* |x|  ~> 3*pi/4 */\n            return -k_cosf(if sign { x64 + C2_PIO2 } else { x64 - C2_PIO2 });\n        } else if sign {\n            return k_sinf(x64 + C1_PIO2);\n        } else {\n            return k_sinf(C1_PIO2 - x64);\n        }\n    }\n    if ix <= 0x40e231d5 {\n        /* |x| ~<= 9*pi/4 */\n        if ix > 0x40afeddf {\n            /* |x| ~> 7*pi/4 */\n            return k_cosf(if sign { x64 + C4_PIO2 } else { x64 - C4_PIO2 });\n        } else if sign {\n            return k_sinf(-x64 - C3_PIO2);\n        } else {\n            return k_sinf(x64 - C3_PIO2);\n        }\n    }\n\n    /* cos(Inf or NaN) is NaN */\n    if ix >= 0x7f800000 {\n        return x - x;\n    }\n\n    /* general argument reduction needed */\n    let (n, y) = rem_pio2f(x);\n    match n & 3 {\n        0 => k_cosf(y),\n        1 => k_sinf(-y),\n        2 => -k_cosf(y),\n        _ => k_sinf(y),\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/erf.rs",
    "sha256": "96ea3d52ef3f39524bf580e1bc0b60ac91a34c6c775e4d6e87e97b1d3ec91108",
    "text": "use super::{exp, fabs, get_high_word, with_set_low_word};\n/* origin: FreeBSD /usr/src/lib/msun/src/s_erf.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* double erf(double x)\n * double erfc(double x)\n *                           x\n *                    2      |\\\n *     erf(x)  =  ---------  | exp(-t*t)dt\n *                 sqrt(pi) \\|\n *                           0\n *\n *     erfc(x) =  1-erf(x)\n *  Note that\n *              erf(-x) = -erf(x)\n *              erfc(-x) = 2 - erfc(x)\n *\n * Method:\n *      1. For |x| in [0, 0.84375]\n *          erf(x)  = x + x*R(x^2)\n *          erfc(x) = 1 - erf(x)           if x in [-.84375,0.25]\n *                  = 0.5 + ((0.5-x)-x*R)  if x in [0.25,0.84375]\n *         where R = P/Q where P is an odd poly of degree 8 and\n *         Q is an odd poly of degree 10.\n *                                               -57.90\n *                      | R - (erf(x)-x)/x | <= 2\n *\n *\n *         Remark. The formula is derived by noting\n *          erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....)\n *         and that\n *          2/sqrt(pi) = 1.128379167095512573896158903121545171688\n *         is close to one. The interval is chosen because the fix\n *         point of erf(x) is near 0.6174 (i.e., erf(x)=x when x is\n *         near 0.6174), and by some experiment, 0.84375 is chosen to\n *         guarantee the error is less than one ulp for erf.\n *\n *      2. For |x| in [0.84375,1.25], let s = |x| - 1, and\n *         c = 0.84506291151 rounded to single (24 bits)\n *              erf(x)  = sign(x) * (c  + P1(s)/Q1(s))\n *              erfc(x) = (1-c)  - P1(s)/Q1(s) if x > 0\n *                        1+(c+P1(s)/Q1(s))    if x < 0\n *              |P1/Q1 - (erf(|x|)-c)| <= 2**-59.06\n *         Remark: here we use the taylor series expansion at x=1.\n *              erf(1+s) = erf(1) + s*Poly(s)\n *                       = 0.845.. + P1(s)/Q1(s)\n *         That is, we use rational approximation to approximate\n *                      erf(1+s) - (c = (single)0.84506291151)\n *         Note that |P1/Q1|< 0.078 for x in [0.84375,1.25]\n *         where\n *              P1(s) = degree 6 poly in s\n *              Q1(s) = degree 6 poly in s\n *\n *      3. For x in [1.25,1/0.35(~2.857143)],\n *              erfc(x) = (1/x)*exp(-x*x-0.5625+R1/S1)\n *              erf(x)  = 1 - erfc(x)\n *         where\n *              R1(z) = degree 7 poly in z, (z=1/x^2)\n *              S1(z) = degree 8 poly in z\n *\n *      4. For x in [1/0.35,28]\n *              erfc(x) = (1/x)*exp(-x*x-0.5625+R2/S2) if x > 0\n *                      = 2.0 - (1/x)*exp(-x*x-0.5625+R2/S2) if -6<x<0\n *                      = 2.0 - tiny            (if x <= -6)\n *              erf(x)  = sign(x)*(1.0 - erfc(x)) if x < 6, else\n *              erf(x)  = sign(x)*(1.0 - tiny)\n *         where\n *              R2(z) = degree 6 poly in z, (z=1/x^2)\n *              S2(z) = degree 7 poly in z\n *\n *      Note1:\n *         To compute exp(-x*x-0.5625+R/S), let s be a single\n *         precision number and s := x; then\n *              -x*x = -s*s + (s-x)*(s+x)\n *              exp(-x*x-0.5626+R/S) =\n *                      exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S);\n *      Note2:\n *         Here 4 and 5 make use of the asymptotic series\n *                        exp(-x*x)\n *              erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) )\n *                        x*sqrt(pi)\n *         We use rational approximation to approximate\n *              g(s)=f(1/x^2) = log(erfc(x)*x) - x*x + 0.5625\n *         Here is the error bound for R1/S1 and R2/S2\n *              |R1/S1 - f(x)|  < 2**(-62.57)\n *              |R2/S2 - f(x)|  < 2**(-61.52)\n *\n *      5. For inf > x >= 28\n *              erf(x)  = sign(x) *(1 - tiny)  (raise inexact)\n *              erfc(x) = tiny*tiny (raise underflow) if x > 0\n *                      = 2 - tiny if x<0\n *\n *      7. Special case:\n *              erf(0)  = 0, erf(inf)  = 1, erf(-inf) = -1,\n *              erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2,\n *              erfc/erf(NaN) is NaN\n */\n\nconst ERX: f64 = 8.45062911510467529297e-01; /* 0x3FEB0AC1, 0x60000000 */\n/*\n * Coefficients for approximation to  erf on [0,0.84375]\n */\nconst EFX8: f64 = 1.02703333676410069053e+00; /* 0x3FF06EBA, 0x8214DB69 */\nconst PP0: f64 = 1.28379167095512558561e-01; /* 0x3FC06EBA, 0x8214DB68 */\nconst PP1: f64 = -3.25042107247001499370e-01; /* 0xBFD4CD7D, 0x691CB913 */\nconst PP2: f64 = -2.84817495755985104766e-02; /* 0xBF9D2A51, 0xDBD7194F */\nconst PP3: f64 = -5.77027029648944159157e-03; /* 0xBF77A291, 0x236668E4 */\nconst PP4: f64 = -2.37630166566501626084e-05; /* 0xBEF8EAD6, 0x120016AC */\nconst QQ1: f64 = 3.97917223959155352819e-01; /* 0x3FD97779, 0xCDDADC09 */\nconst QQ2: f64 = 6.50222499887672944485e-02; /* 0x3FB0A54C, 0x5536CEBA */\nconst QQ3: f64 = 5.08130628187576562776e-03; /* 0x3F74D022, 0xC4D36B0F */\nconst QQ4: f64 = 1.32494738004321644526e-04; /* 0x3F215DC9, 0x221C1A10 */\nconst QQ5: f64 = -3.96022827877536812320e-06; /* 0xBED09C43, 0x42A26120 */\n/*\n * Coefficients for approximation to  erf  in [0.84375,1.25]\n */\nconst PA0: f64 = -2.36211856075265944077e-03; /* 0xBF6359B8, 0xBEF77538 */\nconst PA1: f64 = 4.14856118683748331666e-01; /* 0x3FDA8D00, 0xAD92B34D */\nconst PA2: f64 = -3.72207876035701323847e-01; /* 0xBFD7D240, 0xFBB8C3F1 */\nconst PA3: f64 = 3.18346619901161753674e-01; /* 0x3FD45FCA, 0x805120E4 */\nconst PA4: f64 = -1.10894694282396677476e-01; /* 0xBFBC6398, 0x3D3E28EC */\nconst PA5: f64 = 3.54783043256182359371e-02; /* 0x3FA22A36, 0x599795EB */\nconst PA6: f64 = -2.16637559486879084300e-03; /* 0xBF61BF38, 0x0A96073F */\nconst QA1: f64 = 1.06420880400844228286e-01; /* 0x3FBB3E66, 0x18EEE323 */\nconst QA2: f64 = 5.40397917702171048937e-01; /* 0x3FE14AF0, 0x92EB6F33 */\nconst QA3: f64 = 7.18286544141962662868e-02; /* 0x3FB2635C, 0xD99FE9A7 */\nconst QA4: f64 = 1.26171219808761642112e-01; /* 0x3FC02660, 0xE763351F */\nconst QA5: f64 = 1.36370839120290507362e-02; /* 0x3F8BEDC2, 0x6B51DD1C */\nconst QA6: f64 = 1.19844998467991074170e-02; /* 0x3F888B54, 0x5735151D */\n/*\n * Coefficients for approximation to  erfc in [1.25,1/0.35]\n */\nconst RA0: f64 = -9.86494403484714822705e-03; /* 0xBF843412, 0x600D6435 */\nconst RA1: f64 = -6.93858572707181764372e-01; /* 0xBFE63416, 0xE4BA7360 */\nconst RA2: f64 = -1.05586262253232909814e+01; /* 0xC0251E04, 0x41B0E726 */\nconst RA3: f64 = -6.23753324503260060396e+01; /* 0xC04F300A, 0xE4CBA38D */\nconst RA4: f64 = -1.62396669462573470355e+02; /* 0xC0644CB1, 0x84282266 */\nconst RA5: f64 = -1.84605092906711035994e+02; /* 0xC067135C, 0xEBCCABB2 */\nconst RA6: f64 = -8.12874355063065934246e+01; /* 0xC0545265, 0x57E4D2F2 */\nconst RA7: f64 = -9.81432934416914548592e+00; /* 0xC023A0EF, 0xC69AC25C */\nconst SA1: f64 = 1.96512716674392571292e+01; /* 0x4033A6B9, 0xBD707687 */\nconst SA2: f64 = 1.37657754143519042600e+02; /* 0x4061350C, 0x526AE721 */\nconst SA3: f64 = 4.34565877475229228821e+02; /* 0x407B290D, 0xD58A1A71 */\nconst SA4: f64 = 6.45387271733267880336e+02; /* 0x40842B19, 0x21EC2868 */\nconst SA5: f64 = 4.29008140027567833386e+02; /* 0x407AD021, 0x57700314 */\nconst SA6: f64 = 1.08635005541779435134e+02; /* 0x405B28A3, 0xEE48AE2C */\nconst SA7: f64 = 6.57024977031928170135e+00; /* 0x401A47EF, 0x8E484A93 */\nconst SA8: f64 = -6.04244152148580987438e-02; /* 0xBFAEEFF2, 0xEE749A62 */\n/*\n * Coefficients for approximation to  erfc in [1/.35,28]\n */\nconst RB0: f64 = -9.86494292470009928597e-03; /* 0xBF843412, 0x39E86F4A */\nconst RB1: f64 = -7.99283237680523006574e-01; /* 0xBFE993BA, 0x70C285DE */\nconst RB2: f64 = -1.77579549177547519889e+01; /* 0xC031C209, 0x555F995A */\nconst RB3: f64 = -1.60636384855821916062e+02; /* 0xC064145D, 0x43C5ED98 */\nconst RB4: f64 = -6.37566443368389627722e+02; /* 0xC083EC88, 0x1375F228 */\nconst RB5: f64 = -1.02509513161107724954e+03; /* 0xC0900461, 0x6A2E5992 */\nconst RB6: f64 = -4.83519191608651397019e+02; /* 0xC07E384E, 0x9BDC383F */\nconst SB1: f64 = 3.03380607434824582924e+01; /* 0x403E568B, 0x261D5190 */\nconst SB2: f64 = 3.25792512996573918826e+02; /* 0x40745CAE, 0x221B9F0A */\nconst SB3: f64 = 1.53672958608443695994e+03; /* 0x409802EB, 0x189D5118 */\nconst SB4: f64 = 3.19985821950859553908e+03; /* 0x40A8FFB7, 0x688C246A */\nconst SB5: f64 = 2.55305040643316442583e+03; /* 0x40A3F219, 0xCEDF3BE6 */\nconst SB6: f64 = 4.74528541206955367215e+02; /* 0x407DA874, 0xE79FE763 */\nconst SB7: f64 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */\n\nfn erfc1(x: f64) -> f64 {\n    let s: f64;\n    let p: f64;\n    let q: f64;\n\n    s = fabs(x) - 1.0;\n    p = PA0 + s * (PA1 + s * (PA2 + s * (PA3 + s * (PA4 + s * (PA5 + s * PA6)))));\n    q = 1.0 + s * (QA1 + s * (QA2 + s * (QA3 + s * (QA4 + s * (QA5 + s * QA6)))));\n\n    1.0 - ERX - p / q\n}\n\nfn erfc2(ix: u32, mut x: f64) -> f64 {\n    let s: f64;\n    let r: f64;\n    let big_s: f64;\n    let z: f64;\n\n    if ix < 0x3ff40000 {\n        /* |x| < 1.25 */\n        return erfc1(x);\n    }\n\n    x = fabs(x);\n    s = 1.0 / (x * x);\n    if ix < 0x4006db6d {\n        /* |x| < 1/.35 ~ 2.85714 */\n        r = RA0 + s * (RA1 + s * (RA2 + s * (RA3 + s * (RA4 + s * (RA5 + s * (RA6 + s * RA7))))));\n        big_s = 1.0\n            + s * (SA1\n                + s * (SA2 + s * (SA3 + s * (SA4 + s * (SA5 + s * (SA6 + s * (SA7 + s * SA8)))))));\n    } else {\n        /* |x| > 1/.35 */\n        r = RB0 + s * (RB1 + s * (RB2 + s * (RB3 + s * (RB4 + s * (RB5 + s * RB6)))));\n        big_s =\n            1.0 + s * (SB1 + s * (SB2 + s * (SB3 + s * (SB4 + s * (SB5 + s * (SB6 + s * SB7))))));\n    }\n    z = with_set_low_word(x, 0);\n\n    exp(-z * z - 0.5625) * exp((z - x) * (z + x) + r / big_s) / x\n}\n\n/// Error function (f64)\n///\n/// Calculates an approximation to the “error function”, which estimates\n/// the probability that an observation will fall within x standard\n/// deviations of the mean (assuming a normal distribution).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn erf(x: f64) -> f64 {\n    let r: f64;\n    let s: f64;\n    let z: f64;\n    let y: f64;\n    let mut ix: u32;\n    let sign: usize;\n\n    ix = get_high_word(x);\n    sign = (ix >> 31) as usize;\n    ix &= 0x7fffffff;\n    if ix >= 0x7ff00000 {\n        /* erf(nan)=nan, erf(+-inf)=+-1 */\n        return 1.0 - 2.0 * (sign as f64) + 1.0 / x;\n    }\n    if ix < 0x3feb0000 {\n        /* |x| < 0.84375 */\n        if ix < 0x3e300000 {\n            /* |x| < 2**-28 */\n            /* avoid underflow */\n            return 0.125 * (8.0 * x + EFX8 * x);\n        }\n        z = x * x;\n        r = PP0 + z * (PP1 + z * (PP2 + z * (PP3 + z * PP4)));\n        s = 1.0 + z * (QQ1 + z * (QQ2 + z * (QQ3 + z * (QQ4 + z * QQ5))));\n        y = r / s;\n        return x + x * y;\n    }\n    if ix < 0x40180000 {\n        /* 0.84375 <= |x| < 6 */\n        y = 1.0 - erfc2(ix, x);\n    } else {\n        let x1p_1022 = f64::from_bits(0x0010000000000000);\n        y = 1.0 - x1p_1022;\n    }\n\n    if sign != 0 { -y } else { y }\n}\n\n/// Complementary error function (f64)\n///\n/// Calculates the complementary probability.\n/// Is `1 - erf(x)`. Is computed directly, so that you can use it to avoid\n/// the loss of precision that would result from subtracting\n/// large probabilities (on large `x`) from 1.\npub fn erfc(x: f64) -> f64 {\n    let r: f64;\n    let s: f64;\n    let z: f64;\n    let y: f64;\n    let mut ix: u32;\n    let sign: usize;\n\n    ix = get_high_word(x);\n    sign = (ix >> 31) as usize;\n    ix &= 0x7fffffff;\n    if ix >= 0x7ff00000 {\n        /* erfc(nan)=nan, erfc(+-inf)=0,2 */\n        return 2.0 * (sign as f64) + 1.0 / x;\n    }\n    if ix < 0x3feb0000 {\n        /* |x| < 0.84375 */\n        if ix < 0x3c700000 {\n            /* |x| < 2**-56 */\n            return 1.0 - x;\n        }\n        z = x * x;\n        r = PP0 + z * (PP1 + z * (PP2 + z * (PP3 + z * PP4)));\n        s = 1.0 + z * (QQ1 + z * (QQ2 + z * (QQ3 + z * (QQ4 + z * QQ5))));\n        y = r / s;\n        if sign != 0 || ix < 0x3fd00000 {\n            /* x < 1/4 */\n            return 1.0 - (x + x * y);\n        }\n        return 0.5 - (x - 0.5 + x * y);\n    }\n    if ix < 0x403c0000 {\n        /* 0.84375 <= |x| < 28 */\n        if sign != 0 {\n            return 2.0 - erfc2(ix, x);\n        } else {\n            return erfc2(ix, x);\n        }\n    }\n\n    let x1p_1022 = f64::from_bits(0x0010000000000000);\n    if sign != 0 {\n        2.0 - x1p_1022\n    } else {\n        x1p_1022 * x1p_1022\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/erff.rs",
    "sha256": "4b2ad0a35bff58fa849193161cd57ba83f9cb79e470ce69bcd650bbb66f7cbb0",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_erff.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{expf, fabsf};\n\nconst ERX: f32 = 8.4506291151e-01; /* 0x3f58560b */\n/*\n * Coefficients for approximation to  erf on [0,0.84375]\n */\nconst EFX8: f32 = 1.0270333290e+00; /* 0x3f8375d4 */\nconst PP0: f32 = 1.2837916613e-01; /* 0x3e0375d4 */\nconst PP1: f32 = -3.2504209876e-01; /* 0xbea66beb */\nconst PP2: f32 = -2.8481749818e-02; /* 0xbce9528f */\nconst PP3: f32 = -5.7702702470e-03; /* 0xbbbd1489 */\nconst PP4: f32 = -2.3763017452e-05; /* 0xb7c756b1 */\nconst QQ1: f32 = 3.9791721106e-01; /* 0x3ecbbbce */\nconst QQ2: f32 = 6.5022252500e-02; /* 0x3d852a63 */\nconst QQ3: f32 = 5.0813062117e-03; /* 0x3ba68116 */\nconst QQ4: f32 = 1.3249473704e-04; /* 0x390aee49 */\nconst QQ5: f32 = -3.9602282413e-06; /* 0xb684e21a */\n/*\n * Coefficients for approximation to  erf  in [0.84375,1.25]\n */\nconst PA0: f32 = -2.3621185683e-03; /* 0xbb1acdc6 */\nconst PA1: f32 = 4.1485610604e-01; /* 0x3ed46805 */\nconst PA2: f32 = -3.7220788002e-01; /* 0xbebe9208 */\nconst PA3: f32 = 3.1834661961e-01; /* 0x3ea2fe54 */\nconst PA4: f32 = -1.1089469492e-01; /* 0xbde31cc2 */\nconst PA5: f32 = 3.5478305072e-02; /* 0x3d1151b3 */\nconst PA6: f32 = -2.1663755178e-03; /* 0xbb0df9c0 */\nconst QA1: f32 = 1.0642088205e-01; /* 0x3dd9f331 */\nconst QA2: f32 = 5.4039794207e-01; /* 0x3f0a5785 */\nconst QA3: f32 = 7.1828655899e-02; /* 0x3d931ae7 */\nconst QA4: f32 = 1.2617121637e-01; /* 0x3e013307 */\nconst QA5: f32 = 1.3637083583e-02; /* 0x3c5f6e13 */\nconst QA6: f32 = 1.1984500103e-02; /* 0x3c445aa3 */\n/*\n * Coefficients for approximation to  erfc in [1.25,1/0.35]\n */\nconst RA0: f32 = -9.8649440333e-03; /* 0xbc21a093 */\nconst RA1: f32 = -6.9385856390e-01; /* 0xbf31a0b7 */\nconst RA2: f32 = -1.0558626175e+01; /* 0xc128f022 */\nconst RA3: f32 = -6.2375331879e+01; /* 0xc2798057 */\nconst RA4: f32 = -1.6239666748e+02; /* 0xc322658c */\nconst RA5: f32 = -1.8460508728e+02; /* 0xc3389ae7 */\nconst RA6: f32 = -8.1287437439e+01; /* 0xc2a2932b */\nconst RA7: f32 = -9.8143291473e+00; /* 0xc11d077e */\nconst SA1: f32 = 1.9651271820e+01; /* 0x419d35ce */\nconst SA2: f32 = 1.3765776062e+02; /* 0x4309a863 */\nconst SA3: f32 = 4.3456588745e+02; /* 0x43d9486f */\nconst SA4: f32 = 6.4538726807e+02; /* 0x442158c9 */\nconst SA5: f32 = 4.2900814819e+02; /* 0x43d6810b */\nconst SA6: f32 = 1.0863500214e+02; /* 0x42d9451f */\nconst SA7: f32 = 6.5702495575e+00; /* 0x40d23f7c */\nconst SA8: f32 = -6.0424413532e-02; /* 0xbd777f97 */\n/*\n * Coefficients for approximation to  erfc in [1/.35,28]\n */\nconst RB0: f32 = -9.8649431020e-03; /* 0xbc21a092 */\nconst RB1: f32 = -7.9928326607e-01; /* 0xbf4c9dd4 */\nconst RB2: f32 = -1.7757955551e+01; /* 0xc18e104b */\nconst RB3: f32 = -1.6063638306e+02; /* 0xc320a2ea */\nconst RB4: f32 = -6.3756646729e+02; /* 0xc41f6441 */\nconst RB5: f32 = -1.0250950928e+03; /* 0xc480230b */\nconst RB6: f32 = -4.8351919556e+02; /* 0xc3f1c275 */\nconst SB1: f32 = 3.0338060379e+01; /* 0x41f2b459 */\nconst SB2: f32 = 3.2579251099e+02; /* 0x43a2e571 */\nconst SB3: f32 = 1.5367296143e+03; /* 0x44c01759 */\nconst SB4: f32 = 3.1998581543e+03; /* 0x4547fdbb */\nconst SB5: f32 = 2.5530502930e+03; /* 0x451f90ce */\nconst SB6: f32 = 4.7452853394e+02; /* 0x43ed43a7 */\nconst SB7: f32 = -2.2440952301e+01; /* 0xc1b38712 */\n\nfn erfc1(x: f32) -> f32 {\n    let s: f32;\n    let p: f32;\n    let q: f32;\n\n    s = fabsf(x) - 1.0;\n    p = PA0 + s * (PA1 + s * (PA2 + s * (PA3 + s * (PA4 + s * (PA5 + s * PA6)))));\n    q = 1.0 + s * (QA1 + s * (QA2 + s * (QA3 + s * (QA4 + s * (QA5 + s * QA6)))));\n    return 1.0 - ERX - p / q;\n}\n\nfn erfc2(mut ix: u32, mut x: f32) -> f32 {\n    let s: f32;\n    let r: f32;\n    let big_s: f32;\n    let z: f32;\n\n    if ix < 0x3fa00000 {\n        /* |x| < 1.25 */\n        return erfc1(x);\n    }\n\n    x = fabsf(x);\n    s = 1.0 / (x * x);\n    if ix < 0x4036db6d {\n        /* |x| < 1/0.35 */\n        r = RA0 + s * (RA1 + s * (RA2 + s * (RA3 + s * (RA4 + s * (RA5 + s * (RA6 + s * RA7))))));\n        big_s = 1.0\n            + s * (SA1\n                + s * (SA2 + s * (SA3 + s * (SA4 + s * (SA5 + s * (SA6 + s * (SA7 + s * SA8)))))));\n    } else {\n        /* |x| >= 1/0.35 */\n        r = RB0 + s * (RB1 + s * (RB2 + s * (RB3 + s * (RB4 + s * (RB5 + s * RB6)))));\n        big_s =\n            1.0 + s * (SB1 + s * (SB2 + s * (SB3 + s * (SB4 + s * (SB5 + s * (SB6 + s * SB7))))));\n    }\n    ix = x.to_bits();\n    z = f32::from_bits(ix & 0xffffe000);\n\n    expf(-z * z - 0.5625) * expf((z - x) * (z + x) + r / big_s) / x\n}\n\n/// Error function (f32)\n///\n/// Calculates an approximation to the “error function”, which estimates\n/// the probability that an observation will fall within x standard\n/// deviations of the mean (assuming a normal distribution).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn erff(x: f32) -> f32 {\n    let r: f32;\n    let s: f32;\n    let z: f32;\n    let y: f32;\n    let mut ix: u32;\n    let sign: usize;\n\n    ix = x.to_bits();\n    sign = (ix >> 31) as usize;\n    ix &= 0x7fffffff;\n    if ix >= 0x7f800000 {\n        /* erf(nan)=nan, erf(+-inf)=+-1 */\n        return 1.0 - 2.0 * (sign as f32) + 1.0 / x;\n    }\n    if ix < 0x3f580000 {\n        /* |x| < 0.84375 */\n        if ix < 0x31800000 {\n            /* |x| < 2**-28 */\n            /*avoid underflow */\n            return 0.125 * (8.0 * x + EFX8 * x);\n        }\n        z = x * x;\n        r = PP0 + z * (PP1 + z * (PP2 + z * (PP3 + z * PP4)));\n        s = 1.0 + z * (QQ1 + z * (QQ2 + z * (QQ3 + z * (QQ4 + z * QQ5))));\n        y = r / s;\n        return x + x * y;\n    }\n    if ix < 0x40c00000 {\n        /* |x| < 6 */\n        y = 1.0 - erfc2(ix, x);\n    } else {\n        let x1p_120 = f32::from_bits(0x03800000);\n        y = 1.0 - x1p_120;\n    }\n\n    if sign != 0 { -y } else { y }\n}\n\n/// Complementary error function (f32)\n///\n/// Calculates the complementary probability.\n/// Is `1 - erf(x)`. Is computed directly, so that you can use it to avoid\n/// the loss of precision that would result from subtracting\n/// large probabilities (on large `x`) from 1.\npub fn erfcf(x: f32) -> f32 {\n    let r: f32;\n    let s: f32;\n    let z: f32;\n    let y: f32;\n    let mut ix: u32;\n    let sign: usize;\n\n    ix = x.to_bits();\n    sign = (ix >> 31) as usize;\n    ix &= 0x7fffffff;\n    if ix >= 0x7f800000 {\n        /* erfc(nan)=nan, erfc(+-inf)=0,2 */\n        return 2.0 * (sign as f32) + 1.0 / x;\n    }\n\n    if ix < 0x3f580000 {\n        /* |x| < 0.84375 */\n        if ix < 0x23800000 {\n            /* |x| < 2**-56 */\n            return 1.0 - x;\n        }\n        z = x * x;\n        r = PP0 + z * (PP1 + z * (PP2 + z * (PP3 + z * PP4)));\n        s = 1.0 + z * (QQ1 + z * (QQ2 + z * (QQ3 + z * (QQ4 + z * QQ5))));\n        y = r / s;\n        if sign != 0 || ix < 0x3e800000 {\n            /* x < 1/4 */\n            return 1.0 - (x + x * y);\n        }\n        return 0.5 - (x - 0.5 + x * y);\n    }\n    if ix < 0x41e00000 {\n        /* |x| < 28 */\n        if sign != 0 {\n            return 2.0 - erfc2(ix, x);\n        } else {\n            return erfc2(ix, x);\n        }\n    }\n\n    let x1p_120 = f32::from_bits(0x03800000);\n    if sign != 0 {\n        2.0 - x1p_120\n    } else {\n        x1p_120 * x1p_120\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/exp.rs",
    "sha256": "dcaff5a7c004944a526a6fd73fbbccf2a85261b9d850cfeb044854f2824fbe0e",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_exp.c */\n/*\n * ====================================================\n * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.\n *\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* exp(x)\n * Returns the exponential of x.\n *\n * Method\n *   1. Argument reduction:\n *      Reduce x to an r so that |r| <= 0.5*ln2 ~ 0.34658.\n *      Given x, find r and integer k such that\n *\n *               x = k*ln2 + r,  |r| <= 0.5*ln2.\n *\n *      Here r will be represented as r = hi-lo for better\n *      accuracy.\n *\n *   2. Approximation of exp(r) by a special rational function on\n *      the interval [0,0.34658]:\n *      Write\n *          R(r**2) = r*(exp(r)+1)/(exp(r)-1) = 2 + r*r/6 - r**4/360 + ...\n *      We use a special Remez algorithm on [0,0.34658] to generate\n *      a polynomial of degree 5 to approximate R. The maximum error\n *      of this polynomial approximation is bounded by 2**-59. In\n *      other words,\n *          R(z) ~ 2.0 + P1*z + P2*z**2 + P3*z**3 + P4*z**4 + P5*z**5\n *      (where z=r*r, and the values of P1 to P5 are listed below)\n *      and\n *          |                  5          |     -59\n *          | 2.0+P1*z+...+P5*z   -  R(z) | <= 2\n *          |                             |\n *      The computation of exp(r) thus becomes\n *                              2*r\n *              exp(r) = 1 + ----------\n *                            R(r) - r\n *                                 r*c(r)\n *                     = 1 + r + ----------- (for better accuracy)\n *                                2 - c(r)\n *      where\n *                              2       4             10\n *              c(r) = r - (P1*r  + P2*r  + ... + P5*r   ).\n *\n *   3. Scale back to obtain exp(x):\n *      From step 1, we have\n *         exp(x) = 2^k * exp(r)\n *\n * Special cases:\n *      exp(INF) is INF, exp(NaN) is NaN;\n *      exp(-INF) is 0, and\n *      for finite argument, only exp(0)=1 is exact.\n *\n * Accuracy:\n *      according to an error analysis, the error is always less than\n *      1 ulp (unit in the last place).\n *\n * Misc. info.\n *      For IEEE double\n *          if x >  709.782712893383973096 then exp(x) overflows\n *          if x < -745.133219101941108420 then exp(x) underflows\n */\n\nuse super::scalbn;\n\nconst HALF: [f64; 2] = [0.5, -0.5];\nconst LN2HI: f64 = 6.93147180369123816490e-01; /* 0x3fe62e42, 0xfee00000 */\nconst LN2LO: f64 = 1.90821492927058770002e-10; /* 0x3dea39ef, 0x35793c76 */\nconst INVLN2: f64 = 1.44269504088896338700e+00; /* 0x3ff71547, 0x652b82fe */\nconst P1: f64 = 1.66666666666666019037e-01; /* 0x3FC55555, 0x5555553E */\nconst P2: f64 = -2.77777777770155933842e-03; /* 0xBF66C16C, 0x16BEBD93 */\nconst P3: f64 = 6.61375632143793436117e-05; /* 0x3F11566A, 0xAF25DE2C */\nconst P4: f64 = -1.65339022054652515390e-06; /* 0xBEBBBD41, 0xC5D26BF1 */\nconst P5: f64 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */\n\n/// Exponential, base *e* (f64)\n///\n/// Calculate the exponential of `x`, that is, *e* raised to the power `x`\n/// (where *e* is the base of the natural system of logarithms, approximately 2.71828).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn exp(mut x: f64) -> f64 {\n    let x1p1023 = f64::from_bits(0x7fe0000000000000); // 0x1p1023 === 2 ^ 1023\n    let x1p_149 = f64::from_bits(0x36a0000000000000); // 0x1p-149 === 2 ^ -149\n\n    let hi: f64;\n    let lo: f64;\n    let c: f64;\n    let xx: f64;\n    let y: f64;\n    let k: i32;\n    let sign: i32;\n    let mut hx: u32;\n\n    hx = (x.to_bits() >> 32) as u32;\n    sign = (hx >> 31) as i32;\n    hx &= 0x7fffffff; /* high word of |x| */\n\n    /* special cases */\n    if hx >= 0x4086232b {\n        /* if |x| >= 708.39... */\n        if x.is_nan() {\n            return x;\n        }\n        if x > 709.782712893383973096 {\n            /* overflow if x!=inf */\n            x *= x1p1023;\n            return x;\n        }\n        if x < -708.39641853226410622 {\n            /* underflow if x!=-inf */\n            force_eval!((-x1p_149 / x) as f32);\n            if x < -745.13321910194110842 {\n                return 0.;\n            }\n        }\n    }\n\n    /* argument reduction */\n    if hx > 0x3fd62e42 {\n        /* if |x| > 0.5 ln2 */\n        if hx >= 0x3ff0a2b2 {\n            /* if |x| >= 1.5 ln2 */\n            k = (INVLN2 * x + i!(HALF, sign as usize)) as i32;\n        } else {\n            k = 1 - sign - sign;\n        }\n        hi = x - k as f64 * LN2HI; /* k*ln2hi is exact here */\n        lo = k as f64 * LN2LO;\n        x = hi - lo;\n    } else if hx > 0x3e300000 {\n        /* if |x| > 2**-28 */\n        k = 0;\n        hi = x;\n        lo = 0.;\n    } else {\n        /* inexact if x!=0 */\n        force_eval!(x1p1023 + x);\n        return 1. + x;\n    }\n\n    /* x is now in primary range */\n    xx = x * x;\n    c = x - xx * (P1 + xx * (P2 + xx * (P3 + xx * (P4 + xx * P5))));\n    y = 1. + (x * c / (2. - c) - lo + hi);\n    if k == 0 { y } else { scalbn(y, k) }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/exp2.rs",
    "sha256": "48bd9acfe1f838a8b0a9199c0da23aabcaed1c657c57d33a2b590b7275950303",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/s_exp2.c */\n//-\n// Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions\n// are met:\n// 1. Redistributions of source code must retain the above copyright\n//    notice, this list of conditions and the following disclaimer.\n// 2. Redistributions in binary form must reproduce the above copyright\n//    notice, this list of conditions and the following disclaimer in the\n//    documentation and/or other materials provided with the distribution.\n//\n// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n// SUCH DAMAGE.\n\nuse super::scalbn;\n\nconst TBLSIZE: usize = 256;\n\n#[rustfmt::skip]\nstatic TBL: [u64; TBLSIZE * 2] = [\n    //  exp2(z + eps)          eps\n    0x3fe6a09e667f3d5d, 0x3d39880000000000,\n    0x3fe6b052fa751744, 0x3cd8000000000000,\n    0x3fe6c012750bd9fe, 0xbd28780000000000,\n    0x3fe6cfdcddd476bf, 0x3d1ec00000000000,\n    0x3fe6dfb23c651a29, 0xbcd8000000000000,\n    0x3fe6ef9298593ae3, 0xbcbc000000000000,\n    0x3fe6ff7df9519386, 0xbd2fd80000000000,\n    0x3fe70f7466f42da3, 0xbd2c880000000000,\n    0x3fe71f75e8ec5fc3, 0x3d13c00000000000,\n    0x3fe72f8286eacf05, 0xbd38300000000000,\n    0x3fe73f9a48a58152, 0xbd00c00000000000,\n    0x3fe74fbd35d7ccfc, 0x3d2f880000000000,\n    0x3fe75feb564267f1, 0x3d03e00000000000,\n    0x3fe77024b1ab6d48, 0xbd27d00000000000,\n    0x3fe780694fde5d38, 0xbcdd000000000000,\n    0x3fe790b938ac1d00, 0x3ce3000000000000,\n    0x3fe7a11473eb0178, 0xbced000000000000,\n    0x3fe7b17b0976d060, 0x3d20400000000000,\n    0x3fe7c1ed0130c133, 0x3ca0000000000000,\n    0x3fe7d26a62ff8636, 0xbd26900000000000,\n    0x3fe7e2f336cf4e3b, 0xbd02e00000000000,\n    0x3fe7f3878491c3e8, 0xbd24580000000000,\n    0x3fe80427543e1b4e, 0x3d33000000000000,\n    0x3fe814d2add1071a, 0x3d0f000000000000,\n    0x3fe82589994ccd7e, 0xbd21c00000000000,\n    0x3fe8364c1eb942d0, 0x3d29d00000000000,\n    0x3fe8471a4623cab5, 0x3d47100000000000,\n    0x3fe857f4179f5bbc, 0x3d22600000000000,\n    0x3fe868d99b4491af, 0xbd32c40000000000,\n    0x3fe879cad931a395, 0xbd23000000000000,\n    0x3fe88ac7d98a65b8, 0xbd2a800000000000,\n    0x3fe89bd0a4785800, 0xbced000000000000,\n    0x3fe8ace5422aa223, 0x3d33280000000000,\n    0x3fe8be05bad619fa, 0x3d42b40000000000,\n    0x3fe8cf3216b54383, 0xbd2ed00000000000,\n    0x3fe8e06a5e08664c, 0xbd20500000000000,\n    0x3fe8f1ae99157807, 0x3d28280000000000,\n    0x3fe902fed0282c0e, 0xbd1cb00000000000,\n    0x3fe9145b0b91ff96, 0xbd05e00000000000,\n    0x3fe925c353aa2ff9, 0x3cf5400000000000,\n    0x3fe93737b0cdc64a, 0x3d17200000000000,\n    0x3fe948b82b5f98ae, 0xbd09000000000000,\n    0x3fe95a44cbc852cb, 0x3d25680000000000,\n    0x3fe96bdd9a766f21, 0xbd36d00000000000,\n    0x3fe97d829fde4e2a, 0xbd01000000000000,\n    0x3fe98f33e47a23a3, 0x3d2d000000000000,\n    0x3fe9a0f170ca0604, 0xbd38a40000000000,\n    0x3fe9b2bb4d53ff89, 0x3d355c0000000000,\n    0x3fe9c49182a3f15b, 0x3d26b80000000000,\n    0x3fe9d674194bb8c5, 0xbcec000000000000,\n    0x3fe9e86319e3238e, 0x3d17d00000000000,\n    0x3fe9fa5e8d07f302, 0x3d16400000000000,\n    0x3fea0c667b5de54d, 0xbcf5000000000000,\n    0x3fea1e7aed8eb8f6, 0x3d09e00000000000,\n    0x3fea309bec4a2e27, 0x3d2ad80000000000,\n    0x3fea42c980460a5d, 0xbd1af00000000000,\n    0x3fea5503b23e259b, 0x3d0b600000000000,\n    0x3fea674a8af46213, 0x3d38880000000000,\n    0x3fea799e1330b3a7, 0x3d11200000000000,\n    0x3fea8bfe53c12e8d, 0x3d06c00000000000,\n    0x3fea9e6b5579fcd2, 0xbd29b80000000000,\n    0x3feab0e521356fb8, 0x3d2b700000000000,\n    0x3feac36bbfd3f381, 0x3cd9000000000000,\n    0x3fead5ff3a3c2780, 0x3ce4000000000000,\n    0x3feae89f995ad2a3, 0xbd2c900000000000,\n    0x3feafb4ce622f367, 0x3d16500000000000,\n    0x3feb0e07298db790, 0x3d2fd40000000000,\n    0x3feb20ce6c9a89a9, 0x3d12700000000000,\n    0x3feb33a2b84f1a4b, 0x3d4d470000000000,\n    0x3feb468415b747e7, 0xbd38380000000000,\n    0x3feb59728de5593a, 0x3c98000000000000,\n    0x3feb6c6e29f1c56a, 0x3d0ad00000000000,\n    0x3feb7f76f2fb5e50, 0x3cde800000000000,\n    0x3feb928cf22749b2, 0xbd04c00000000000,\n    0x3feba5b030a10603, 0xbd0d700000000000,\n    0x3febb8e0b79a6f66, 0x3d0d900000000000,\n    0x3febcc1e904bc1ff, 0x3d02a00000000000,\n    0x3febdf69c3f3a16f, 0xbd1f780000000000,\n    0x3febf2c25bd71db8, 0xbd10a00000000000,\n    0x3fec06286141b2e9, 0xbd11400000000000,\n    0x3fec199bdd8552e0, 0x3d0be00000000000,\n    0x3fec2d1cd9fa64ee, 0xbd09400000000000,\n    0x3fec40ab5fffd02f, 0xbd0ed00000000000,\n    0x3fec544778fafd15, 0x3d39660000000000,\n    0x3fec67f12e57d0cb, 0xbd1a100000000000,\n    0x3fec7ba88988c1b6, 0xbd58458000000000,\n    0x3fec8f6d9406e733, 0xbd1a480000000000,\n    0x3feca3405751c4df, 0x3ccb000000000000,\n    0x3fecb720dcef9094, 0x3d01400000000000,\n    0x3feccb0f2e6d1689, 0x3cf0200000000000,\n    0x3fecdf0b555dc412, 0x3cf3600000000000,\n    0x3fecf3155b5bab3b, 0xbd06900000000000,\n    0x3fed072d4a0789bc, 0x3d09a00000000000,\n    0x3fed1b532b08c8fa, 0xbd15e00000000000,\n    0x3fed2f87080d8a85, 0x3d1d280000000000,\n    0x3fed43c8eacaa203, 0x3d01a00000000000,\n    0x3fed5818dcfba491, 0x3cdf000000000000,\n    0x3fed6c76e862e6a1, 0xbd03a00000000000,\n    0x3fed80e316c9834e, 0xbd0cd80000000000,\n    0x3fed955d71ff6090, 0x3cf4c00000000000,\n    0x3feda9e603db32ae, 0x3cff900000000000,\n    0x3fedbe7cd63a8325, 0x3ce9800000000000,\n    0x3fedd321f301b445, 0xbcf5200000000000,\n    0x3fede7d5641c05bf, 0xbd1d700000000000,\n    0x3fedfc97337b9aec, 0xbd16140000000000,\n    0x3fee11676b197d5e, 0x3d0b480000000000,\n    0x3fee264614f5a3e7, 0x3d40ce0000000000,\n    0x3fee3b333b16ee5c, 0x3d0c680000000000,\n    0x3fee502ee78b3fb4, 0xbd09300000000000,\n    0x3fee653924676d68, 0xbce5000000000000,\n    0x3fee7a51fbc74c44, 0xbd07f80000000000,\n    0x3fee8f7977cdb726, 0xbcf3700000000000,\n    0x3feea4afa2a490e8, 0x3ce5d00000000000,\n    0x3feeb9f4867ccae4, 0x3d161a0000000000,\n    0x3feecf482d8e680d, 0x3cf5500000000000,\n    0x3feee4aaa2188514, 0x3cc6400000000000,\n    0x3feefa1bee615a13, 0xbcee800000000000,\n    0x3fef0f9c1cb64106, 0xbcfa880000000000,\n    0x3fef252b376bb963, 0xbd2c900000000000,\n    0x3fef3ac948dd7275, 0x3caa000000000000,\n    0x3fef50765b6e4524, 0xbcf4f00000000000,\n    0x3fef6632798844fd, 0x3cca800000000000,\n    0x3fef7bfdad9cbe38, 0x3cfabc0000000000,\n    0x3fef91d802243c82, 0xbcd4600000000000,\n    0x3fefa7c1819e908e, 0xbd0b0c0000000000,\n    0x3fefbdba3692d511, 0xbcc0e00000000000,\n    0x3fefd3c22b8f7194, 0xbd10de8000000000,\n    0x3fefe9d96b2a23ee, 0x3cee430000000000,\n    0x3ff0000000000000, 0x0,\n    0x3ff00b1afa5abcbe, 0xbcb3400000000000,\n    0x3ff0163da9fb3303, 0xbd12170000000000,\n    0x3ff02168143b0282, 0x3cba400000000000,\n    0x3ff02c9a3e77806c, 0x3cef980000000000,\n    0x3ff037d42e11bbca, 0xbcc7400000000000,\n    0x3ff04315e86e7f89, 0x3cd8300000000000,\n    0x3ff04e5f72f65467, 0xbd1a3f0000000000,\n    0x3ff059b0d315855a, 0xbd02840000000000,\n    0x3ff0650a0e3c1f95, 0x3cf1600000000000,\n    0x3ff0706b29ddf71a, 0x3d15240000000000,\n    0x3ff07bd42b72a82d, 0xbce9a00000000000,\n    0x3ff0874518759bd0, 0x3ce6400000000000,\n    0x3ff092bdf66607c8, 0xbd00780000000000,\n    0x3ff09e3ecac6f383, 0xbc98000000000000,\n    0x3ff0a9c79b1f3930, 0x3cffa00000000000,\n    0x3ff0b5586cf988fc, 0xbcfac80000000000,\n    0x3ff0c0f145e46c8a, 0x3cd9c00000000000,\n    0x3ff0cc922b724816, 0x3d05200000000000,\n    0x3ff0d83b23395dd8, 0xbcfad00000000000,\n    0x3ff0e3ec32d3d1f3, 0x3d1bac0000000000,\n    0x3ff0efa55fdfa9a6, 0xbd04e80000000000,\n    0x3ff0fb66affed2f0, 0xbd0d300000000000,\n    0x3ff1073028d7234b, 0x3cf1500000000000,\n    0x3ff11301d0125b5b, 0x3cec000000000000,\n    0x3ff11edbab5e2af9, 0x3d16bc0000000000,\n    0x3ff12abdc06c31d5, 0x3ce8400000000000,\n    0x3ff136a814f2047d, 0xbd0ed00000000000,\n    0x3ff1429aaea92de9, 0x3ce8e00000000000,\n    0x3ff14e95934f3138, 0x3ceb400000000000,\n    0x3ff15a98c8a58e71, 0x3d05300000000000,\n    0x3ff166a45471c3df, 0x3d03380000000000,\n    0x3ff172b83c7d5211, 0x3d28d40000000000,\n    0x3ff17ed48695bb9f, 0xbd05d00000000000,\n    0x3ff18af9388c8d93, 0xbd1c880000000000,\n    0x3ff1972658375d66, 0x3d11f00000000000,\n    0x3ff1a35beb6fcba7, 0x3d10480000000000,\n    0x3ff1af99f81387e3, 0xbd47390000000000,\n    0x3ff1bbe084045d54, 0x3d24e40000000000,\n    0x3ff1c82f95281c43, 0xbd0a200000000000,\n    0x3ff1d4873168b9b2, 0x3ce3800000000000,\n    0x3ff1e0e75eb44031, 0x3ceac00000000000,\n    0x3ff1ed5022fcd938, 0x3d01900000000000,\n    0x3ff1f9c18438cdf7, 0xbd1b780000000000,\n    0x3ff2063b88628d8f, 0x3d2d940000000000,\n    0x3ff212be3578a81e, 0x3cd8000000000000,\n    0x3ff21f49917ddd41, 0x3d2b340000000000,\n    0x3ff22bdda2791323, 0x3d19f80000000000,\n    0x3ff2387a6e7561e7, 0xbd19c80000000000,\n    0x3ff2451ffb821427, 0x3d02300000000000,\n    0x3ff251ce4fb2a602, 0xbd13480000000000,\n    0x3ff25e85711eceb0, 0x3d12700000000000,\n    0x3ff26b4565e27d16, 0x3d11d00000000000,\n    0x3ff2780e341de00f, 0x3d31ee0000000000,\n    0x3ff284dfe1f5633e, 0xbd14c00000000000,\n    0x3ff291ba7591bb30, 0xbd13d80000000000,\n    0x3ff29e9df51fdf09, 0x3d08b00000000000,\n    0x3ff2ab8a66d10e9b, 0xbd227c0000000000,\n    0x3ff2b87fd0dada3a, 0x3d2a340000000000,\n    0x3ff2c57e39771af9, 0xbd10800000000000,\n    0x3ff2d285a6e402d9, 0xbd0ed00000000000,\n    0x3ff2df961f641579, 0xbcf4200000000000,\n    0x3ff2ecafa93e2ecf, 0xbd24980000000000,\n    0x3ff2f9d24abd8822, 0xbd16300000000000,\n    0x3ff306fe0a31b625, 0xbd32360000000000,\n    0x3ff31432edeea50b, 0xbd70df8000000000,\n    0x3ff32170fc4cd7b8, 0xbd22480000000000,\n    0x3ff32eb83ba8e9a2, 0xbd25980000000000,\n    0x3ff33c08b2641766, 0x3d1ed00000000000,\n    0x3ff3496266e3fa27, 0xbcdc000000000000,\n    0x3ff356c55f929f0f, 0xbd30d80000000000,\n    0x3ff36431a2de88b9, 0x3d22c80000000000,\n    0x3ff371a7373aaa39, 0x3d20600000000000,\n    0x3ff37f26231e74fe, 0xbd16600000000000,\n    0x3ff38cae6d05d838, 0xbd0ae00000000000,\n    0x3ff39a401b713ec3, 0xbd44720000000000,\n    0x3ff3a7db34e5a020, 0x3d08200000000000,\n    0x3ff3b57fbfec6e95, 0x3d3e800000000000,\n    0x3ff3c32dc313a8f2, 0x3cef800000000000,\n    0x3ff3d0e544ede122, 0xbd17a00000000000,\n    0x3ff3dea64c1234bb, 0x3d26300000000000,\n    0x3ff3ec70df1c4ecc, 0xbd48a60000000000,\n    0x3ff3fa4504ac7e8c, 0xbd3cdc0000000000,\n    0x3ff40822c367a0bb, 0x3d25b80000000000,\n    0x3ff4160a21f72e95, 0x3d1ec00000000000,\n    0x3ff423fb27094646, 0xbd13600000000000,\n    0x3ff431f5d950a920, 0x3d23980000000000,\n    0x3ff43ffa3f84b9eb, 0x3cfa000000000000,\n    0x3ff44e0860618919, 0xbcf6c00000000000,\n    0x3ff45c2042a7d201, 0xbd0bc00000000000,\n    0x3ff46a41ed1d0016, 0xbd12800000000000,\n    0x3ff4786d668b3326, 0x3d30e00000000000,\n    0x3ff486a2b5c13c00, 0xbd2d400000000000,\n    0x3ff494e1e192af04, 0x3d0c200000000000,\n    0x3ff4a32af0d7d372, 0xbd1e500000000000,\n    0x3ff4b17dea6db801, 0x3d07800000000000,\n    0x3ff4bfdad53629e1, 0xbd13800000000000,\n    0x3ff4ce41b817c132, 0x3d00800000000000,\n    0x3ff4dcb299fddddb, 0x3d2c700000000000,\n    0x3ff4eb2d81d8ab96, 0xbd1ce00000000000,\n    0x3ff4f9b2769d2d02, 0x3d19200000000000,\n    0x3ff508417f4531c1, 0xbd08c00000000000,\n    0x3ff516daa2cf662a, 0xbcfa000000000000,\n    0x3ff5257de83f51ea, 0x3d4a080000000000,\n    0x3ff5342b569d4eda, 0xbd26d80000000000,\n    0x3ff542e2f4f6ac1a, 0xbd32440000000000,\n    0x3ff551a4ca5d94db, 0x3d483c0000000000,\n    0x3ff56070dde9116b, 0x3d24b00000000000,\n    0x3ff56f4736b529de, 0x3d415a0000000000,\n    0x3ff57e27dbe2c40e, 0xbd29e00000000000,\n    0x3ff58d12d497c76f, 0xbd23080000000000,\n    0x3ff59c0827ff0b4c, 0x3d4dec0000000000,\n    0x3ff5ab07dd485427, 0xbcc4000000000000,\n    0x3ff5ba11fba87af4, 0x3d30080000000000,\n    0x3ff5c9268a59460b, 0xbd26c80000000000,\n    0x3ff5d84590998e3f, 0x3d469a0000000000,\n    0x3ff5e76f15ad20e1, 0xbd1b400000000000,\n    0x3ff5f6a320dcebca, 0x3d17700000000000,\n    0x3ff605e1b976dcb8, 0x3d26f80000000000,\n    0x3ff6152ae6cdf715, 0x3d01000000000000,\n    0x3ff6247eb03a5531, 0xbd15d00000000000,\n    0x3ff633dd1d1929b5, 0xbd12d00000000000,\n    0x3ff6434634ccc313, 0xbcea800000000000,\n    0x3ff652b9febc8efa, 0xbd28600000000000,\n    0x3ff6623882553397, 0x3d71fe0000000000,\n    0x3ff671c1c708328e, 0xbd37200000000000,\n    0x3ff68155d44ca97e, 0x3ce6800000000000,\n    0x3ff690f4b19e9471, 0xbd29780000000000,\n];\n\n// exp2(x): compute the base 2 exponential of x\n//\n// Accuracy: Peak error < 0.503 ulp for normalized results.\n//\n// Method: (accurate tables)\n//\n//   Reduce x:\n//     x = k + y, for integer k and |y| <= 1/2.\n//     Thus we have exp2(x) = 2**k * exp2(y).\n//\n//   Reduce y:\n//     y = i/TBLSIZE + z - eps[i] for integer i near y * TBLSIZE.\n//     Thus we have exp2(y) = exp2(i/TBLSIZE) * exp2(z - eps[i]),\n//     with |z - eps[i]| <= 2**-9 + 2**-39 for the table used.\n//\n//   We compute exp2(i/TBLSIZE) via table lookup and exp2(z - eps[i]) via\n//   a degree-5 minimax polynomial with maximum error under 1.3 * 2**-61.\n//   The values in exp2t[] and eps[] are chosen such that\n//   exp2t[i] = exp2(i/TBLSIZE + eps[i]), and eps[i] is a small offset such\n//   that exp2t[i] is accurate to 2**-64.\n//\n//   Note that the range of i is +-TBLSIZE/2, so we actually index the tables\n//   by i0 = i + TBLSIZE/2.  For cache efficiency, exp2t[] and eps[] are\n//   virtual tables, interleaved in the real table tbl[].\n//\n//   This method is due to Gal, with many details due to Gal and Bachelis:\n//\n//      Gal, S. and Bachelis, B.  An Accurate Elementary Mathematical Library\n//      for the IEEE Floating Point Standard.  TOMS 17(1), 26-46 (1991).\n\n/// Exponential, base 2 (f64)\n///\n/// Calculate `2^x`, that is, 2 raised to the power `x`.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn exp2(mut x: f64) -> f64 {\n    let redux = f64::from_bits(0x4338000000000000) / TBLSIZE as f64;\n    let p1 = f64::from_bits(0x3fe62e42fefa39ef);\n    let p2 = f64::from_bits(0x3fcebfbdff82c575);\n    let p3 = f64::from_bits(0x3fac6b08d704a0a6);\n    let p4 = f64::from_bits(0x3f83b2ab88f70400);\n    let p5 = f64::from_bits(0x3f55d88003875c74);\n\n    // double_t r, t, z;\n    // uint32_t ix, i0;\n    // union {double f; uint64_t i;} u = {x};\n    // union {uint32_t u; int32_t i;} k;\n    let x1p1023 = f64::from_bits(0x7fe0000000000000);\n    let x1p52 = f64::from_bits(0x4330000000000000);\n    let _0x1p_149 = f64::from_bits(0xb6a0000000000000);\n\n    /* Filter out exceptional cases. */\n    let ui = f64::to_bits(x);\n    let ix = (ui >> 32) & 0x7fffffff;\n    if ix >= 0x408ff000 {\n        /* |x| >= 1022 or nan */\n        if ix >= 0x40900000 && ui >> 63 == 0 {\n            /* x >= 1024 or nan */\n            /* overflow */\n            x *= x1p1023;\n            return x;\n        }\n        if ix >= 0x7ff00000 {\n            /* -inf or -nan */\n            return -1.0 / x;\n        }\n        if ui >> 63 != 0 {\n            /* x <= -1022 */\n            /* underflow */\n            if x <= -1075.0 || x - x1p52 + x1p52 != x {\n                force_eval!((_0x1p_149 / x) as f32);\n            }\n            if x <= -1075.0 {\n                return 0.0;\n            }\n        }\n    } else if ix < 0x3c900000 {\n        /* |x| < 0x1p-54 */\n        return 1.0 + x;\n    }\n\n    /* Reduce x, computing z, i0, and k. */\n    let ui = f64::to_bits(x + redux);\n    let mut i0 = ui as u32;\n    i0 = i0.wrapping_add(TBLSIZE as u32 / 2);\n    let ku = i0 / TBLSIZE as u32 * TBLSIZE as u32;\n    let ki = div!(ku as i32, TBLSIZE as i32);\n    i0 %= TBLSIZE as u32;\n    let uf = f64::from_bits(ui) - redux;\n    let mut z = x - uf;\n\n    /* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */\n    let t = f64::from_bits(i!(TBL, 2 * i0 as usize)); /* exp2t[i0] */\n    z -= f64::from_bits(i!(TBL, 2 * i0 as usize + 1)); /* eps[i0]   */\n    let r = t + t * z * (p1 + z * (p2 + z * (p3 + z * (p4 + z * p5))));\n\n    scalbn(r, ki)\n}\n\n#[test]\nfn i0_wrap_test() {\n    let x = -3.0 / 256.0;\n    assert_eq!(exp2(x), f64::from_bits(0x3fefbdba3692d514));\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/exp2f.rs",
    "sha256": "faba44a87eb4ef7d17846e217d747a8e68b9b8ebaded5bc869a3878067712814",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/s_exp2f.c\n//-\n// Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions\n// are met:\n// 1. Redistributions of source code must retain the above copyright\n//    notice, this list of conditions and the following disclaimer.\n// 2. Redistributions in binary form must reproduce the above copyright\n//    notice, this list of conditions and the following disclaimer in the\n//    documentation and/or other materials provided with the distribution.\n//\n// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n// ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n// SUCH DAMAGE.\n\nconst TBLSIZE: usize = 16;\n\nstatic EXP2FT: [u64; TBLSIZE] = [\n    0x3fe6a09e667f3bcd,\n    0x3fe7a11473eb0187,\n    0x3fe8ace5422aa0db,\n    0x3fe9c49182a3f090,\n    0x3feae89f995ad3ad,\n    0x3fec199bdd85529c,\n    0x3fed5818dcfba487,\n    0x3feea4afa2a490da,\n    0x3ff0000000000000,\n    0x3ff0b5586cf9890f,\n    0x3ff172b83c7d517b,\n    0x3ff2387a6e756238,\n    0x3ff306fe0a31b715,\n    0x3ff3dea64c123422,\n    0x3ff4bfdad5362a27,\n    0x3ff5ab07dd485429,\n];\n\n// exp2f(x): compute the base 2 exponential of x\n//\n// Accuracy: Peak error < 0.501 ulp; location of peak: -0.030110927.\n//\n// Method: (equally-spaced tables)\n//\n//   Reduce x:\n//     x = k + y, for integer k and |y| <= 1/2.\n//     Thus we have exp2f(x) = 2**k * exp2(y).\n//\n//   Reduce y:\n//     y = i/TBLSIZE + z for integer i near y * TBLSIZE.\n//     Thus we have exp2(y) = exp2(i/TBLSIZE) * exp2(z),\n//     with |z| <= 2**-(TBLSIZE+1).\n//\n//   We compute exp2(i/TBLSIZE) via table lookup and exp2(z) via a\n//   degree-4 minimax polynomial with maximum error under 1.4 * 2**-33.\n//   Using double precision for everything except the reduction makes\n//   roundoff error insignificant and simplifies the scaling step.\n//\n//   This method is due to Tang, but I do not use his suggested parameters:\n//\n//      Tang, P.  Table-driven Implementation of the Exponential Function\n//      in IEEE Floating-Point Arithmetic.  TOMS 15(2), 144-157 (1989).\n\n/// Exponential, base 2 (f32)\n///\n/// Calculate `2^x`, that is, 2 raised to the power `x`.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn exp2f(mut x: f32) -> f32 {\n    let redux = f32::from_bits(0x4b400000) / TBLSIZE as f32;\n    let p1 = f32::from_bits(0x3f317218);\n    let p2 = f32::from_bits(0x3e75fdf0);\n    let p3 = f32::from_bits(0x3d6359a4);\n    let p4 = f32::from_bits(0x3c1d964e);\n\n    // double_t t, r, z;\n    // uint32_t ix, i0, k;\n\n    let x1p127 = f32::from_bits(0x7f000000);\n\n    /* Filter out exceptional cases. */\n    let ui = f32::to_bits(x);\n    let ix = ui & 0x7fffffff;\n    if ix > 0x42fc0000 {\n        /* |x| > 126 */\n        if ix > 0x7f800000 {\n            /* NaN */\n            return x;\n        }\n        if (0x43000000..0x80000000).contains(&ui) {\n            /* x >= 128 */\n            x *= x1p127;\n            return x;\n        }\n        if ui >= 0x80000000 {\n            /* x < -126 */\n            if ui >= 0xc3160000 || (ui & 0x0000ffff != 0) {\n                force_eval!(f32::from_bits(0x80000001) / x);\n            }\n            if ui >= 0xc3160000 {\n                /* x <= -150 */\n                return 0.0;\n            }\n        }\n    } else if ix <= 0x33000000 {\n        /* |x| <= 0x1p-25 */\n        return 1.0 + x;\n    }\n\n    /* Reduce x, computing z, i0, and k. */\n    let ui = f32::to_bits(x + redux);\n    let mut i0 = ui;\n    i0 += TBLSIZE as u32 / 2;\n    let k = i0 / TBLSIZE as u32;\n    let ukf = f64::from_bits(((0x3ff + k) as u64) << 52);\n    i0 &= TBLSIZE as u32 - 1;\n    let mut uf = f32::from_bits(ui);\n    uf -= redux;\n    let z: f64 = (x - uf) as f64;\n    /* Compute r = exp2(y) = exp2ft[i0] * p(z). */\n    let r: f64 = f64::from_bits(i!(EXP2FT, i0 as usize));\n    let t: f64 = r * z;\n    let r: f64 = r + t * (p1 as f64 + z * p2 as f64) + t * (z * z) * (p3 as f64 + z * p4 as f64);\n\n    /* Scale by 2**k */\n    (r * ukf) as f32\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/expf.rs",
    "sha256": "bbae85acadd2f2a0b7facbf591551f52c936420bb6779672c609cbfd8de0900f",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_expf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::scalbnf;\n\nconst HALF: [f32; 2] = [0.5, -0.5];\nconst LN2_HI: f32 = 6.9314575195e-01; /* 0x3f317200 */\nconst LN2_LO: f32 = 1.4286067653e-06; /* 0x35bfbe8e */\nconst INV_LN2: f32 = 1.4426950216e+00; /* 0x3fb8aa3b */\n/*\n * Domain [-0.34568, 0.34568], range ~[-4.278e-9, 4.447e-9]:\n * |x*(exp(x)+1)/(exp(x)-1) - p(x)| < 2**-27.74\n */\nconst P1: f32 = 1.6666625440e-1; /*  0xaaaa8f.0p-26 */\nconst P2: f32 = -2.7667332906e-3; /* -0xb55215.0p-32 */\n\n/// Exponential, base *e* (f32)\n///\n/// Calculate the exponential of `x`, that is, *e* raised to the power `x`\n/// (where *e* is the base of the natural system of logarithms, approximately 2.71828).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn expf(mut x: f32) -> f32 {\n    let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127\n    let x1p_126 = f32::from_bits(0x800000); // 0x1p-126f === 2 ^ -126  /*original 0x1p-149f    ??????????? */\n    let mut hx = x.to_bits();\n    let sign = (hx >> 31) as i32; /* sign bit of x */\n    let signb: bool = sign != 0;\n    hx &= 0x7fffffff; /* high word of |x| */\n\n    /* special cases */\n    if hx >= 0x42aeac50 {\n        /* if |x| >= -87.33655f or NaN */\n        if hx > 0x7f800000 {\n            /* NaN */\n            return x;\n        }\n        if (hx >= 0x42b17218) && (!signb) {\n            /* x >= 88.722839f */\n            /* overflow */\n            x *= x1p127;\n            return x;\n        }\n        if signb {\n            /* underflow */\n            force_eval!(-x1p_126 / x);\n            if hx >= 0x42cff1b5 {\n                /* x <= -103.972084f */\n                return 0.;\n            }\n        }\n    }\n\n    /* argument reduction */\n    let k: i32;\n    let hi: f32;\n    let lo: f32;\n    if hx > 0x3eb17218 {\n        /* if |x| > 0.5 ln2 */\n        if hx > 0x3f851592 {\n            /* if |x| > 1.5 ln2 */\n            k = (INV_LN2 * x + i!(HALF, sign as usize)) as i32;\n        } else {\n            k = 1 - sign - sign;\n        }\n        let kf = k as f32;\n        hi = x - kf * LN2_HI; /* k*ln2hi is exact here */\n        lo = kf * LN2_LO;\n        x = hi - lo;\n    } else if hx > 0x39000000 {\n        /* |x| > 2**-14 */\n        k = 0;\n        hi = x;\n        lo = 0.;\n    } else {\n        /* raise inexact */\n        force_eval!(x1p127 + x);\n        return 1. + x;\n    }\n\n    /* x is now in primary range */\n    let xx = x * x;\n    let c = x - xx * (P1 + xx * P2);\n    let y = 1. + (x * c / (2. - c) - lo + hi);\n    if k == 0 { y } else { scalbnf(y, k) }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/expm1.rs",
    "sha256": "719702ee260fd1cb1c27f22c05fab2a02fbff22f1495bd6f7e3158d21fa75bc7",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse core::f64;\n\nconst O_THRESHOLD: f64 = 7.09782712893383973096e+02; /* 0x40862E42, 0xFEFA39EF */\nconst LN2_HI: f64 = 6.93147180369123816490e-01; /* 0x3fe62e42, 0xfee00000 */\nconst LN2_LO: f64 = 1.90821492927058770002e-10; /* 0x3dea39ef, 0x35793c76 */\nconst INVLN2: f64 = 1.44269504088896338700e+00; /* 0x3ff71547, 0x652b82fe */\n/* Scaled Q's: Qn_here = 2**n * Qn_above, for R(2*z) where z = hxs = x*x/2: */\nconst Q1: f64 = -3.33333333333331316428e-02; /* BFA11111 111110F4 */\nconst Q2: f64 = 1.58730158725481460165e-03; /* 3F5A01A0 19FE5585 */\nconst Q3: f64 = -7.93650757867487942473e-05; /* BF14CE19 9EAADBB7 */\nconst Q4: f64 = 4.00821782732936239552e-06; /* 3ED0CFCA 86E65239 */\nconst Q5: f64 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */\n\n/// Exponential, base *e*, of x-1 (f64)\n///\n/// Calculates the exponential of `x` and subtract 1, that is, *e* raised\n/// to the power `x` minus 1 (where *e* is the base of the natural\n/// system of logarithms, approximately 2.71828).\n/// The result is accurate even for small values of `x`,\n/// where using `exp(x)-1` would lose many significant digits.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn expm1(mut x: f64) -> f64 {\n    let hi: f64;\n    let lo: f64;\n    let k: i32;\n    let c: f64;\n    let mut t: f64;\n    let mut y: f64;\n\n    let mut ui = x.to_bits();\n    let hx = ((ui >> 32) & 0x7fffffff) as u32;\n    let sign = (ui >> 63) as i32;\n\n    /* filter out huge and non-finite argument */\n    if hx >= 0x4043687A {\n        /* if |x|>=56*ln2 */\n        if x.is_nan() {\n            return x;\n        }\n        if sign != 0 {\n            return -1.0;\n        }\n        if x > O_THRESHOLD {\n            x *= f64::from_bits(0x7fe0000000000000);\n            return x;\n        }\n    }\n\n    /* argument reduction */\n    if hx > 0x3fd62e42 {\n        /* if  |x| > 0.5 ln2 */\n        if hx < 0x3FF0A2B2 {\n            /* and |x| < 1.5 ln2 */\n            if sign == 0 {\n                hi = x - LN2_HI;\n                lo = LN2_LO;\n                k = 1;\n            } else {\n                hi = x + LN2_HI;\n                lo = -LN2_LO;\n                k = -1;\n            }\n        } else {\n            k = (INVLN2 * x + if sign != 0 { -0.5 } else { 0.5 }) as i32;\n            t = k as f64;\n            hi = x - t * LN2_HI; /* t*ln2_hi is exact here */\n            lo = t * LN2_LO;\n        }\n        x = hi - lo;\n        c = (hi - x) - lo;\n    } else if hx < 0x3c900000 {\n        /* |x| < 2**-54, return x */\n        if hx < 0x00100000 {\n            force_eval!(x);\n        }\n        return x;\n    } else {\n        c = 0.0;\n        k = 0;\n    }\n\n    /* x is now in primary range */\n    let hfx = 0.5 * x;\n    let hxs = x * hfx;\n    let r1 = 1.0 + hxs * (Q1 + hxs * (Q2 + hxs * (Q3 + hxs * (Q4 + hxs * Q5))));\n    t = 3.0 - r1 * hfx;\n    let mut e = hxs * ((r1 - t) / (6.0 - x * t));\n    if k == 0 {\n        /* c is 0 */\n        return x - (x * e - hxs);\n    }\n    e = x * (e - c) - c;\n    e -= hxs;\n    /* exp(x) ~ 2^k (x_reduced - e + 1) */\n    if k == -1 {\n        return 0.5 * (x - e) - 0.5;\n    }\n    if k == 1 {\n        if x < -0.25 {\n            return -2.0 * (e - (x + 0.5));\n        }\n        return 1.0 + 2.0 * (x - e);\n    }\n    ui = ((0x3ff + k) as u64) << 52; /* 2^k */\n    let twopk = f64::from_bits(ui);\n    if !(0..=56).contains(&k) {\n        /* suffice to return exp(x)-1 */\n        y = x - e + 1.0;\n        if k == 1024 {\n            y = y * 2.0 * f64::from_bits(0x7fe0000000000000);\n        } else {\n            y = y * twopk;\n        }\n        return y - 1.0;\n    }\n    ui = ((0x3ff - k) as u64) << 52; /* 2^-k */\n    let uf = f64::from_bits(ui);\n    if k < 20 {\n        y = (x - e + (1.0 - uf)) * twopk;\n    } else {\n        y = (x - (e + uf) + 1.0) * twopk;\n    }\n    y\n}\n\n#[cfg(test)]\nmod tests {\n    #[test]\n    fn sanity_check() {\n        assert_eq!(super::expm1(1.1), 2.0041660239464334);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/expm1f.rs",
    "sha256": "3c71481940f9d0b51dd035e497378261f150076f33bef85de860bea35dfcde32",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_expm1f.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nconst O_THRESHOLD: f32 = 8.8721679688e+01; /* 0x42b17180 */\nconst LN2_HI: f32 = 6.9313812256e-01; /* 0x3f317180 */\nconst LN2_LO: f32 = 9.0580006145e-06; /* 0x3717f7d1 */\nconst INV_LN2: f32 = 1.4426950216e+00; /* 0x3fb8aa3b */\n/*\n * Domain [-0.34568, 0.34568], range ~[-6.694e-10, 6.696e-10]:\n * |6 / x * (1 + 2 * (1 / (exp(x) - 1) - 1 / x)) - q(x)| < 2**-30.04\n * Scaled coefficients: Qn_here = 2**n * Qn_for_q (see s_expm1.c):\n */\nconst Q1: f32 = -3.3333212137e-2; /* -0x888868.0p-28 */\nconst Q2: f32 = 1.5807170421e-3; /*  0xcf3010.0p-33 */\n\n/// Exponential, base *e*, of x-1 (f32)\n///\n/// Calculates the exponential of `x` and subtract 1, that is, *e* raised\n/// to the power `x` minus 1 (where *e* is the base of the natural\n/// system of logarithms, approximately 2.71828).\n/// The result is accurate even for small values of `x`,\n/// where using `exp(x)-1` would lose many significant digits.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn expm1f(mut x: f32) -> f32 {\n    let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127\n\n    let mut hx = x.to_bits();\n    let sign = (hx >> 31) != 0;\n    hx &= 0x7fffffff;\n\n    /* filter out huge and non-finite argument */\n    if hx >= 0x4195b844 {\n        /* if |x|>=27*ln2 */\n        if hx > 0x7f800000 {\n            /* NaN */\n            return x;\n        }\n        if sign {\n            return -1.;\n        }\n        if x > O_THRESHOLD {\n            x *= x1p127;\n            return x;\n        }\n    }\n\n    let k: i32;\n    let hi: f32;\n    let lo: f32;\n    let mut c = 0f32;\n    /* argument reduction */\n    if hx > 0x3eb17218 {\n        /* if  |x| > 0.5 ln2 */\n        if hx < 0x3F851592 {\n            /* and |x| < 1.5 ln2 */\n            if !sign {\n                hi = x - LN2_HI;\n                lo = LN2_LO;\n                k = 1;\n            } else {\n                hi = x + LN2_HI;\n                lo = -LN2_LO;\n                k = -1;\n            }\n        } else {\n            k = (INV_LN2 * x + (if sign { -0.5 } else { 0.5 })) as i32;\n            let t = k as f32;\n            hi = x - t * LN2_HI; /* t*ln2_hi is exact here */\n            lo = t * LN2_LO;\n        }\n        x = hi - lo;\n        c = (hi - x) - lo;\n    } else if hx < 0x33000000 {\n        /* when |x|<2**-25, return x */\n        if hx < 0x00800000 {\n            force_eval!(x * x);\n        }\n        return x;\n    } else {\n        k = 0;\n    }\n\n    /* x is now in primary range */\n    let hfx = 0.5 * x;\n    let hxs = x * hfx;\n    let r1 = 1. + hxs * (Q1 + hxs * Q2);\n    let t = 3. - r1 * hfx;\n    let mut e = hxs * ((r1 - t) / (6. - x * t));\n    if k == 0 {\n        /* c is 0 */\n        return x - (x * e - hxs);\n    }\n    e = x * (e - c) - c;\n    e -= hxs;\n    /* exp(x) ~ 2^k (x_reduced - e + 1) */\n    if k == -1 {\n        return 0.5 * (x - e) - 0.5;\n    }\n    if k == 1 {\n        if x < -0.25 {\n            return -2. * (e - (x + 0.5));\n        }\n        return 1. + 2. * (x - e);\n    }\n    let twopk = f32::from_bits(((0x7f + k) << 23) as u32); /* 2^k */\n    if !(0..=56).contains(&k) {\n        /* suffice to return exp(x)-1 */\n        let mut y = x - e + 1.;\n        if k == 128 {\n            y = y * 2. * x1p127;\n        } else {\n            y = y * twopk;\n        }\n        return y - 1.;\n    }\n    let uf = f32::from_bits(((0x7f - k) << 23) as u32); /* 2^-k */\n    if k < 23 {\n        (x - e + (1. - uf)) * twopk\n    } else {\n        (x - (e + uf) + 1.) * twopk\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/fma.rs",
    "sha256": "580d0b7bec7627c2fab1ab0a47bd97a5392f5f6835b7b7b8c56e7c3b1982415e",
    "text": "/* SPDX-License-Identifier: MIT */\n/* origin: musl src/math/fma.c, fmaf.c Ported to generic Rust algorithm in 2025, TG. */\n\nuse super::generic;\nuse crate::support::Round;\n\n// Placeholder so we can have `fmaf16` in the `Float` trait.\n#[allow(unused)]\n#[cfg(f16_enabled)]\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn fmaf16(_x: f16, _y: f16, _z: f16) -> f16 {\n    unimplemented!()\n}\n\n/// Floating multiply add (f32)\n///\n/// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn fmaf(x: f32, y: f32, z: f32) -> f32 {\n    select_implementation! {\n        name: fmaf,\n        use_arch: any(\n            all(target_arch = \"aarch64\", target_feature = \"neon\"),\n            target_feature = \"sse2\",\n        ),\n        args: x, y, z,\n    }\n\n    generic::fma_wide_round(x, y, z, Round::Nearest).val\n}\n\n/// Fused multiply add (f64)\n///\n/// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn fma(x: f64, y: f64, z: f64) -> f64 {\n    select_implementation! {\n        name: fma,\n        use_arch: any(\n            all(target_arch = \"aarch64\", target_feature = \"neon\"),\n            target_feature = \"sse2\",\n        ),\n        args: x, y, z,\n    }\n\n    generic::fma_round(x, y, z, Round::Nearest).val\n}\n\n/// Fused multiply add (f128)\n///\n/// Computes `(x*y)+z`, rounded as one ternary operation (i.e. calculated with infinite precision).\n#[cfg(f128_enabled)]\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn fmaf128(x: f128, y: f128, z: f128) -> f128 {\n    generic::fma_round(x, y, z, Round::Nearest).val\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::support::{CastFrom, CastInto, Float, FpResult, HInt, MinInt, Round, Status};\n\n    /// Test the generic `fma_round` algorithm for a given float.\n    fn spec_test<F>(f: impl Fn(F, F, F) -> F)\n    where\n        F: Float,\n        F: CastFrom<F::SignedInt>,\n        F: CastFrom<i8>,\n        F::Int: HInt,\n        u32: CastInto<F::Int>,\n    {\n        let x = F::from_bits(F::Int::ONE);\n        let y = F::from_bits(F::Int::ONE);\n        let z = F::ZERO;\n\n        // 754-2020 says \"When the exact result of (a × b) + c is non-zero yet the result of\n        // fusedMultiplyAdd is zero because of rounding, the zero result takes the sign of the\n        // exact result\"\n        assert_biteq!(f(x, y, z), F::ZERO);\n        assert_biteq!(f(x, -y, z), F::NEG_ZERO);\n        assert_biteq!(f(-x, y, z), F::NEG_ZERO);\n        assert_biteq!(f(-x, -y, z), F::ZERO);\n    }\n\n    #[test]\n    fn spec_test_f32() {\n        spec_test::<f32>(fmaf);\n\n        // Also do a small check that the non-widening version works for f32 (this should ideally\n        // get tested some more).\n        spec_test::<f32>(|x, y, z| generic::fma_round(x, y, z, Round::Nearest).val);\n    }\n\n    #[test]\n    fn spec_test_f64() {\n        spec_test::<f64>(fma);\n\n        let expect_underflow = [\n            (\n                hf64!(\"0x1.0p-1070\"),\n                hf64!(\"0x1.0p-1070\"),\n                hf64!(\"0x1.ffffffffffffp-1023\"),\n                hf64!(\"0x0.ffffffffffff8p-1022\"),\n            ),\n            (\n                // FIXME: we raise underflow but this should only be inexact (based on C and\n                // `rustc_apfloat`).\n                hf64!(\"0x1.0p-1070\"),\n                hf64!(\"0x1.0p-1070\"),\n                hf64!(\"-0x1.0p-1022\"),\n                hf64!(\"-0x1.0p-1022\"),\n            ),\n        ];\n\n        for (x, y, z, res) in expect_underflow {\n            let FpResult { val, status } = generic::fma_round(x, y, z, Round::Nearest);\n            assert_biteq!(val, res);\n            assert_eq!(status, Status::UNDERFLOW);\n        }\n    }\n\n    #[test]\n    #[cfg(f128_enabled)]\n    fn spec_test_f128() {\n        spec_test::<f128>(fmaf128);\n    }\n\n    #[test]\n    fn issue_263() {\n        let a = f32::from_bits(1266679807);\n        let b = f32::from_bits(1300234242);\n        let c = f32::from_bits(1115553792);\n        let expected = f32::from_bits(1501560833);\n        assert_eq!(fmaf(a, b, c), expected);\n    }\n\n    #[test]\n    fn fma_segfault() {\n        // These two inputs cause fma to segfault on release due to overflow:\n        assert_eq!(\n            fma(\n                -0.0000000000000002220446049250313,\n                -0.0000000000000002220446049250313,\n                -0.0000000000000002220446049250313\n            ),\n            -0.00000000000000022204460492503126,\n        );\n\n        let result = fma(-0.992, -0.992, -0.992);\n        //force rounding to storage format on x87 to prevent superious errors.\n        #[cfg(all(target_arch = \"x86\", not(target_feature = \"sse2\")))]\n        let result = force_eval!(result);\n        assert_eq!(result, -0.007936000000000007,);\n    }\n\n    #[test]\n    fn fma_sbb() {\n        assert_eq!(\n            fma(-(1.0 - f64::EPSILON), f64::MIN, f64::MIN),\n            -3991680619069439e277\n        );\n    }\n\n    #[test]\n    fn fma_underflow() {\n        assert_eq!(\n            fma(1.1102230246251565e-16, -9.812526705433188e-305, 1.0894e-320),\n            0.0,\n        );\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/ceil.rs",
    "sha256": "66b3def2b00ed9dd6a4f59c73765a050853dfe06c828fdf731987ac99e7c2a88",
    "text": "/* SPDX-License-Identifier: MIT */\n/* origin: musl src/math/ceilf.c */\n\n//! Generic `ceil` algorithm.\n//!\n//! Note that this uses the algorithm from musl's `ceilf` rather than `ceil` or `ceill` because\n//! performance seems to be better (based on icount) and it does not seem to experience rounding\n//! errors on i386.\n\nuse crate::support::{Float, FpResult, Int, IntTy, MinInt, Status};\n\n#[inline]\npub fn ceil<F: Float>(x: F) -> F {\n    ceil_status(x).val\n}\n\n#[inline]\npub fn ceil_status<F: Float>(x: F) -> FpResult<F> {\n    let zero = IntTy::<F>::ZERO;\n\n    let mut ix = x.to_bits();\n    let e = x.exp_unbiased();\n\n    // If the represented value has no fractional part, no truncation is needed.\n    if e >= F::SIG_BITS as i32 {\n        return FpResult::ok(x);\n    }\n\n    let status;\n    let res = if e >= 0 {\n        // |x| >= 1.0\n        let m = F::SIG_MASK >> e.unsigned();\n        if (ix & m) == zero {\n            // Portion to be masked is already zero; no adjustment needed.\n            return FpResult::ok(x);\n        }\n\n        // Otherwise, raise an inexact exception.\n        status = Status::INEXACT;\n\n        if x.is_sign_positive() {\n            ix += m;\n        }\n\n        ix &= !m;\n        F::from_bits(ix)\n    } else {\n        // |x| < 1.0, raise an inexact exception since truncation will happen (unless x == 0).\n        if ix & F::SIG_MASK == F::Int::ZERO {\n            status = Status::OK;\n        } else {\n            status = Status::INEXACT;\n        }\n\n        if x.is_sign_negative() {\n            // -1.0 < x <= -0.0; rounding up goes toward -0.0.\n            F::NEG_ZERO\n        } else if ix << 1 != zero {\n            // 0.0 < x < 1.0; rounding up goes toward +1.0.\n            F::ONE\n        } else {\n            // +0.0 remains unchanged\n            x\n        }\n    };\n\n    FpResult::new(res, status)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::support::Hexf;\n\n    /// Test against https://en.cppreference.com/w/cpp/numeric/math/ceil\n    fn spec_test<F: Float>(cases: &[(F, F, Status)]) {\n        let roundtrip = [\n            F::ZERO,\n            F::ONE,\n            F::NEG_ONE,\n            F::NEG_ZERO,\n            F::INFINITY,\n            F::NEG_INFINITY,\n        ];\n\n        for x in roundtrip {\n            let FpResult { val, status } = ceil_status(x);\n            assert_biteq!(val, x, \"{}\", Hexf(x));\n            assert_eq!(status, Status::OK, \"{}\", Hexf(x));\n        }\n\n        for &(x, res, res_stat) in cases {\n            let FpResult { val, status } = ceil_status(x);\n            assert_biteq!(val, res, \"{}\", Hexf(x));\n            assert_eq!(status, res_stat, \"{}\", Hexf(x));\n        }\n    }\n\n    /* Skipping f16 / f128 \"sanity_check\"s due to rejected literal lexing at MSRV */\n\n    #[test]\n    #[cfg(f16_enabled)]\n    fn spec_tests_f16() {\n        let cases = [\n            (0.1, 1.0, Status::INEXACT),\n            (-0.1, -0.0, Status::INEXACT),\n            (0.9, 1.0, Status::INEXACT),\n            (-0.9, -0.0, Status::INEXACT),\n            (1.1, 2.0, Status::INEXACT),\n            (-1.1, -1.0, Status::INEXACT),\n            (1.9, 2.0, Status::INEXACT),\n            (-1.9, -1.0, Status::INEXACT),\n        ];\n        spec_test::<f16>(&cases);\n    }\n\n    #[test]\n    fn sanity_check_f32() {\n        assert_eq!(ceil(1.1f32), 2.0);\n        assert_eq!(ceil(2.9f32), 3.0);\n    }\n\n    #[test]\n    fn spec_tests_f32() {\n        let cases = [\n            (0.1, 1.0, Status::INEXACT),\n            (-0.1, -0.0, Status::INEXACT),\n            (0.9, 1.0, Status::INEXACT),\n            (-0.9, -0.0, Status::INEXACT),\n            (1.1, 2.0, Status::INEXACT),\n            (-1.1, -1.0, Status::INEXACT),\n            (1.9, 2.0, Status::INEXACT),\n            (-1.9, -1.0, Status::INEXACT),\n        ];\n        spec_test::<f32>(&cases);\n    }\n\n    #[test]\n    fn sanity_check_f64() {\n        assert_eq!(ceil(1.1f64), 2.0);\n        assert_eq!(ceil(2.9f64), 3.0);\n    }\n\n    #[test]\n    fn spec_tests_f64() {\n        let cases = [\n            (0.1, 1.0, Status::INEXACT),\n            (-0.1, -0.0, Status::INEXACT),\n            (0.9, 1.0, Status::INEXACT),\n            (-0.9, -0.0, Status::INEXACT),\n            (1.1, 2.0, Status::INEXACT),\n            (-1.1, -1.0, Status::INEXACT),\n            (1.9, 2.0, Status::INEXACT),\n            (-1.9, -1.0, Status::INEXACT),\n        ];\n        spec_test::<f64>(&cases);\n    }\n\n    #[test]\n    #[cfg(f128_enabled)]\n    fn spec_tests_f128() {\n        let cases = [\n            (0.1, 1.0, Status::INEXACT),\n            (-0.1, -0.0, Status::INEXACT),\n            (0.9, 1.0, Status::INEXACT),\n            (-0.9, -0.0, Status::INEXACT),\n            (1.1, 2.0, Status::INEXACT),\n            (-1.1, -1.0, Status::INEXACT),\n            (1.9, 2.0, Status::INEXACT),\n            (-1.9, -1.0, Status::INEXACT),\n        ];\n        spec_test::<f128>(&cases);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/floor.rs",
    "sha256": "7d4f15369abefa27645d6deda51d30febbe60ee9dca76e72a9364d574d0711c0",
    "text": "/* SPDX-License-Identifier: MIT\n * origin: musl src/math/floor.c */\n\n//! Generic `floor` algorithm.\n//!\n//! Note that this uses the algorithm from musl's `floorf` rather than `floor` or `floorl` because\n//! performance seems to be better (based on icount) and it does not seem to experience rounding\n//! errors on i386.\n\nuse crate::support::{Float, FpResult, Int, IntTy, MinInt, Status};\n\n#[inline]\npub fn floor<F: Float>(x: F) -> F {\n    floor_status(x).val\n}\n\n#[inline]\npub fn floor_status<F: Float>(x: F) -> FpResult<F> {\n    let zero = IntTy::<F>::ZERO;\n\n    let mut ix = x.to_bits();\n    let e = x.exp_unbiased();\n\n    // If the represented value has no fractional part, no truncation is needed.\n    if e >= F::SIG_BITS as i32 {\n        return FpResult::ok(x);\n    }\n\n    let status;\n    let res = if e >= 0 {\n        // |x| >= 1.0\n        let m = F::SIG_MASK >> e.unsigned();\n        if ix & m == zero {\n            // Portion to be masked is already zero; no adjustment needed.\n            return FpResult::ok(x);\n        }\n\n        // Otherwise, raise an inexact exception.\n        status = Status::INEXACT;\n\n        if x.is_sign_negative() {\n            ix += m;\n        }\n\n        ix &= !m;\n        F::from_bits(ix)\n    } else {\n        // |x| < 1.0, raise an inexact exception since truncation will happen.\n        if ix & F::SIG_MASK == F::Int::ZERO {\n            status = Status::OK;\n        } else {\n            status = Status::INEXACT;\n        }\n\n        if x.is_sign_positive() {\n            // 0.0 <= x < 1.0; rounding down goes toward +0.0.\n            F::ZERO\n        } else if ix << 1 != zero {\n            // -1.0 < x < 0.0; rounding down goes toward -1.0.\n            F::NEG_ONE\n        } else {\n            // -0.0 remains unchanged\n            x\n        }\n    };\n\n    FpResult::new(res, status)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::support::Hexf;\n\n    /// Test against https://en.cppreference.com/w/cpp/numeric/math/floor\n    fn spec_test<F: Float>(cases: &[(F, F, Status)]) {\n        let roundtrip = [\n            F::ZERO,\n            F::ONE,\n            F::NEG_ONE,\n            F::NEG_ZERO,\n            F::INFINITY,\n            F::NEG_INFINITY,\n        ];\n\n        for x in roundtrip {\n            let FpResult { val, status } = floor_status(x);\n            assert_biteq!(val, x, \"{}\", Hexf(x));\n            assert_eq!(status, Status::OK, \"{}\", Hexf(x));\n        }\n\n        for &(x, res, res_stat) in cases {\n            let FpResult { val, status } = floor_status(x);\n            assert_biteq!(val, res, \"{}\", Hexf(x));\n            assert_eq!(status, res_stat, \"{}\", Hexf(x));\n        }\n    }\n\n    /* Skipping f16 / f128 \"sanity_check\"s and spec cases due to rejected literal lexing at MSRV */\n\n    #[test]\n    #[cfg(f16_enabled)]\n    fn spec_tests_f16() {\n        let cases = [];\n        spec_test::<f16>(&cases);\n    }\n\n    #[test]\n    fn sanity_check_f32() {\n        assert_eq!(floor(0.5f32), 0.0);\n        assert_eq!(floor(1.1f32), 1.0);\n        assert_eq!(floor(2.9f32), 2.0);\n    }\n\n    #[test]\n    fn spec_tests_f32() {\n        let cases = [\n            (0.1, 0.0, Status::INEXACT),\n            (-0.1, -1.0, Status::INEXACT),\n            (0.9, 0.0, Status::INEXACT),\n            (-0.9, -1.0, Status::INEXACT),\n            (1.1, 1.0, Status::INEXACT),\n            (-1.1, -2.0, Status::INEXACT),\n            (1.9, 1.0, Status::INEXACT),\n            (-1.9, -2.0, Status::INEXACT),\n        ];\n        spec_test::<f32>(&cases);\n    }\n\n    #[test]\n    fn sanity_check_f64() {\n        assert_eq!(floor(1.1f64), 1.0);\n        assert_eq!(floor(2.9f64), 2.0);\n    }\n\n    #[test]\n    fn spec_tests_f64() {\n        let cases = [\n            (0.1, 0.0, Status::INEXACT),\n            (-0.1, -1.0, Status::INEXACT),\n            (0.9, 0.0, Status::INEXACT),\n            (-0.9, -1.0, Status::INEXACT),\n            (1.1, 1.0, Status::INEXACT),\n            (-1.1, -2.0, Status::INEXACT),\n            (1.9, 1.0, Status::INEXACT),\n            (-1.9, -2.0, Status::INEXACT),\n        ];\n        spec_test::<f64>(&cases);\n    }\n\n    #[test]\n    #[cfg(f128_enabled)]\n    fn spec_tests_f128() {\n        let cases = [];\n        spec_test::<f128>(&cases);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/fma.rs",
    "sha256": "ba44930a56d7c1953ab0c96c7c767911c9dc6967083700c8ef02f43672c8482f",
    "text": "/* SPDX-License-Identifier: MIT */\n/* origin: musl src/math/fma.c. Ported to generic Rust algorithm in 2025, TG. */\n\nuse crate::support::{\n    CastFrom, CastInto, DInt, Float, FpResult, HInt, Int, IntTy, MinInt, Round, Status,\n};\n\n/// Fused multiply-add that works when there is not a larger float size available. Computes\n/// `(x * y) + z`.\n#[inline]\npub fn fma_round<F>(x: F, y: F, z: F, _round: Round) -> FpResult<F>\nwhere\n    F: Float,\n    F: CastFrom<F::SignedInt>,\n    F: CastFrom<i8>,\n    F::Int: HInt,\n    u32: CastInto<F::Int>,\n{\n    let one = IntTy::<F>::ONE;\n    let zero = IntTy::<F>::ZERO;\n\n    // Normalize such that the top of the mantissa is zero and we have a guard bit.\n    let nx = Norm::from_float(x);\n    let ny = Norm::from_float(y);\n    let nz = Norm::from_float(z);\n\n    if nx.is_zero_nan_inf() || ny.is_zero_nan_inf() {\n        // Value will overflow, defer to non-fused operations.\n        return FpResult::ok(x * y + z);\n    }\n\n    if nz.is_zero_nan_inf() {\n        if nz.is_zero() {\n            // Empty add component means we only need to multiply.\n            return FpResult::ok(x * y);\n        }\n        // `z` is NaN or infinity, which sets the result.\n        return FpResult::ok(z);\n    }\n\n    // multiply: r = x * y\n    let zhi: F::Int;\n    let zlo: F::Int;\n    let (mut rlo, mut rhi) = nx.m.widen_mul(ny.m).lo_hi();\n\n    // Exponent result of multiplication\n    let mut e: i32 = nx.e + ny.e;\n    // Needed shift to align `z` to the multiplication result\n    let mut d: i32 = nz.e - e;\n    let sbits = F::BITS as i32;\n\n    // Scale `z`. Shift `z <<= kz`, `r >>= kr`, so `kz+kr == d`, set `e = e+kr` (== ez-kz)\n    if d > 0 {\n        // The magnitude of `z` is larger than `x * y`\n        if d < sbits {\n            // Maximum shift of one `F::BITS` means shifted `z` will fit into `2 * F::BITS`. Shift\n            // it into `(zhi, zlo)`. No exponent adjustment necessary.\n            zlo = nz.m << d;\n            zhi = nz.m >> (sbits - d);\n        } else {\n            // Shift larger than `sbits`, `z` only needs the top half `zhi`. Place it there (acts\n            // as a shift by `sbits`).\n            zlo = zero;\n            zhi = nz.m;\n            d -= sbits;\n\n            // `z`'s exponent is large enough that it now needs to be taken into account.\n            e = nz.e - sbits;\n\n            if d == 0 {\n                // Exactly `sbits`, nothing to do\n            } else if d < sbits {\n                // Remaining shift fits within `sbits`. Leave `z` in place, shift `x * y`\n                rlo = (rhi << (sbits - d)) | (rlo >> d);\n                // Set the sticky bit\n                rlo |= IntTy::<F>::from((rlo << (sbits - d)) != zero);\n                rhi = rhi >> d;\n            } else {\n                // `z`'s magnitude is enough that `x * y` is irrelevant. It was nonzero, so set\n                // the sticky bit.\n                rlo = one;\n                rhi = zero;\n            }\n        }\n    } else {\n        // `z`'s magnitude once shifted fits entirely within `zlo`\n        zhi = zero;\n        d = -d;\n        if d == 0 {\n            // No shift needed\n            zlo = nz.m;\n        } else if d < sbits {\n            // Shift s.t. `nz.m` fits into `zlo`\n            let sticky = IntTy::<F>::from((nz.m << (sbits - d)) != zero);\n            zlo = (nz.m >> d) | sticky;\n        } else {\n            // Would be entirely shifted out, only set the sticky bit\n            zlo = one;\n        }\n    }\n\n    /* addition */\n\n    let mut neg = nx.neg ^ ny.neg;\n    let samesign: bool = !neg ^ nz.neg;\n    let mut rhi_nonzero = true;\n\n    if samesign {\n        // r += z\n        rlo = rlo.wrapping_add(zlo);\n        rhi += zhi + IntTy::<F>::from(rlo < zlo);\n    } else {\n        // r -= z\n        let (res, borrow) = rlo.overflowing_sub(zlo);\n        rlo = res;\n        rhi = rhi.wrapping_sub(zhi.wrapping_add(IntTy::<F>::from(borrow)));\n        if (rhi >> (F::BITS - 1)) != zero {\n            rlo = rlo.signed().wrapping_neg().unsigned();\n            rhi = rhi.signed().wrapping_neg().unsigned() - IntTy::<F>::from(rlo != zero);\n            neg = !neg;\n        }\n        rhi_nonzero = rhi != zero;\n    }\n\n    /* Construct result */\n\n    // Shift result into `rhi`, left-aligned. Last bit is sticky\n    if rhi_nonzero {\n        // `d` > 0, need to shift both `rhi` and `rlo` into result\n        e += sbits;\n        d = rhi.leading_zeros() as i32 - 1;\n        rhi = (rhi << d) | (rlo >> (sbits - d));\n        // Update sticky\n        rhi |= IntTy::<F>::from((rlo << d) != zero);\n    } else if rlo != zero {\n        // `rhi` is zero, `rlo` is the entire result and needs to be shifted\n        d = rlo.leading_zeros() as i32 - 1;\n        if d < 0 {\n            // Shift and set sticky\n            rhi = (rlo >> 1) | (rlo & one);\n        } else {\n            rhi = rlo << d;\n        }\n    } else {\n        // exact +/- 0.0\n        return FpResult::ok(x * y + z);\n    }\n\n    e -= d;\n\n    // Use int->float conversion to populate the significand.\n    // i is in [1 << (BITS - 2), (1 << (BITS - 1)) - 1]\n    let mut i: F::SignedInt = rhi.signed();\n\n    if neg {\n        i = -i;\n    }\n\n    // `|r|` is in `[0x1p62,0x1p63]` for `f64`\n    let mut r: F = F::cast_from_lossy(i);\n\n    /* Account for subnormal and rounding */\n\n    // Unbiased exponent for the maximum value of `r`\n    let max_pow = F::BITS - 1 + F::EXP_BIAS;\n\n    let mut status = Status::OK;\n\n    if e < -(max_pow as i32 - 2) {\n        // Result is subnormal before rounding\n        if e == -(max_pow as i32 - 1) {\n            let mut c = F::from_parts(false, max_pow, zero);\n            if neg {\n                c = -c;\n            }\n\n            if r == c {\n                // Min normal after rounding,\n                status.set_underflow(true);\n                r = F::MIN_POSITIVE_NORMAL.copysign(r);\n                return FpResult::new(r, status);\n            }\n\n            if (rhi << (F::SIG_BITS + 1)) != zero {\n                // Account for truncated bits. One bit will be lost in the `scalbn` call, add\n                // another top bit to avoid double rounding if inexact.\n                let iu: F::Int = (rhi >> 1) | (rhi & one) | (one << (F::BITS - 2));\n                i = iu.signed();\n\n                if neg {\n                    i = -i;\n                }\n\n                r = F::cast_from_lossy(i);\n\n                // Remove the top bit\n                r = F::cast_from(2i8) * r - c;\n                status.set_underflow(true);\n            }\n        } else {\n            // Only round once when scaled\n            d = F::EXP_BITS as i32 - 1;\n            let sticky = IntTy::<F>::from(rhi << (F::BITS as i32 - d) != zero);\n            i = (((rhi >> d) | sticky) << d).signed();\n\n            if neg {\n                i = -i;\n            }\n\n            r = F::cast_from_lossy(i);\n        }\n    }\n\n    // Use our exponent to scale the final value.\n    FpResult::new(super::scalbn(r, e), status)\n}\n\n/// Representation of `F` that has handled subnormals.\n#[derive(Clone, Copy, Debug)]\nstruct Norm<F: Float> {\n    /// Normalized significand with one guard bit, unsigned.\n    m: F::Int,\n    /// Exponent of the mantissa such that `m * 2^e = x`. Accounts for the shift in the mantissa\n    /// and the guard bit; that is, 1.0 will normalize as `m = 1 << 53` and `e = -53`.\n    e: i32,\n    neg: bool,\n}\n\nimpl<F: Float> Norm<F> {\n    /// Unbias the exponent and account for the mantissa's precision, including the guard bit.\n    const EXP_UNBIAS: u32 = F::EXP_BIAS + F::SIG_BITS + 1;\n\n    /// Values greater than this had a saturated exponent (infinity or NaN), OR were zero and we\n    /// adjusted the exponent such that it exceeds this threashold.\n    const ZERO_INF_NAN: u32 = F::EXP_SAT - Self::EXP_UNBIAS;\n\n    fn from_float(x: F) -> Self {\n        let mut ix = x.to_bits();\n        let mut e = x.ex() as i32;\n        let neg = x.is_sign_negative();\n        if e == 0 {\n            // Normalize subnormals by multiplication\n            let scale_i = F::BITS - 1;\n            let scale_f = F::from_parts(false, scale_i + F::EXP_BIAS, F::Int::ZERO);\n            let scaled = x * scale_f;\n            ix = scaled.to_bits();\n            e = scaled.ex() as i32;\n            e = if e == 0 {\n                // If the exponent is still zero, the input was zero. Artifically set this value\n                // such that the final `e` will exceed `ZERO_INF_NAN`.\n                1 << F::EXP_BITS\n            } else {\n                // Otherwise, account for the scaling we just did.\n                e - scale_i as i32\n            };\n        }\n\n        e -= Self::EXP_UNBIAS as i32;\n\n        // Absolute  value, set the implicit bit, and shift to create a guard bit\n        ix &= F::SIG_MASK;\n        ix |= F::IMPLICIT_BIT;\n        ix <<= 1;\n\n        Self { m: ix, e, neg }\n    }\n\n    /// True if the value was zero, infinity, or NaN.\n    fn is_zero_nan_inf(self) -> bool {\n        self.e >= Self::ZERO_INF_NAN as i32\n    }\n\n    /// The only value we have\n    fn is_zero(self) -> bool {\n        // The only exponent that strictly exceeds this value is our sentinel value for zero.\n        self.e > Self::ZERO_INF_NAN as i32\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/fmax.rs",
    "sha256": "06588ba9f8560cf9f855dd2dd7b2836c507ebef417c652aaac14769a0fb29c84",
    "text": "/* SPDX-License-Identifier: MIT OR Apache-2.0 */\n//! IEEE 754-2011 `maxNum`. This has been superseded by IEEE 754-2019 `maximumNumber`.\n//!\n//! Per the spec, returns the canonicalized result of:\n//! - `x` if `x > y`\n//! - `y` if `y > x`\n//! - The other number if one is NaN\n//! - Otherwise, either `x` or `y`, canonicalized\n//! - -0.0 and +0.0 may be disregarded (unlike newer operations)\n//!\n//! Excluded from our implementation is sNaN handling.\n//!\n//! More on the differences: [link].\n//!\n//! [link]: https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/minNum_maxNum_Removal_Demotion_v3.pdf\n\nuse crate::support::Float;\n\n#[inline]\npub fn fmax<F: Float>(x: F, y: F) -> F {\n    let res = if x.is_nan() || x < y { y } else { x };\n    // Canonicalize\n    res * F::ONE\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/fmaximum.rs",
    "sha256": "2d679da086af3a876791c1c4b4599b6e0e5eb760ecc2bd63065ba8ef1f4761b3",
    "text": "/* SPDX-License-Identifier: MIT OR Apache-2.0 */\n//! IEEE 754-2019 `maximum`.\n//!\n//! Per the spec, returns the canonicalized result of:\n//! - `x` if `x > y`\n//! - `y` if `y > x`\n//! - qNaN if either operation is NaN\n//! - Logic following +0.0 > -0.0\n//!\n//! Excluded from our implementation is sNaN handling.\n\nuse crate::support::Float;\n\n#[inline]\npub fn fmaximum<F: Float>(x: F, y: F) -> F {\n    let res = if x.is_nan() {\n        x\n    } else if y.is_nan() {\n        y\n    } else if x > y || (y.to_bits() == F::NEG_ZERO.to_bits() && x.is_sign_positive()) {\n        x\n    } else {\n        y\n    };\n\n    // Canonicalize\n    res * F::ONE\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/fmaximum_num.rs",
    "sha256": "56e2f52126d8dda9fc72f9cc046b93a394e73c38987264dbd307ac4251b1ac0b",
    "text": "/* SPDX-License-Identifier: MIT OR Apache-2.0 */\n//! IEEE 754-2019 `maximumNumber`.\n//!\n//! Per the spec, returns:\n//! - `x` if `x > y`\n//! - `y` if `y > x`\n//! - Non-NaN if one operand is NaN\n//! - Logic following +0.0 > -0.0\n//! - Either `x` or `y` if `x == y` and the signs are the same\n//! - qNaN if either operand is a NaN\n//!\n//! Excluded from our implementation is sNaN handling.\n\nuse crate::support::Float;\n\n#[inline]\npub fn fmaximum_num<F: Float>(x: F, y: F) -> F {\n    let res =\n        if x.is_nan() || x < y || (x.to_bits() == F::NEG_ZERO.to_bits() && y.is_sign_positive()) {\n            y\n        } else {\n            x\n        };\n\n    // Canonicalize\n    res * F::ONE\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/fmin.rs",
    "sha256": "1eba9facae636ca7bbf23f379f1da8ce0b1a3c8661c601f7785b6d8f3d1d14c7",
    "text": "/* SPDX-License-Identifier: MIT OR Apache-2.0 */\n//! IEEE 754-2008 `minNum`. This has been superseded by IEEE 754-2019 `minimumNumber`.\n//!\n//! Per the spec, returns the canonicalized result of:\n//! - `x` if `x < y`\n//! - `y` if `y < x`\n//! - The other number if one is NaN\n//! - Otherwise, either `x` or `y`, canonicalized\n//! - -0.0 and +0.0 may be disregarded (unlike newer operations)\n//!\n//! Excluded from our implementation is sNaN handling.\n//!\n//! More on the differences: [link].\n//!\n//! [link]: https://grouper.ieee.org/groups/msc/ANSI_IEEE-Std-754-2019/background/minNum_maxNum_Removal_Demotion_v3.pdf\n\nuse crate::support::Float;\n\n#[inline]\npub fn fmin<F: Float>(x: F, y: F) -> F {\n    let res = if y.is_nan() || x < y { x } else { y };\n    // Canonicalize\n    res * F::ONE\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/fminimum.rs",
    "sha256": "43d958f0f32ba7c0971615dbb55a23d30c9d36e3f5ec1a09fa5dc8407a9dd13f",
    "text": "/* SPDX-License-Identifier: MIT OR Apache-2.0 */\n//! IEEE 754-2019 `minimum`.\n//!\n//! Per the spec, returns the canonicalized result of:\n//! - `x` if `x < y`\n//! - `y` if `y < x`\n//! - qNaN if either operation is NaN\n//! - Logic following +0.0 > -0.0\n//!\n//! Excluded from our implementation is sNaN handling.\n\nuse crate::support::Float;\n\n#[inline]\npub fn fminimum<F: Float>(x: F, y: F) -> F {\n    let res = if x.is_nan() {\n        x\n    } else if y.is_nan() {\n        y\n    } else if x < y || (x.to_bits() == F::NEG_ZERO.to_bits() && y.is_sign_positive()) {\n        x\n    } else {\n        y\n    };\n\n    // Canonicalize\n    res * F::ONE\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/fminimum_num.rs",
    "sha256": "6ae3d55f47cb86816e2ce675d8028803e12435f0787e4786334d5683b0909b5a",
    "text": "/* SPDX-License-Identifier: MIT OR Apache-2.0 */\n//! IEEE 754-2019 `minimum`.\n//!\n//! Per the spec, returns:\n//! - `x` if `x < y`\n//! - `y` if `y < x`\n//! - Non-NaN if one operand is NaN\n//! - Logic following +0.0 > -0.0\n//! - Either `x` or `y` if `x == y` and the signs are the same\n//! - qNaN if either operand is a NaN\n//!\n//! Excluded from our implementation is sNaN handling.\n\nuse crate::support::Float;\n\n#[inline]\npub fn fminimum_num<F: Float>(x: F, y: F) -> F {\n    let res =\n        if y.is_nan() || x < y || (x.to_bits() == F::NEG_ZERO.to_bits() && y.is_sign_positive()) {\n            x\n        } else {\n            y\n        };\n\n    // Canonicalize\n    res * F::ONE\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/fmod.rs",
    "sha256": "15a29db87c3b2d3f11b36d188e8e45b8303d109474a99b55a604a5acb8c21c85",
    "text": "/* SPDX-License-Identifier: MIT OR Apache-2.0 */\nuse crate::support::{CastFrom, Float, Int, MinInt};\n\n#[inline]\npub fn fmod<F: Float>(x: F, y: F) -> F {\n    let _1 = F::Int::ONE;\n    let sx = x.to_bits() & F::SIGN_MASK;\n    let ux = x.to_bits() & !F::SIGN_MASK;\n    let uy = y.to_bits() & !F::SIGN_MASK;\n\n    // Cases that return NaN:\n    //   NaN % _\n    //   Inf % _\n    //     _ % NaN\n    //     _ % 0\n    let x_nan_or_inf = ux & F::EXP_MASK == F::EXP_MASK;\n    let y_nan_or_zero = uy.wrapping_sub(_1) & F::EXP_MASK == F::EXP_MASK;\n    if x_nan_or_inf | y_nan_or_zero {\n        return (x * y) / (x * y);\n    }\n\n    if ux < uy {\n        // |x| < |y|\n        return x;\n    }\n\n    let (num, ex) = into_sig_exp::<F>(ux);\n    let (div, ey) = into_sig_exp::<F>(uy);\n\n    // To compute `(num << ex) % (div << ey)`, first\n    // evaluate `rem = (num << (ex - ey)) % div` ...\n    let rem = reduction(num, ex - ey, div);\n    // ... so the result will be `rem << ey`\n\n    if rem.is_zero() {\n        // Return zero with the sign of `x`\n        return F::from_bits(sx);\n    };\n\n    // We would shift `rem` up by `ey`, but have to stop at `F::SIG_BITS`\n    let shift = ey.min(F::SIG_BITS - rem.ilog2());\n    // Anything past that is added to the exponent field\n    let bits = (rem << shift) + (F::Int::cast_from(ey - shift) << F::SIG_BITS);\n    F::from_bits(sx + bits)\n}\n\n/// Given the bits of a finite float, return a tuple of\n///  - the mantissa with the implicit bit (0 if subnormal, 1 otherwise)\n///  - the additional exponent past 1, (0 for subnormal, 0 or more otherwise)\nfn into_sig_exp<F: Float>(mut bits: F::Int) -> (F::Int, u32) {\n    bits &= !F::SIGN_MASK;\n    // Subtract 1 from the exponent, clamping at 0\n    let sat = bits.checked_sub(F::IMPLICIT_BIT).unwrap_or(F::Int::ZERO);\n    (\n        bits - (sat & F::EXP_MASK),\n        u32::cast_from(sat >> F::SIG_BITS),\n    )\n}\n\n/// Compute the remainder `(x * 2.pow(e)) % y` without overflow.\nfn reduction<I: Int>(mut x: I, e: u32, y: I) -> I {\n    x %= y;\n    for _ in 0..e {\n        x <<= 1;\n        x = x.checked_sub(y).unwrap_or(x);\n    }\n    x\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/rint.rs",
    "sha256": "deec183fd0da6c0a47ab272a256990cea4f9231db7faff314697886457d6841a",
    "text": "/* SPDX-License-Identifier: MIT */\n/* origin: musl src/math/rint.c */\n\nuse crate::support::{Float, FpResult, Round};\n\n/// IEEE 754-2019 `roundToIntegralExact`, which respects rounding mode and raises inexact if\n/// applicable.\n#[inline]\npub fn rint_round<F: Float>(x: F, _round: Round) -> FpResult<F> {\n    let toint = F::ONE / F::EPSILON;\n    let e = x.ex();\n    let positive = x.is_sign_positive();\n\n    // On i386 `force_eval!` must be used to force rounding via storage to memory. Otherwise,\n    // the excess precission from x87 would cause an incorrect final result.\n    let force = |x| {\n        if cfg!(x86_no_sse) && (F::BITS == 32 || F::BITS == 64) {\n            force_eval!(x)\n        } else {\n            x\n        }\n    };\n\n    let res = if e >= F::EXP_BIAS + F::SIG_BITS {\n        // No fractional part; exact result can be returned.\n        x\n    } else {\n        // Apply a net-zero adjustment that nudges `y` in the direction of the rounding mode. For\n        // Rust this is always nearest, but ideally it would take `round` into account.\n        let y = if positive {\n            force(force(x) + toint) - toint\n        } else {\n            force(force(x) - toint) + toint\n        };\n\n        if y == F::ZERO {\n            // A zero result takes the sign of the input.\n            if positive { F::ZERO } else { F::NEG_ZERO }\n        } else {\n            y\n        }\n    };\n\n    FpResult::ok(res)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::support::{Hexf, Status};\n\n    fn spec_test<F: Float>(cases: &[(F, F, Status)]) {\n        let roundtrip = [\n            F::ZERO,\n            F::ONE,\n            F::NEG_ONE,\n            F::NEG_ZERO,\n            F::INFINITY,\n            F::NEG_INFINITY,\n        ];\n\n        for x in roundtrip {\n            let FpResult { val, status } = rint_round(x, Round::Nearest);\n            assert_biteq!(val, x, \"rint_round({})\", Hexf(x));\n            assert_eq!(status, Status::OK, \"{}\", Hexf(x));\n        }\n\n        for &(x, res, res_stat) in cases {\n            let FpResult { val, status } = rint_round(x, Round::Nearest);\n            assert_biteq!(val, res, \"rint_round({})\", Hexf(x));\n            assert_eq!(status, res_stat, \"{}\", Hexf(x));\n        }\n    }\n\n    #[test]\n    #[cfg(f16_enabled)]\n    fn spec_tests_f16() {\n        let cases = [];\n        spec_test::<f16>(&cases);\n    }\n\n    #[test]\n    fn spec_tests_f32() {\n        let cases = [\n            (0.1, 0.0, Status::OK),\n            (-0.1, -0.0, Status::OK),\n            (0.5, 0.0, Status::OK),\n            (-0.5, -0.0, Status::OK),\n            (0.9, 1.0, Status::OK),\n            (-0.9, -1.0, Status::OK),\n            (1.1, 1.0, Status::OK),\n            (-1.1, -1.0, Status::OK),\n            (1.5, 2.0, Status::OK),\n            (-1.5, -2.0, Status::OK),\n            (1.9, 2.0, Status::OK),\n            (-1.9, -2.0, Status::OK),\n            (2.8, 3.0, Status::OK),\n            (-2.8, -3.0, Status::OK),\n        ];\n        spec_test::<f32>(&cases);\n    }\n\n    #[test]\n    fn spec_tests_f64() {\n        let cases = [\n            (0.1, 0.0, Status::OK),\n            (-0.1, -0.0, Status::OK),\n            (0.5, 0.0, Status::OK),\n            (-0.5, -0.0, Status::OK),\n            (0.9, 1.0, Status::OK),\n            (-0.9, -1.0, Status::OK),\n            (1.1, 1.0, Status::OK),\n            (-1.1, -1.0, Status::OK),\n            (1.5, 2.0, Status::OK),\n            (-1.5, -2.0, Status::OK),\n            (1.9, 2.0, Status::OK),\n            (-1.9, -2.0, Status::OK),\n            (2.8, 3.0, Status::OK),\n            (-2.8, -3.0, Status::OK),\n        ];\n        spec_test::<f64>(&cases);\n    }\n\n    #[test]\n    #[cfg(f128_enabled)]\n    fn spec_tests_f128() {\n        let cases = [];\n        spec_test::<f128>(&cases);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/sqrt.rs",
    "sha256": "c58e48ec07404d618109ad45332efe46c5246f42a2ddefdf5b25ba19e4ca9a0f",
    "text": "/* SPDX-License-Identifier: MIT */\n/* origin: musl src/math/sqrt.c. Ported to generic Rust algorithm in 2025, TG. */\n\n//! Generic square root algorithm.\n//!\n//! This routine operates around `m_u2`, a U.2 (fixed point with two integral bits) mantissa\n//! within the range [1, 4). A table lookup provides an initial estimate, then goldschmidt\n//! iterations at various widths are used to approach the real values.\n//!\n//! For the iterations, `r` is a U0 number that approaches `1/sqrt(m_u2)`, and `s` is a U2 number\n//! that approaches `sqrt(m_u2)`. Recall that m_u2 ∈ [1, 4).\n//!\n//! With Newton-Raphson iterations, this would be:\n//!\n//! - `w = r * r           w ~ 1 / m`\n//! - `u = 3 - m * w       u ~ 3 - m * w = 3 - m / m = 2`\n//! - `r = r * u / 2       r ~ r`\n//!\n//! (Note that the righthand column does not show anything analytically meaningful (i.e. r ~ r),\n//! since the value of performing one iteration is in reducing the error representable by `~`).\n//!\n//! Instead of Newton-Raphson iterations, Goldschmidt iterations are used to calculate\n//! `s = m * r`:\n//!\n//! - `s = m * r           s ~ m / sqrt(m)`\n//! - `u = 3 - s * r       u ~ 3 - (m / sqrt(m)) * (1 / sqrt(m)) = 3 - m / m = 2`\n//! - `r = r * u / 2       r ~ r`\n//! - `s = s * u / 2       s ~ s`\n//!\n//! The above is precise because it uses the original value `m`. There is also a faster version\n//! that performs fewer steps but does not use `m`:\n//!\n//! - `u = 3 - s * r       u ~ 3 - 1`\n//! - `r = r * u / 2       r ~ r`\n//! - `s = s * u / 2       s ~ s`\n//!\n//! Rounding errors accumulate faster with the second version, so it is only used for subsequent\n//! iterations within the same width integer. The first version is always used for the first\n//! iteration at a new width in order to avoid this accumulation.\n//!\n//! Goldschmidt has the advantage over Newton-Raphson that `sqrt(x)` and `1/sqrt(x)` are\n//! computed at the same time, i.e. there is no need to calculate `1/sqrt(x)` and invert it.\n\nuse crate::support::{\n    CastFrom, CastInto, DInt, Float, FpResult, HInt, Int, IntTy, MinInt, Round, Status, cold_path,\n};\n\n#[inline]\npub fn sqrt<F>(x: F) -> F\nwhere\n    F: Float + SqrtHelper,\n    F::Int: HInt,\n    F::Int: From<u8>,\n    F::Int: From<F::ISet2>,\n    F::Int: CastInto<F::ISet1>,\n    F::Int: CastInto<F::ISet2>,\n    u32: CastInto<F::Int>,\n{\n    sqrt_round(x, Round::Nearest).val\n}\n\n#[inline]\npub fn sqrt_round<F>(x: F, _round: Round) -> FpResult<F>\nwhere\n    F: Float + SqrtHelper,\n    F::Int: HInt,\n    F::Int: From<u8>,\n    F::Int: From<F::ISet2>,\n    F::Int: CastInto<F::ISet1>,\n    F::Int: CastInto<F::ISet2>,\n    u32: CastInto<F::Int>,\n{\n    let zero = IntTy::<F>::ZERO;\n    let one = IntTy::<F>::ONE;\n\n    let mut ix = x.to_bits();\n\n    // Top is the exponent and sign, which may or may not be shifted. If the float fits into a\n    // `u32`, we can get by without paying shifting costs.\n    let noshift = F::BITS <= u32::BITS;\n    let (mut top, special_case) = if noshift {\n        let exp_lsb = one << F::SIG_BITS;\n        let special_case = ix.wrapping_sub(exp_lsb) >= F::EXP_MASK - exp_lsb;\n        (Exp::NoShift(()), special_case)\n    } else {\n        let top = u32::cast_from(ix >> F::SIG_BITS);\n        let special_case = top.wrapping_sub(1) >= F::EXP_SAT - 1;\n        (Exp::Shifted(top), special_case)\n    };\n\n    // Handle NaN, zero, and out of domain (<= 0)\n    if special_case {\n        cold_path();\n\n        // +/-0\n        if ix << 1 == zero {\n            return FpResult::ok(x);\n        }\n\n        // Positive infinity\n        if ix == F::EXP_MASK {\n            return FpResult::ok(x);\n        }\n\n        // NaN or negative\n        if ix > F::EXP_MASK {\n            return FpResult::new(F::NAN, Status::INVALID);\n        }\n\n        // Normalize subnormals by multiplying by 1.0 << SIG_BITS (e.g. 0x1p52 for doubles).\n        let scaled = x * F::from_parts(false, F::SIG_BITS + F::EXP_BIAS, zero);\n        ix = scaled.to_bits();\n        match top {\n            Exp::Shifted(ref mut v) => {\n                *v = scaled.ex();\n                *v = (*v).wrapping_sub(F::SIG_BITS);\n            }\n            Exp::NoShift(()) => {\n                ix = ix.wrapping_sub((F::SIG_BITS << F::SIG_BITS).cast());\n            }\n        }\n    }\n\n    // Reduce arguments such that `x = 4^e * m`:\n    //\n    // - m_u2 ∈ [1, 4), a fixed point U2.BITS number\n    // - 2^e is the exponent part of the result\n    let (m_u2, exp) = match top {\n        Exp::Shifted(top) => {\n            // We now know `x` is positive, so `top` is just its (biased) exponent\n            let mut e = top;\n            // Construct a fixed point representation of the mantissa.\n            let mut m_u2 = (ix | F::IMPLICIT_BIT) << F::EXP_BITS;\n            let even = (e & 1) != 0;\n            if even {\n                m_u2 >>= 1;\n            }\n            e = (e.wrapping_add(F::EXP_SAT >> 1)) >> 1;\n            (m_u2, Exp::Shifted(e))\n        }\n        Exp::NoShift(()) => {\n            let even = ix & (one << F::SIG_BITS) != zero;\n\n            // Exponent part of the return value\n            let mut e_noshift = ix >> 1;\n            // ey &= (F::EXP_MASK << 2) >> 2; // clear the top exponent bit (result = 1.0)\n            e_noshift += (F::EXP_MASK ^ (F::SIGN_MASK >> 1)) >> 1;\n            e_noshift &= F::EXP_MASK;\n\n            let m1 = (ix << F::EXP_BITS) | F::SIGN_MASK;\n            let m0 = (ix << (F::EXP_BITS - 1)) & !F::SIGN_MASK;\n            let m_u2 = if even { m0 } else { m1 };\n\n            (m_u2, Exp::NoShift(e_noshift))\n        }\n    };\n\n    // Extract the top 6 bits of the significand with the lowest bit of the exponent.\n    let i = usize::cast_from(ix >> (F::SIG_BITS - 6)) & 0b1111111;\n\n    // Start with an initial guess for `r = 1 / sqrt(m)` from the table, and shift `m` as an\n    // initial value for `s = sqrt(m)`. See the module documentation for details.\n    let r1_u0: F::ISet1 = F::ISet1::cast_from(RSQRT_TAB[i]) << (F::ISet1::BITS - 16);\n    let s1_u2: F::ISet1 = ((m_u2) >> (F::BITS - F::ISet1::BITS)).cast();\n\n    // Perform iterations, if any, at quarter width (used for `f128`).\n    let (r1_u0, _s1_u2) = goldschmidt::<F, F::ISet1>(r1_u0, s1_u2, F::SET1_ROUNDS, false);\n\n    // Widen values and perform iterations at half width (used for `f64` and `f128`).\n    let r2_u0: F::ISet2 = F::ISet2::from(r1_u0) << (F::ISet2::BITS - F::ISet1::BITS);\n    let s2_u2: F::ISet2 = ((m_u2) >> (F::BITS - F::ISet2::BITS)).cast();\n    let (r2_u0, _s2_u2) = goldschmidt::<F, F::ISet2>(r2_u0, s2_u2, F::SET2_ROUNDS, false);\n\n    // Perform final iterations at full width (used for all float types).\n    let r_u0: F::Int = F::Int::from(r2_u0) << (F::BITS - F::ISet2::BITS);\n    let s_u2: F::Int = m_u2;\n    let (_r_u0, s_u2) = goldschmidt::<F, F::Int>(r_u0, s_u2, F::FINAL_ROUNDS, true);\n\n    // Shift back to mantissa position.\n    let mut m = s_u2 >> (F::EXP_BITS - 2);\n\n    // The musl source includes the following comment (with literals replaced):\n    //\n    // > s < sqrt(m) < s + 0x1.09p-SIG_BITS\n    // > compute nearest rounded result: the nearest result to SIG_BITS bits is either s or\n    // > s+0x1p-SIG_BITS, we can decide by comparing (2^SIG_BITS s + 0.5)^2 to 2^(2*SIG_BITS) m.\n    //\n    // Expanding this with , with `SIG_BITS = p` and adjusting based on the operations done to\n    // `d0` and `d1`:\n    //\n    // - `2^(2p)m ≟ ((2^p)m + 0.5)^2`\n    // - `2^(2p)m ≟ 2^(2p)m^2 + (2^p)m + 0.25`\n    // - `2^(2p)m - m^2 ≟ (2^(2p) - 1)m^2 + (2^p)m + 0.25`\n    // - `(1 - 2^(2p))m + m^2 ≟ (1 - 2^(2p))m^2 + (1 - 2^p)m + 0.25` (?)\n    //\n    // I do not follow how the rounding bit is extracted from this comparison with the below\n    // operations. In any case, the algorithm is well tested.\n\n    // The value needed to shift `m_u2` by to create `m*2^(2p)`. `2p = 2 * F::SIG_BITS`,\n    // `F::BITS - 2` accounts for the offset that `m_u2` already has.\n    let shift = 2 * F::SIG_BITS - (F::BITS - 2);\n\n    // `2^(2p)m - m^2`\n    let d0 = (m_u2 << shift).wrapping_sub(m.wrapping_mul(m));\n    // `m - 2^(2p)m + m^2`\n    let d1 = m.wrapping_sub(d0);\n    m += d1 >> (F::BITS - 1);\n    m &= F::SIG_MASK;\n\n    match exp {\n        Exp::Shifted(e) => m |= IntTy::<F>::cast_from(e) << F::SIG_BITS,\n        Exp::NoShift(e) => m |= e,\n    };\n\n    let mut y = F::from_bits(m);\n\n    // FIXME(f16): the fenv math does not work for `f16`\n    if F::BITS > 16 {\n        // Handle rounding and inexact. `(m + 1)^2 == 2^shift m` is exact; for all other cases, add\n        // a tiny value to cause fenv effects.\n        let d2 = d1.wrapping_add(m).wrapping_add(one);\n        let mut tiny = if d2 == zero {\n            cold_path();\n            zero\n        } else {\n            F::IMPLICIT_BIT\n        };\n\n        tiny |= (d1 ^ d2) & F::SIGN_MASK;\n        let t = F::from_bits(tiny);\n        y = y + t;\n    }\n\n    FpResult::ok(y)\n}\n\n/// Multiply at the wider integer size, returning the high half.\nfn wmulh<I: HInt>(a: I, b: I) -> I {\n    a.widen_mul(b).hi()\n}\n\n/// Perform `count` goldschmidt iterations, returning `(r_u0, s_u?)`.\n///\n/// - `r_u0` is the reciprocal `r ~ 1 / sqrt(m)`, as U0.\n/// - `s_u2` is the square root, `s ~ sqrt(m)`, as U2.\n/// - `count` is the number of iterations to perform.\n/// - `final_set` should be true if this is the last round (same-sized integer). If so, the\n///   returned `s` will be U3, for later shifting. Otherwise, the returned `s` is U2.\n///\n/// Note that performance relies on the optimizer being able to unroll these loops (reasonably\n/// trivial, `count` is a constant when called).\n#[inline]\nfn goldschmidt<F, I>(mut r_u0: I, mut s_u2: I, count: u32, final_set: bool) -> (I, I)\nwhere\n    F: SqrtHelper,\n    I: HInt + From<u8>,\n{\n    let three_u2 = I::from(0b11u8) << (I::BITS - 2);\n    let mut u_u0 = r_u0;\n\n    for i in 0..count {\n        // First iteration: `s = m*r` (`u_u0 = r_u0` set above)\n        // Subsequent iterations: `s=s*u/2`\n        s_u2 = wmulh(s_u2, u_u0);\n\n        // Perform `s /= 2` if:\n        //\n        // 1. This is not the first iteration (the first iteration is `s = m*r`)...\n        // 2. ... and this is not the last set of iterations\n        // 3. ... or, if this is the last set, it is not the last iteration\n        //\n        // This step is not performed for the final iteration because the shift is combined with\n        // a later shift (moving `s` into the mantissa).\n        if i > 0 && (!final_set || i + 1 < count) {\n            s_u2 <<= 1;\n        }\n\n        // u = 3 - s*r\n        let d_u2 = wmulh(s_u2, r_u0);\n        u_u0 = three_u2.wrapping_sub(d_u2);\n\n        // r = r*u/2\n        r_u0 = wmulh(r_u0, u_u0) << 1;\n    }\n\n    (r_u0, s_u2)\n}\n\n/// Representation of whether we shift the exponent into a `u32`, or modify it in place to save\n/// the shift operations.\nenum Exp<T> {\n    /// The exponent has been shifted to a `u32` and is LSB-aligned.\n    Shifted(u32),\n    /// The exponent is in its natural position in integer repr.\n    NoShift(T),\n}\n\n/// Size-specific constants related to the square root routine.\npub trait SqrtHelper: Float {\n    /// Integer for the first set of rounds. If unused, set to the same type as the next set.\n    type ISet1: HInt + Into<Self::ISet2> + CastFrom<Self::Int> + From<u8>;\n    /// Integer for the second set of rounds. If unused, set to the same type as the next set.\n    type ISet2: HInt + From<Self::ISet1> + From<u8>;\n\n    /// Number of rounds at `ISet1`.\n    const SET1_ROUNDS: u32 = 0;\n    /// Number of rounds at `ISet2`.\n    const SET2_ROUNDS: u32 = 0;\n    /// Number of rounds at `Self::Int`.\n    const FINAL_ROUNDS: u32;\n}\n\n#[cfg(f16_enabled)]\nimpl SqrtHelper for f16 {\n    type ISet1 = u16; // unused\n    type ISet2 = u16; // unused\n\n    const FINAL_ROUNDS: u32 = 2;\n}\n\nimpl SqrtHelper for f32 {\n    type ISet1 = u32; // unused\n    type ISet2 = u32; // unused\n\n    const FINAL_ROUNDS: u32 = 3;\n}\n\nimpl SqrtHelper for f64 {\n    type ISet1 = u32; // unused\n    type ISet2 = u32;\n\n    const SET2_ROUNDS: u32 = 2;\n    const FINAL_ROUNDS: u32 = 2;\n}\n\n#[cfg(f128_enabled)]\nimpl SqrtHelper for f128 {\n    type ISet1 = u32;\n    type ISet2 = u64;\n\n    const SET1_ROUNDS: u32 = 1;\n    const SET2_ROUNDS: u32 = 2;\n    const FINAL_ROUNDS: u32 = 2;\n}\n\n/// A U0.16 representation of `1/sqrt(x)`.\n///\n/// The index is a 7-bit number consisting of a single exponent bit and 6 bits of significand.\n#[rustfmt::skip]\nstatic RSQRT_TAB: [u16; 128] = [\n    0xb451, 0xb2f0, 0xb196, 0xb044, 0xaef9, 0xadb6, 0xac79, 0xab43,\n    0xaa14, 0xa8eb, 0xa7c8, 0xa6aa, 0xa592, 0xa480, 0xa373, 0xa26b,\n    0xa168, 0xa06a, 0x9f70, 0x9e7b, 0x9d8a, 0x9c9d, 0x9bb5, 0x9ad1,\n    0x99f0, 0x9913, 0x983a, 0x9765, 0x9693, 0x95c4, 0x94f8, 0x9430,\n    0x936b, 0x92a9, 0x91ea, 0x912e, 0x9075, 0x8fbe, 0x8f0a, 0x8e59,\n    0x8daa, 0x8cfe, 0x8c54, 0x8bac, 0x8b07, 0x8a64, 0x89c4, 0x8925,\n    0x8889, 0x87ee, 0x8756, 0x86c0, 0x862b, 0x8599, 0x8508, 0x8479,\n    0x83ec, 0x8361, 0x82d8, 0x8250, 0x81c9, 0x8145, 0x80c2, 0x8040,\n    0xff02, 0xfd0e, 0xfb25, 0xf947, 0xf773, 0xf5aa, 0xf3ea, 0xf234,\n    0xf087, 0xeee3, 0xed47, 0xebb3, 0xea27, 0xe8a3, 0xe727, 0xe5b2,\n    0xe443, 0xe2dc, 0xe17a, 0xe020, 0xdecb, 0xdd7d, 0xdc34, 0xdaf1,\n    0xd9b3, 0xd87b, 0xd748, 0xd61a, 0xd4f1, 0xd3cd, 0xd2ad, 0xd192,\n    0xd07b, 0xcf69, 0xce5b, 0xcd51, 0xcc4a, 0xcb48, 0xca4a, 0xc94f,\n    0xc858, 0xc764, 0xc674, 0xc587, 0xc49d, 0xc3b7, 0xc2d4, 0xc1f4,\n    0xc116, 0xc03c, 0xbf65, 0xbe90, 0xbdbe, 0xbcef, 0xbc23, 0xbb59,\n    0xba91, 0xb9cc, 0xb90a, 0xb84a, 0xb78c, 0xb6d0, 0xb617, 0xb560,\n];\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    /// Test behavior specified in IEEE 754 `squareRoot`.\n    fn spec_test<F>()\n    where\n        F: Float + SqrtHelper,\n        F::Int: HInt,\n        F::Int: From<u8>,\n        F::Int: From<F::ISet2>,\n        F::Int: CastInto<F::ISet1>,\n        F::Int: CastInto<F::ISet2>,\n        u32: CastInto<F::Int>,\n    {\n        // Values that should return a NaN and raise invalid\n        let nan = [F::NEG_INFINITY, F::NEG_ONE, F::NAN, F::MIN];\n\n        // Values that return unaltered\n        let roundtrip = [F::ZERO, F::NEG_ZERO, F::INFINITY];\n\n        for x in nan {\n            let FpResult { val, status } = sqrt_round(x, Round::Nearest);\n            assert!(val.is_nan());\n            assert!(status == Status::INVALID);\n        }\n\n        for x in roundtrip {\n            let FpResult { val, status } = sqrt_round(x, Round::Nearest);\n            assert_biteq!(val, x);\n            assert!(status == Status::OK);\n        }\n    }\n\n    #[test]\n    #[cfg(f16_enabled)]\n    fn sanity_check_f16() {\n        assert_biteq!(sqrt(100.0f16), 10.0);\n        assert_biteq!(sqrt(4.0f16), 2.0);\n    }\n\n    #[test]\n    #[cfg(f16_enabled)]\n    fn spec_tests_f16() {\n        spec_test::<f16>();\n    }\n\n    #[test]\n    #[cfg(f16_enabled)]\n    #[allow(clippy::approx_constant)]\n    fn conformance_tests_f16() {\n        let cases = [\n            (f16::PI, 0x3f17_u16),\n            // 10_000.0, using a hex literal for MSRV hack (Rust < 1.67 checks literal widths as\n            // part of the AST, so the `cfg` is irrelevant here).\n            (f16::from_bits(0x70e2), 0x5640_u16),\n            (f16::from_bits(0x0000000f), 0x13bf_u16),\n            (f16::INFINITY, f16::INFINITY.to_bits()),\n        ];\n\n        for (input, output) in cases {\n            assert_biteq!(\n                sqrt(input),\n                f16::from_bits(output),\n                \"input: {input:?} ({:#018x})\",\n                input.to_bits()\n            );\n        }\n    }\n\n    #[test]\n    fn sanity_check_f32() {\n        assert_biteq!(sqrt(100.0f32), 10.0);\n        assert_biteq!(sqrt(4.0f32), 2.0);\n    }\n\n    #[test]\n    fn spec_tests_f32() {\n        spec_test::<f32>();\n    }\n\n    #[test]\n    #[allow(clippy::approx_constant)]\n    fn conformance_tests_f32() {\n        let cases = [\n            (f32::PI, 0x3fe2dfc5_u32),\n            (10000.0f32, 0x42c80000_u32),\n            (f32::from_bits(0x0000000f), 0x1b2f456f_u32),\n            (f32::INFINITY, f32::INFINITY.to_bits()),\n        ];\n\n        for (input, output) in cases {\n            assert_biteq!(\n                sqrt(input),\n                f32::from_bits(output),\n                \"input: {input:?} ({:#018x})\",\n                input.to_bits()\n            );\n        }\n    }\n\n    #[test]\n    fn sanity_check_f64() {\n        assert_biteq!(sqrt(100.0f64), 10.0);\n        assert_biteq!(sqrt(4.0f64), 2.0);\n    }\n\n    #[test]\n    fn spec_tests_f64() {\n        spec_test::<f64>();\n    }\n\n    #[test]\n    #[allow(clippy::approx_constant)]\n    fn conformance_tests_f64() {\n        let cases = [\n            (f64::PI, 0x3ffc5bf891b4ef6a_u64),\n            (10000.0, 0x4059000000000000_u64),\n            (f64::from_bits(0x0000000f), 0x1e7efbdeb14f4eda_u64),\n            (f64::INFINITY, f64::INFINITY.to_bits()),\n        ];\n\n        for (input, output) in cases {\n            assert_biteq!(\n                sqrt(input),\n                f64::from_bits(output),\n                \"input: {input:?} ({:#018x})\",\n                input.to_bits()\n            );\n        }\n    }\n\n    #[test]\n    #[cfg(f128_enabled)]\n    fn sanity_check_f128() {\n        assert_biteq!(sqrt(100.0f128), 10.0);\n        assert_biteq!(sqrt(4.0f128), 2.0);\n    }\n\n    #[test]\n    #[cfg(f128_enabled)]\n    fn spec_tests_f128() {\n        spec_test::<f128>();\n    }\n\n    #[test]\n    #[cfg(f128_enabled)]\n    #[allow(clippy::approx_constant)]\n    fn conformance_tests_f128() {\n        let cases = [\n            (f128::PI, 0x3fffc5bf891b4ef6aa79c3b0520d5db9_u128),\n            // 10_000.0, see `f16` for reasoning.\n            (\n                f128::from_bits(0x400c3880000000000000000000000000),\n                0x40059000000000000000000000000000_u128,\n            ),\n            (\n                f128::from_bits(0x0000000f),\n                0x1fc9efbdeb14f4ed9b17ae807907e1e9_u128,\n            ),\n            (f128::INFINITY, f128::INFINITY.to_bits()),\n        ];\n\n        for (input, output) in cases {\n            assert_biteq!(\n                sqrt(input),\n                f128::from_bits(output),\n                \"input: {input:?} ({:#018x})\",\n                input.to_bits()\n            );\n        }\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/generic/trunc.rs",
    "sha256": "46dd2cc35f6da25099ea2202264d8da3330b5ff1a962a8afb671b54b6ef6002d",
    "text": "/* SPDX-License-Identifier: MIT\n * origin: musl src/math/trunc.c */\n\nuse crate::support::{Float, FpResult, Int, IntTy, MinInt, Status};\n\n#[inline]\npub fn trunc<F: Float>(x: F) -> F {\n    trunc_status(x).val\n}\n\n#[inline]\npub fn trunc_status<F: Float>(x: F) -> FpResult<F> {\n    let mut xi: F::Int = x.to_bits();\n    let e: i32 = x.exp_unbiased();\n\n    // C1: The represented value has no fractional part, so no truncation is needed\n    if e >= F::SIG_BITS as i32 {\n        return FpResult::ok(x);\n    }\n\n    let mask = if e < 0 {\n        // C2: If the exponent is negative, the result will be zero so we mask out everything\n        // except the sign.\n        F::SIGN_MASK\n    } else {\n        // C3: Otherwise, we mask out the last `e` bits of the significand.\n        !(F::SIG_MASK >> e.unsigned())\n    };\n\n    // C4: If the to-be-masked-out portion is already zero, we have an exact result\n    if (xi & !mask) == IntTy::<F>::ZERO {\n        return FpResult::ok(x);\n    }\n\n    // C5: Otherwise the result is inexact and we will truncate. Raise `FE_INEXACT`, mask the\n    // result, and return.\n\n    let status = if xi & F::SIG_MASK == F::Int::ZERO {\n        Status::OK\n    } else {\n        Status::INEXACT\n    };\n    xi &= mask;\n    FpResult::new(F::from_bits(xi), status)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use crate::support::Hexf;\n\n    fn spec_test<F: Float>(cases: &[(F, F, Status)]) {\n        let roundtrip = [\n            F::ZERO,\n            F::ONE,\n            F::NEG_ONE,\n            F::NEG_ZERO,\n            F::INFINITY,\n            F::NEG_INFINITY,\n        ];\n\n        for x in roundtrip {\n            let FpResult { val, status } = trunc_status(x);\n            assert_biteq!(val, x, \"{}\", Hexf(x));\n            assert_eq!(status, Status::OK, \"{}\", Hexf(x));\n        }\n\n        for &(x, res, res_stat) in cases {\n            let FpResult { val, status } = trunc_status(x);\n            assert_biteq!(val, res, \"{}\", Hexf(x));\n            assert_eq!(status, res_stat, \"{}\", Hexf(x));\n        }\n    }\n\n    /* Skipping f16 / f128 \"sanity_check\"s and spec cases due to rejected literal lexing at MSRV */\n\n    #[test]\n    #[cfg(f16_enabled)]\n    fn spec_tests_f16() {\n        let cases = [];\n        spec_test::<f16>(&cases);\n    }\n\n    #[test]\n    fn sanity_check_f32() {\n        assert_eq!(trunc(0.5f32), 0.0);\n        assert_eq!(trunc(1.1f32), 1.0);\n        assert_eq!(trunc(2.9f32), 2.0);\n    }\n\n    #[test]\n    fn spec_tests_f32() {\n        let cases = [\n            (0.1, 0.0, Status::INEXACT),\n            (-0.1, -0.0, Status::INEXACT),\n            (0.9, 0.0, Status::INEXACT),\n            (-0.9, -0.0, Status::INEXACT),\n            (1.1, 1.0, Status::INEXACT),\n            (-1.1, -1.0, Status::INEXACT),\n            (1.9, 1.0, Status::INEXACT),\n            (-1.9, -1.0, Status::INEXACT),\n        ];\n        spec_test::<f32>(&cases);\n\n        assert_biteq!(trunc(1.1f32), 1.0);\n        assert_biteq!(trunc(1.1f64), 1.0);\n\n        // C1\n        assert_biteq!(trunc(hf32!(\"0x1p23\")), hf32!(\"0x1p23\"));\n        assert_biteq!(trunc(hf64!(\"0x1p52\")), hf64!(\"0x1p52\"));\n        assert_biteq!(trunc(hf32!(\"-0x1p23\")), hf32!(\"-0x1p23\"));\n        assert_biteq!(trunc(hf64!(\"-0x1p52\")), hf64!(\"-0x1p52\"));\n\n        // C2\n        assert_biteq!(trunc(hf32!(\"0x1p-1\")), 0.0);\n        assert_biteq!(trunc(hf64!(\"0x1p-1\")), 0.0);\n        assert_biteq!(trunc(hf32!(\"-0x1p-1\")), -0.0);\n        assert_biteq!(trunc(hf64!(\"-0x1p-1\")), -0.0);\n    }\n\n    #[test]\n    fn sanity_check_f64() {\n        assert_eq!(trunc(1.1f64), 1.0);\n        assert_eq!(trunc(2.9f64), 2.0);\n    }\n\n    #[test]\n    fn spec_tests_f64() {\n        let cases = [\n            (0.1, 0.0, Status::INEXACT),\n            (-0.1, -0.0, Status::INEXACT),\n            (0.9, 0.0, Status::INEXACT),\n            (-0.9, -0.0, Status::INEXACT),\n            (1.1, 1.0, Status::INEXACT),\n            (-1.1, -1.0, Status::INEXACT),\n            (1.9, 1.0, Status::INEXACT),\n            (-1.9, -1.0, Status::INEXACT),\n        ];\n        spec_test::<f64>(&cases);\n    }\n\n    #[test]\n    #[cfg(f128_enabled)]\n    fn spec_tests_f128() {\n        let cases = [];\n        spec_test::<f128>(&cases);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/j0.rs",
    "sha256": "a2e4f870b3051a69fd32ee224997d70bc1be470d9a41eda0c403cdaeff80fe11",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_j0.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* j0(x), y0(x)\n * Bessel function of the first and second kinds of order zero.\n * Method -- j0(x):\n *      1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ...\n *      2. Reduce x to |x| since j0(x)=j0(-x),  and\n *         for x in (0,2)\n *              j0(x) = 1-z/4+ z^2*R0/S0,  where z = x*x;\n *         (precision:  |j0-1+z/4-z^2R0/S0 |<2**-63.67 )\n *         for x in (2,inf)\n *              j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0))\n *         where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)\n *         as follow:\n *              cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4)\n *                      = 1/sqrt(2) * (cos(x) + sin(x))\n *              sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4)\n *                      = 1/sqrt(2) * (sin(x) - cos(x))\n *         (To avoid cancellation, use\n *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))\n *          to compute the worse one.)\n *\n *      3 Special cases\n *              j0(nan)= nan\n *              j0(0) = 1\n *              j0(inf) = 0\n *\n * Method -- y0(x):\n *      1. For x<2.\n *         Since\n *              y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...)\n *         therefore y0(x)-2/pi*j0(x)*ln(x) is an even function.\n *         We use the following function to approximate y0,\n *              y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2\n *         where\n *              U(z) = u00 + u01*z + ... + u06*z^6\n *              V(z) = 1  + v01*z + ... + v04*z^4\n *         with absolute approximation error bounded by 2**-72.\n *         Note: For tiny x, U/V = u0 and j0(x)~1, hence\n *              y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27)\n *      2. For x>=2.\n *              y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0))\n *         where x0 = x-pi/4. It is better to compute sin(x0),cos(x0)\n *         by the method mentioned above.\n *      3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0.\n */\n\nuse super::{cos, fabs, get_high_word, get_low_word, log, sin, sqrt};\nconst INVSQRTPI: f64 = 5.64189583547756279280e-01; /* 0x3FE20DD7, 0x50429B6D */\nconst TPI: f64 = 6.36619772367581382433e-01; /* 0x3FE45F30, 0x6DC9C883 */\n\n/* common method when |x|>=2 */\nfn common(ix: u32, x: f64, y0: bool) -> f64 {\n    let s: f64;\n    let mut c: f64;\n    let mut ss: f64;\n    let mut cc: f64;\n    let z: f64;\n\n    /*\n     * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x-pi/4)-q0(x)*sin(x-pi/4))\n     * y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x-pi/4)+q0(x)*cos(x-pi/4))\n     *\n     * sin(x-pi/4) = (sin(x) - cos(x))/sqrt(2)\n     * cos(x-pi/4) = (sin(x) + cos(x))/sqrt(2)\n     * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))\n     */\n    s = sin(x);\n    c = cos(x);\n    if y0 {\n        c = -c;\n    }\n    cc = s + c;\n    /* avoid overflow in 2*x, big ulp error when x>=0x1p1023 */\n    if ix < 0x7fe00000 {\n        ss = s - c;\n        z = -cos(2.0 * x);\n        if s * c < 0.0 {\n            cc = z / ss;\n        } else {\n            ss = z / cc;\n        }\n        if ix < 0x48000000 {\n            if y0 {\n                ss = -ss;\n            }\n            cc = pzero(x) * cc - qzero(x) * ss;\n        }\n    }\n    return INVSQRTPI * cc / sqrt(x);\n}\n\n/* R0/S0 on [0, 2.00] */\nconst R02: f64 = 1.56249999999999947958e-02; /* 0x3F8FFFFF, 0xFFFFFFFD */\nconst R03: f64 = -1.89979294238854721751e-04; /* 0xBF28E6A5, 0xB61AC6E9 */\nconst R04: f64 = 1.82954049532700665670e-06; /* 0x3EBEB1D1, 0x0C503919 */\nconst R05: f64 = -4.61832688532103189199e-09; /* 0xBE33D5E7, 0x73D63FCE */\nconst S01: f64 = 1.56191029464890010492e-02; /* 0x3F8FFCE8, 0x82C8C2A4 */\nconst S02: f64 = 1.16926784663337450260e-04; /* 0x3F1EA6D2, 0xDD57DBF4 */\nconst S03: f64 = 5.13546550207318111446e-07; /* 0x3EA13B54, 0xCE84D5A9 */\nconst S04: f64 = 1.16614003333790000205e-09; /* 0x3E1408BC, 0xF4745D8F */\n\n/// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn j0(mut x: f64) -> f64 {\n    let z: f64;\n    let r: f64;\n    let s: f64;\n    let mut ix: u32;\n\n    ix = get_high_word(x);\n    ix &= 0x7fffffff;\n\n    /* j0(+-inf)=0, j0(nan)=nan */\n    if ix >= 0x7ff00000 {\n        return 1.0 / (x * x);\n    }\n    x = fabs(x);\n\n    if ix >= 0x40000000 {\n        /* |x| >= 2 */\n        /* large ulp error near zeros: 2.4, 5.52, 8.6537,.. */\n        return common(ix, x, false);\n    }\n\n    /* 1 - x*x/4 + x*x*R(x^2)/S(x^2) */\n    if ix >= 0x3f200000 {\n        /* |x| >= 2**-13 */\n        /* up to 4ulp error close to 2 */\n        z = x * x;\n        r = z * (R02 + z * (R03 + z * (R04 + z * R05)));\n        s = 1.0 + z * (S01 + z * (S02 + z * (S03 + z * S04)));\n        return (1.0 + x / 2.0) * (1.0 - x / 2.0) + z * (r / s);\n    }\n\n    /* 1 - x*x/4 */\n    /* prevent underflow */\n    /* inexact should be raised when x!=0, this is not done correctly */\n    if ix >= 0x38000000 {\n        /* |x| >= 2**-127 */\n        x = 0.25 * x * x;\n    }\n    return 1.0 - x;\n}\n\nconst U00: f64 = -7.38042951086872317523e-02; /* 0xBFB2E4D6, 0x99CBD01F */\nconst U01: f64 = 1.76666452509181115538e-01; /* 0x3FC69D01, 0x9DE9E3FC */\nconst U02: f64 = -1.38185671945596898896e-02; /* 0xBF8C4CE8, 0xB16CFA97 */\nconst U03: f64 = 3.47453432093683650238e-04; /* 0x3F36C54D, 0x20B29B6B */\nconst U04: f64 = -3.81407053724364161125e-06; /* 0xBECFFEA7, 0x73D25CAD */\nconst U05: f64 = 1.95590137035022920206e-08; /* 0x3E550057, 0x3B4EABD4 */\nconst U06: f64 = -3.98205194132103398453e-11; /* 0xBDC5E43D, 0x693FB3C8 */\nconst V01: f64 = 1.27304834834123699328e-02; /* 0x3F8A1270, 0x91C9C71A */\nconst V02: f64 = 7.60068627350353253702e-05; /* 0x3F13ECBB, 0xF578C6C1 */\nconst V03: f64 = 2.59150851840457805467e-07; /* 0x3E91642D, 0x7FF202FD */\nconst V04: f64 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */\n\n/// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn y0(x: f64) -> f64 {\n    let z: f64;\n    let u: f64;\n    let v: f64;\n    let ix: u32;\n    let lx: u32;\n\n    ix = get_high_word(x);\n    lx = get_low_word(x);\n\n    /* y0(nan)=nan, y0(<0)=nan, y0(0)=-inf, y0(inf)=0 */\n    if ((ix << 1) | lx) == 0 {\n        return -1.0 / 0.0;\n    }\n    if (ix >> 31) != 0 {\n        return 0.0 / 0.0;\n    }\n    if ix >= 0x7ff00000 {\n        return 1.0 / x;\n    }\n\n    if ix >= 0x40000000 {\n        /* x >= 2 */\n        /* large ulp errors near zeros: 3.958, 7.086,.. */\n        return common(ix, x, true);\n    }\n\n    /* U(x^2)/V(x^2) + (2/pi)*j0(x)*log(x) */\n    if ix >= 0x3e400000 {\n        /* x >= 2**-27 */\n        /* large ulp error near the first zero, x ~= 0.89 */\n        z = x * x;\n        u = U00 + z * (U01 + z * (U02 + z * (U03 + z * (U04 + z * (U05 + z * U06)))));\n        v = 1.0 + z * (V01 + z * (V02 + z * (V03 + z * V04)));\n        return u / v + TPI * (j0(x) * log(x));\n    }\n    return U00 + TPI * log(x);\n}\n\n/* The asymptotic expansions of pzero is\n *      1 - 9/128 s^2 + 11025/98304 s^4 - ...,  where s = 1/x.\n * For x >= 2, We approximate pzero by\n *      pzero(x) = 1 + (R/S)\n * where  R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10\n *        S = 1 + pS0*s^2 + ... + pS4*s^10\n * and\n *      | pzero(x)-1-R/S | <= 2  ** ( -60.26)\n */\nconst PR8: [f64; 6] = [\n    /* for x in [inf, 8]=1/[0,0.125] */\n    0.00000000000000000000e+00,  /* 0x00000000, 0x00000000 */\n    -7.03124999999900357484e-02, /* 0xBFB1FFFF, 0xFFFFFD32 */\n    -8.08167041275349795626e+00, /* 0xC02029D0, 0xB44FA779 */\n    -2.57063105679704847262e+02, /* 0xC0701102, 0x7B19E863 */\n    -2.48521641009428822144e+03, /* 0xC0A36A6E, 0xCD4DCAFC */\n    -5.25304380490729545272e+03, /* 0xC0B4850B, 0x36CC643D */\n];\nconst PS8: [f64; 5] = [\n    1.16534364619668181717e+02, /* 0x405D2233, 0x07A96751 */\n    3.83374475364121826715e+03, /* 0x40ADF37D, 0x50596938 */\n    4.05978572648472545552e+04, /* 0x40E3D2BB, 0x6EB6B05F */\n    1.16752972564375915681e+05, /* 0x40FC810F, 0x8F9FA9BD */\n    4.76277284146730962675e+04, /* 0x40E74177, 0x4F2C49DC */\n];\n\nconst PR5: [f64; 6] = [\n    /* for x in [8,4.5454]=1/[0.125,0.22001] */\n    -1.14125464691894502584e-11, /* 0xBDA918B1, 0x47E495CC */\n    -7.03124940873599280078e-02, /* 0xBFB1FFFF, 0xE69AFBC6 */\n    -4.15961064470587782438e+00, /* 0xC010A370, 0xF90C6BBF */\n    -6.76747652265167261021e+01, /* 0xC050EB2F, 0x5A7D1783 */\n    -3.31231299649172967747e+02, /* 0xC074B3B3, 0x6742CC63 */\n    -3.46433388365604912451e+02, /* 0xC075A6EF, 0x28A38BD7 */\n];\nconst PS5: [f64; 5] = [\n    6.07539382692300335975e+01, /* 0x404E6081, 0x0C98C5DE */\n    1.05125230595704579173e+03, /* 0x40906D02, 0x5C7E2864 */\n    5.97897094333855784498e+03, /* 0x40B75AF8, 0x8FBE1D60 */\n    9.62544514357774460223e+03, /* 0x40C2CCB8, 0xFA76FA38 */\n    2.40605815922939109441e+03, /* 0x40A2CC1D, 0xC70BE864 */\n];\n\nconst PR3: [f64; 6] = [\n    /* for x in [4.547,2.8571]=1/[0.2199,0.35001] */\n    -2.54704601771951915620e-09, /* 0xBE25E103, 0x6FE1AA86 */\n    -7.03119616381481654654e-02, /* 0xBFB1FFF6, 0xF7C0E24B */\n    -2.40903221549529611423e+00, /* 0xC00345B2, 0xAEA48074 */\n    -2.19659774734883086467e+01, /* 0xC035F74A, 0x4CB94E14 */\n    -5.80791704701737572236e+01, /* 0xC04D0A22, 0x420A1A45 */\n    -3.14479470594888503854e+01, /* 0xC03F72AC, 0xA892D80F */\n];\nconst PS3: [f64; 5] = [\n    3.58560338055209726349e+01, /* 0x4041ED92, 0x84077DD3 */\n    3.61513983050303863820e+02, /* 0x40769839, 0x464A7C0E */\n    1.19360783792111533330e+03, /* 0x4092A66E, 0x6D1061D6 */\n    1.12799679856907414432e+03, /* 0x40919FFC, 0xB8C39B7E */\n    1.73580930813335754692e+02, /* 0x4065B296, 0xFC379081 */\n];\n\nconst PR2: [f64; 6] = [\n    /* for x in [2.8570,2]=1/[0.3499,0.5] */\n    -8.87534333032526411254e-08, /* 0xBE77D316, 0xE927026D */\n    -7.03030995483624743247e-02, /* 0xBFB1FF62, 0x495E1E42 */\n    -1.45073846780952986357e+00, /* 0xBFF73639, 0x8A24A843 */\n    -7.63569613823527770791e+00, /* 0xC01E8AF3, 0xEDAFA7F3 */\n    -1.11931668860356747786e+01, /* 0xC02662E6, 0xC5246303 */\n    -3.23364579351335335033e+00, /* 0xC009DE81, 0xAF8FE70F */\n];\nconst PS2: [f64; 5] = [\n    2.22202997532088808441e+01, /* 0x40363865, 0x908B5959 */\n    1.36206794218215208048e+02, /* 0x4061069E, 0x0EE8878F */\n    2.70470278658083486789e+02, /* 0x4070E786, 0x42EA079B */\n    1.53875394208320329881e+02, /* 0x40633C03, 0x3AB6FAFF */\n    1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */\n];\n\nfn pzero(x: f64) -> f64 {\n    let p: &[f64; 6];\n    let q: &[f64; 5];\n    let z: f64;\n    let r: f64;\n    let s: f64;\n    let mut ix: u32;\n\n    ix = get_high_word(x);\n    ix &= 0x7fffffff;\n    if ix >= 0x40200000 {\n        p = &PR8;\n        q = &PS8;\n    } else if ix >= 0x40122E8B {\n        p = &PR5;\n        q = &PS5;\n    } else if ix >= 0x4006DB6D {\n        p = &PR3;\n        q = &PS3;\n    } else\n    /*ix >= 0x40000000*/\n    {\n        p = &PR2;\n        q = &PS2;\n    }\n    z = 1.0 / (x * x);\n    r = p[0] + z * (p[1] + z * (p[2] + z * (p[3] + z * (p[4] + z * p[5]))));\n    s = 1.0 + z * (q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * q[4]))));\n    return 1.0 + r / s;\n}\n\n/* For x >= 8, the asymptotic expansions of qzero is\n *      -1/8 s + 75/1024 s^3 - ..., where s = 1/x.\n * We approximate pzero by\n *      qzero(x) = s*(-1.25 + (R/S))\n * where  R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10\n *        S = 1 + qS0*s^2 + ... + qS5*s^12\n * and\n *      | qzero(x)/s +1.25-R/S | <= 2  ** ( -61.22)\n */\nconst QR8: [f64; 6] = [\n    /* for x in [inf, 8]=1/[0,0.125] */\n    0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */\n    7.32421874999935051953e-02, /* 0x3FB2BFFF, 0xFFFFFE2C */\n    1.17682064682252693899e+01, /* 0x40278952, 0x5BB334D6 */\n    5.57673380256401856059e+02, /* 0x40816D63, 0x15301825 */\n    8.85919720756468632317e+03, /* 0x40C14D99, 0x3E18F46D */\n    3.70146267776887834771e+04, /* 0x40E212D4, 0x0E901566 */\n];\nconst QS8: [f64; 6] = [\n    1.63776026895689824414e+02,  /* 0x406478D5, 0x365B39BC */\n    8.09834494656449805916e+03,  /* 0x40BFA258, 0x4E6B0563 */\n    1.42538291419120476348e+05,  /* 0x41016652, 0x54D38C3F */\n    8.03309257119514397345e+05,  /* 0x412883DA, 0x83A52B43 */\n    8.40501579819060512818e+05,  /* 0x4129A66B, 0x28DE0B3D */\n    -3.43899293537866615225e+05, /* 0xC114FD6D, 0x2C9530C5 */\n];\n\nconst QR5: [f64; 6] = [\n    /* for x in [8,4.5454]=1/[0.125,0.22001] */\n    1.84085963594515531381e-11, /* 0x3DB43D8F, 0x29CC8CD9 */\n    7.32421766612684765896e-02, /* 0x3FB2BFFF, 0xD172B04C */\n    5.83563508962056953777e+00, /* 0x401757B0, 0xB9953DD3 */\n    1.35111577286449829671e+02, /* 0x4060E392, 0x0A8788E9 */\n    1.02724376596164097464e+03, /* 0x40900CF9, 0x9DC8C481 */\n    1.98997785864605384631e+03, /* 0x409F17E9, 0x53C6E3A6 */\n];\nconst QS5: [f64; 6] = [\n    8.27766102236537761883e+01,  /* 0x4054B1B3, 0xFB5E1543 */\n    2.07781416421392987104e+03,  /* 0x40A03BA0, 0xDA21C0CE */\n    1.88472887785718085070e+04,  /* 0x40D267D2, 0x7B591E6D */\n    5.67511122894947329769e+04,  /* 0x40EBB5E3, 0x97E02372 */\n    3.59767538425114471465e+04,  /* 0x40E19118, 0x1F7A54A0 */\n    -5.35434275601944773371e+03, /* 0xC0B4EA57, 0xBEDBC609 */\n];\n\nconst QR3: [f64; 6] = [\n    /* for x in [4.547,2.8571]=1/[0.2199,0.35001] */\n    4.37741014089738620906e-09, /* 0x3E32CD03, 0x6ADECB82 */\n    7.32411180042911447163e-02, /* 0x3FB2BFEE, 0x0E8D0842 */\n    3.34423137516170720929e+00, /* 0x400AC0FC, 0x61149CF5 */\n    4.26218440745412650017e+01, /* 0x40454F98, 0x962DAEDD */\n    1.70808091340565596283e+02, /* 0x406559DB, 0xE25EFD1F */\n    1.66733948696651168575e+02, /* 0x4064D77C, 0x81FA21E0 */\n];\nconst QS3: [f64; 6] = [\n    4.87588729724587182091e+01,  /* 0x40486122, 0xBFE343A6 */\n    7.09689221056606015736e+02,  /* 0x40862D83, 0x86544EB3 */\n    3.70414822620111362994e+03,  /* 0x40ACF04B, 0xE44DFC63 */\n    6.46042516752568917582e+03,  /* 0x40B93C6C, 0xD7C76A28 */\n    2.51633368920368957333e+03,  /* 0x40A3A8AA, 0xD94FB1C0 */\n    -1.49247451836156386662e+02, /* 0xC062A7EB, 0x201CF40F */\n];\n\nconst QR2: [f64; 6] = [\n    /* for x in [2.8570,2]=1/[0.3499,0.5] */\n    1.50444444886983272379e-07, /* 0x3E84313B, 0x54F76BDB */\n    7.32234265963079278272e-02, /* 0x3FB2BEC5, 0x3E883E34 */\n    1.99819174093815998816e+00, /* 0x3FFFF897, 0xE727779C */\n    1.44956029347885735348e+01, /* 0x402CFDBF, 0xAAF96FE5 */\n    3.16662317504781540833e+01, /* 0x403FAA8E, 0x29FBDC4A */\n    1.62527075710929267416e+01, /* 0x403040B1, 0x71814BB4 */\n];\nconst QS2: [f64; 6] = [\n    3.03655848355219184498e+01,  /* 0x403E5D96, 0xF7C07AED */\n    2.69348118608049844624e+02,  /* 0x4070D591, 0xE4D14B40 */\n    8.44783757595320139444e+02,  /* 0x408A6645, 0x22B3BF22 */\n    8.82935845112488550512e+02,  /* 0x408B977C, 0x9C5CC214 */\n    2.12666388511798828631e+02,  /* 0x406A9553, 0x0E001365 */\n    -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */\n];\n\nfn qzero(x: f64) -> f64 {\n    let p: &[f64; 6];\n    let q: &[f64; 6];\n    let s: f64;\n    let r: f64;\n    let z: f64;\n    let mut ix: u32;\n\n    ix = get_high_word(x);\n    ix &= 0x7fffffff;\n    if ix >= 0x40200000 {\n        p = &QR8;\n        q = &QS8;\n    } else if ix >= 0x40122E8B {\n        p = &QR5;\n        q = &QS5;\n    } else if ix >= 0x4006DB6D {\n        p = &QR3;\n        q = &QS3;\n    } else\n    /*ix >= 0x40000000*/\n    {\n        p = &QR2;\n        q = &QS2;\n    }\n    z = 1.0 / (x * x);\n    r = p[0] + z * (p[1] + z * (p[2] + z * (p[3] + z * (p[4] + z * p[5]))));\n    s = 1.0 + z * (q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * (q[4] + z * q[5])))));\n    return (-0.125 + r / s) / x;\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/j0f.rs",
    "sha256": "ec8defa257365fc5fd4100f21e7ca3fed76d053b2e8b80a71ddc23a62ee36168",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_j0f.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{cosf, fabsf, logf, sinf, sqrtf};\n\nconst INVSQRTPI: f32 = 5.6418961287e-01; /* 0x3f106ebb */\nconst TPI: f32 = 6.3661974669e-01; /* 0x3f22f983 */\n\nfn common(ix: u32, x: f32, y0: bool) -> f32 {\n    let z: f32;\n    let s: f32;\n    let mut c: f32;\n    let mut ss: f32;\n    let mut cc: f32;\n    /*\n     * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x)\n     * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x)\n     */\n    s = sinf(x);\n    c = cosf(x);\n    if y0 {\n        c = -c;\n    }\n    cc = s + c;\n    if ix < 0x7f000000 {\n        ss = s - c;\n        z = -cosf(2.0 * x);\n        if s * c < 0.0 {\n            cc = z / ss;\n        } else {\n            ss = z / cc;\n        }\n        if ix < 0x58800000 {\n            if y0 {\n                ss = -ss;\n            }\n            cc = pzerof(x) * cc - qzerof(x) * ss;\n        }\n    }\n    return INVSQRTPI * cc / sqrtf(x);\n}\n\n/* R0/S0 on [0, 2.00] */\nconst R02: f32 = 1.5625000000e-02; /* 0x3c800000 */\nconst R03: f32 = -1.8997929874e-04; /* 0xb947352e */\nconst R04: f32 = 1.8295404516e-06; /* 0x35f58e88 */\nconst R05: f32 = -4.6183270541e-09; /* 0xb19eaf3c */\nconst S01: f32 = 1.5619102865e-02; /* 0x3c7fe744 */\nconst S02: f32 = 1.1692678527e-04; /* 0x38f53697 */\nconst S03: f32 = 5.1354652442e-07; /* 0x3509daa6 */\nconst S04: f32 = 1.1661400734e-09; /* 0x30a045e8 */\n\n/// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn j0f(mut x: f32) -> f32 {\n    let z: f32;\n    let r: f32;\n    let s: f32;\n    let mut ix: u32;\n\n    ix = x.to_bits();\n    ix &= 0x7fffffff;\n    if ix >= 0x7f800000 {\n        return 1.0 / (x * x);\n    }\n    x = fabsf(x);\n\n    if ix >= 0x40000000 {\n        /* |x| >= 2 */\n        /* large ulp error near zeros */\n        return common(ix, x, false);\n    }\n    if ix >= 0x3a000000 {\n        /* |x| >= 2**-11 */\n        /* up to 4ulp error near 2 */\n        z = x * x;\n        r = z * (R02 + z * (R03 + z * (R04 + z * R05)));\n        s = 1.0 + z * (S01 + z * (S02 + z * (S03 + z * S04)));\n        return (1.0 + x / 2.0) * (1.0 - x / 2.0) + z * (r / s);\n    }\n    if ix >= 0x21800000 {\n        /* |x| >= 2**-60 */\n        x = 0.25 * x * x;\n    }\n    return 1.0 - x;\n}\n\nconst U00: f32 = -7.3804296553e-02; /* 0xbd9726b5 */\nconst U01: f32 = 1.7666645348e-01; /* 0x3e34e80d */\nconst U02: f32 = -1.3818567619e-02; /* 0xbc626746 */\nconst U03: f32 = 3.4745343146e-04; /* 0x39b62a69 */\nconst U04: f32 = -3.8140706238e-06; /* 0xb67ff53c */\nconst U05: f32 = 1.9559013964e-08; /* 0x32a802ba */\nconst U06: f32 = -3.9820518410e-11; /* 0xae2f21eb */\nconst V01: f32 = 1.2730483897e-02; /* 0x3c509385 */\nconst V02: f32 = 7.6006865129e-05; /* 0x389f65e0 */\nconst V03: f32 = 2.5915085189e-07; /* 0x348b216c */\nconst V04: f32 = 4.4111031494e-10; /* 0x2ff280c2 */\n\n/// Zeroth order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn y0f(x: f32) -> f32 {\n    let z: f32;\n    let u: f32;\n    let v: f32;\n    let ix: u32;\n\n    ix = x.to_bits();\n    if (ix & 0x7fffffff) == 0 {\n        return -1.0 / 0.0;\n    }\n    if (ix >> 31) != 0 {\n        return 0.0 / 0.0;\n    }\n    if ix >= 0x7f800000 {\n        return 1.0 / x;\n    }\n    if ix >= 0x40000000 {\n        /* |x| >= 2.0 */\n        /* large ulp error near zeros */\n        return common(ix, x, true);\n    }\n    if ix >= 0x39000000 {\n        /* x >= 2**-13 */\n        /* large ulp error at x ~= 0.89 */\n        z = x * x;\n        u = U00 + z * (U01 + z * (U02 + z * (U03 + z * (U04 + z * (U05 + z * U06)))));\n        v = 1.0 + z * (V01 + z * (V02 + z * (V03 + z * V04)));\n        return u / v + TPI * (j0f(x) * logf(x));\n    }\n    return U00 + TPI * logf(x);\n}\n\n/* The asymptotic expansions of pzero is\n *      1 - 9/128 s^2 + 11025/98304 s^4 - ...,  where s = 1/x.\n * For x >= 2, We approximate pzero by\n *      pzero(x) = 1 + (R/S)\n * where  R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10\n *        S = 1 + pS0*s^2 + ... + pS4*s^10\n * and\n *      | pzero(x)-1-R/S | <= 2  ** ( -60.26)\n */\nconst PR8: [f32; 6] = [\n    /* for x in [inf, 8]=1/[0,0.125] */\n    0.0000000000e+00,  /* 0x00000000 */\n    -7.0312500000e-02, /* 0xbd900000 */\n    -8.0816707611e+00, /* 0xc1014e86 */\n    -2.5706311035e+02, /* 0xc3808814 */\n    -2.4852163086e+03, /* 0xc51b5376 */\n    -5.2530439453e+03, /* 0xc5a4285a */\n];\nconst PS8: [f32; 5] = [\n    1.1653436279e+02, /* 0x42e91198 */\n    3.8337448730e+03, /* 0x456f9beb */\n    4.0597855469e+04, /* 0x471e95db */\n    1.1675296875e+05, /* 0x47e4087c */\n    4.7627726562e+04, /* 0x473a0bba */\n];\nconst PR5: [f32; 6] = [\n    /* for x in [8,4.5454]=1/[0.125,0.22001] */\n    -1.1412546255e-11, /* 0xad48c58a */\n    -7.0312492549e-02, /* 0xbd8fffff */\n    -4.1596107483e+00, /* 0xc0851b88 */\n    -6.7674766541e+01, /* 0xc287597b */\n    -3.3123129272e+02, /* 0xc3a59d9b */\n    -3.4643338013e+02, /* 0xc3ad3779 */\n];\nconst PS5: [f32; 5] = [\n    6.0753936768e+01, /* 0x42730408 */\n    1.0512523193e+03, /* 0x44836813 */\n    5.9789707031e+03, /* 0x45bad7c4 */\n    9.6254453125e+03, /* 0x461665c8 */\n    2.4060581055e+03, /* 0x451660ee */\n];\n\nconst PR3: [f32; 6] = [\n    /* for x in [4.547,2.8571]=1/[0.2199,0.35001] */\n    -2.5470459075e-09, /* 0xb12f081b */\n    -7.0311963558e-02, /* 0xbd8fffb8 */\n    -2.4090321064e+00, /* 0xc01a2d95 */\n    -2.1965976715e+01, /* 0xc1afba52 */\n    -5.8079170227e+01, /* 0xc2685112 */\n    -3.1447946548e+01, /* 0xc1fb9565 */\n];\nconst PS3: [f32; 5] = [\n    3.5856033325e+01, /* 0x420f6c94 */\n    3.6151397705e+02, /* 0x43b4c1ca */\n    1.1936077881e+03, /* 0x44953373 */\n    1.1279968262e+03, /* 0x448cffe6 */\n    1.7358093262e+02, /* 0x432d94b8 */\n];\n\nconst PR2: [f32; 6] = [\n    /* for x in [2.8570,2]=1/[0.3499,0.5] */\n    -8.8753431271e-08, /* 0xb3be98b7 */\n    -7.0303097367e-02, /* 0xbd8ffb12 */\n    -1.4507384300e+00, /* 0xbfb9b1cc */\n    -7.6356959343e+00, /* 0xc0f4579f */\n    -1.1193166733e+01, /* 0xc1331736 */\n    -3.2336456776e+00, /* 0xc04ef40d */\n];\nconst PS2: [f32; 5] = [\n    2.2220300674e+01, /* 0x41b1c32d */\n    1.3620678711e+02, /* 0x430834f0 */\n    2.7047027588e+02, /* 0x43873c32 */\n    1.5387539673e+02, /* 0x4319e01a */\n    1.4657617569e+01, /* 0x416a859a */\n];\n\nfn pzerof(x: f32) -> f32 {\n    let p: &[f32; 6];\n    let q: &[f32; 5];\n    let z: f32;\n    let r: f32;\n    let s: f32;\n    let mut ix: u32;\n\n    ix = x.to_bits();\n    ix &= 0x7fffffff;\n    if ix >= 0x41000000 {\n        p = &PR8;\n        q = &PS8;\n    } else if ix >= 0x409173eb {\n        p = &PR5;\n        q = &PS5;\n    } else if ix >= 0x4036d917 {\n        p = &PR3;\n        q = &PS3;\n    } else\n    /*ix >= 0x40000000*/\n    {\n        p = &PR2;\n        q = &PS2;\n    }\n    z = 1.0 / (x * x);\n    r = p[0] + z * (p[1] + z * (p[2] + z * (p[3] + z * (p[4] + z * p[5]))));\n    s = 1.0 + z * (q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * q[4]))));\n    return 1.0 + r / s;\n}\n\n/* For x >= 8, the asymptotic expansions of qzero is\n *      -1/8 s + 75/1024 s^3 - ..., where s = 1/x.\n * We approximate pzero by\n *      qzero(x) = s*(-1.25 + (R/S))\n * where  R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10\n *        S = 1 + qS0*s^2 + ... + qS5*s^12\n * and\n *      | qzero(x)/s +1.25-R/S | <= 2  ** ( -61.22)\n */\nconst QR8: [f32; 6] = [\n    /* for x in [inf, 8]=1/[0,0.125] */\n    0.0000000000e+00, /* 0x00000000 */\n    7.3242187500e-02, /* 0x3d960000 */\n    1.1768206596e+01, /* 0x413c4a93 */\n    5.5767340088e+02, /* 0x440b6b19 */\n    8.8591972656e+03, /* 0x460a6cca */\n    3.7014625000e+04, /* 0x471096a0 */\n];\nconst QS8: [f32; 6] = [\n    1.6377603149e+02,  /* 0x4323c6aa */\n    8.0983447266e+03,  /* 0x45fd12c2 */\n    1.4253829688e+05,  /* 0x480b3293 */\n    8.0330925000e+05,  /* 0x49441ed4 */\n    8.4050156250e+05,  /* 0x494d3359 */\n    -3.4389928125e+05, /* 0xc8a7eb69 */\n];\n\nconst QR5: [f32; 6] = [\n    /* for x in [8,4.5454]=1/[0.125,0.22001] */\n    1.8408595828e-11, /* 0x2da1ec79 */\n    7.3242180049e-02, /* 0x3d95ffff */\n    5.8356351852e+00, /* 0x40babd86 */\n    1.3511157227e+02, /* 0x43071c90 */\n    1.0272437744e+03, /* 0x448067cd */\n    1.9899779053e+03, /* 0x44f8bf4b */\n];\nconst QS5: [f32; 6] = [\n    8.2776611328e+01,  /* 0x42a58da0 */\n    2.0778142090e+03,  /* 0x4501dd07 */\n    1.8847289062e+04,  /* 0x46933e94 */\n    5.6751113281e+04,  /* 0x475daf1d */\n    3.5976753906e+04,  /* 0x470c88c1 */\n    -5.3543427734e+03, /* 0xc5a752be */\n];\n\nconst QR3: [f32; 6] = [\n    /* for x in [4.547,2.8571]=1/[0.2199,0.35001] */\n    4.3774099900e-09, /* 0x3196681b */\n    7.3241114616e-02, /* 0x3d95ff70 */\n    3.3442313671e+00, /* 0x405607e3 */\n    4.2621845245e+01, /* 0x422a7cc5 */\n    1.7080809021e+02, /* 0x432acedf */\n    1.6673394775e+02, /* 0x4326bbe4 */\n];\nconst QS3: [f32; 6] = [\n    4.8758872986e+01,  /* 0x42430916 */\n    7.0968920898e+02,  /* 0x44316c1c */\n    3.7041481934e+03,  /* 0x4567825f */\n    6.4604252930e+03,  /* 0x45c9e367 */\n    2.5163337402e+03,  /* 0x451d4557 */\n    -1.4924745178e+02, /* 0xc3153f59 */\n];\n\nconst QR2: [f32; 6] = [\n    /* for x in [2.8570,2]=1/[0.3499,0.5] */\n    1.5044444979e-07, /* 0x342189db */\n    7.3223426938e-02, /* 0x3d95f62a */\n    1.9981917143e+00, /* 0x3fffc4bf */\n    1.4495602608e+01, /* 0x4167edfd */\n    3.1666231155e+01, /* 0x41fd5471 */\n    1.6252708435e+01, /* 0x4182058c */\n];\nconst QS2: [f32; 6] = [\n    3.0365585327e+01,  /* 0x41f2ecb8 */\n    2.6934811401e+02,  /* 0x4386ac8f */\n    8.4478375244e+02,  /* 0x44533229 */\n    8.8293585205e+02,  /* 0x445cbbe5 */\n    2.1266638184e+02,  /* 0x4354aa98 */\n    -5.3109550476e+00, /* 0xc0a9f358 */\n];\n\nfn qzerof(x: f32) -> f32 {\n    let p: &[f32; 6];\n    let q: &[f32; 6];\n    let s: f32;\n    let r: f32;\n    let z: f32;\n    let mut ix: u32;\n\n    ix = x.to_bits();\n    ix &= 0x7fffffff;\n    if ix >= 0x41000000 {\n        p = &QR8;\n        q = &QS8;\n    } else if ix >= 0x409173eb {\n        p = &QR5;\n        q = &QS5;\n    } else if ix >= 0x4036d917 {\n        p = &QR3;\n        q = &QS3;\n    } else\n    /*ix >= 0x40000000*/\n    {\n        p = &QR2;\n        q = &QS2;\n    }\n    z = 1.0 / (x * x);\n    r = p[0] + z * (p[1] + z * (p[2] + z * (p[3] + z * (p[4] + z * p[5]))));\n    s = 1.0 + z * (q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * (q[4] + z * q[5])))));\n    return (-0.125 + r / s) / x;\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/j1.rs",
    "sha256": "875eff2cde76abbdb21455d2d926b0e2699ec8fd1eba4194f1196ea2f8911fd7",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_j1.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* j1(x), y1(x)\n * Bessel function of the first and second kinds of order zero.\n * Method -- j1(x):\n *      1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ...\n *      2. Reduce x to |x| since j1(x)=-j1(-x),  and\n *         for x in (0,2)\n *              j1(x) = x/2 + x*z*R0/S0,  where z = x*x;\n *         (precision:  |j1/x - 1/2 - R0/S0 |<2**-61.51 )\n *         for x in (2,inf)\n *              j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))\n *              y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))\n *         where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)\n *         as follow:\n *              cos(x1) =  cos(x)cos(3pi/4)+sin(x)sin(3pi/4)\n *                      =  1/sqrt(2) * (sin(x) - cos(x))\n *              sin(x1) =  sin(x)cos(3pi/4)-cos(x)sin(3pi/4)\n *                      = -1/sqrt(2) * (sin(x) + cos(x))\n *         (To avoid cancellation, use\n *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))\n *          to compute the worse one.)\n *\n *      3 Special cases\n *              j1(nan)= nan\n *              j1(0) = 0\n *              j1(inf) = 0\n *\n * Method -- y1(x):\n *      1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN\n *      2. For x<2.\n *         Since\n *              y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...)\n *         therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function.\n *         We use the following function to approximate y1,\n *              y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2\n *         where for x in [0,2] (abs err less than 2**-65.89)\n *              U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4\n *              V(z) = 1  + v0[0]*z + ... + v0[4]*z^5\n *         Note: For tiny x, 1/x dominate y1 and hence\n *              y1(tiny) = -2/pi/tiny, (choose tiny<2**-54)\n *      3. For x>=2.\n *              y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))\n *         where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)\n *         by method mentioned above.\n */\n\nuse super::{cos, fabs, get_high_word, get_low_word, log, sin, sqrt};\n\nconst INVSQRTPI: f64 = 5.64189583547756279280e-01; /* 0x3FE20DD7, 0x50429B6D */\nconst TPI: f64 = 6.36619772367581382433e-01; /* 0x3FE45F30, 0x6DC9C883 */\n\nfn common(ix: u32, x: f64, y1: bool, sign: bool) -> f64 {\n    let z: f64;\n    let mut s: f64;\n    let c: f64;\n    let mut ss: f64;\n    let mut cc: f64;\n\n    /*\n     * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x-3pi/4)-q1(x)*sin(x-3pi/4))\n     * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x-3pi/4)+q1(x)*cos(x-3pi/4))\n     *\n     * sin(x-3pi/4) = -(sin(x) + cos(x))/sqrt(2)\n     * cos(x-3pi/4) = (sin(x) - cos(x))/sqrt(2)\n     * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))\n     */\n    s = sin(x);\n    if y1 {\n        s = -s;\n    }\n    c = cos(x);\n    cc = s - c;\n    if ix < 0x7fe00000 {\n        /* avoid overflow in 2*x */\n        ss = -s - c;\n        z = cos(2.0 * x);\n        if s * c > 0.0 {\n            cc = z / ss;\n        } else {\n            ss = z / cc;\n        }\n        if ix < 0x48000000 {\n            if y1 {\n                ss = -ss;\n            }\n            cc = pone(x) * cc - qone(x) * ss;\n        }\n    }\n    if sign {\n        cc = -cc;\n    }\n    return INVSQRTPI * cc / sqrt(x);\n}\n\n/* R0/S0 on [0,2] */\nconst R00: f64 = -6.25000000000000000000e-02; /* 0xBFB00000, 0x00000000 */\nconst R01: f64 = 1.40705666955189706048e-03; /* 0x3F570D9F, 0x98472C61 */\nconst R02: f64 = -1.59955631084035597520e-05; /* 0xBEF0C5C6, 0xBA169668 */\nconst R03: f64 = 4.96727999609584448412e-08; /* 0x3E6AAAFA, 0x46CA0BD9 */\nconst S01: f64 = 1.91537599538363460805e-02; /* 0x3F939D0B, 0x12637E53 */\nconst S02: f64 = 1.85946785588630915560e-04; /* 0x3F285F56, 0xB9CDF664 */\nconst S03: f64 = 1.17718464042623683263e-06; /* 0x3EB3BFF8, 0x333F8498 */\nconst S04: f64 = 5.04636257076217042715e-09; /* 0x3E35AC88, 0xC97DFF2C */\nconst S05: f64 = 1.23542274426137913908e-11; /* 0x3DAB2ACF, 0xCFB97ED8 */\n\n/// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn j1(x: f64) -> f64 {\n    let mut z: f64;\n    let r: f64;\n    let s: f64;\n    let mut ix: u32;\n    let sign: bool;\n\n    ix = get_high_word(x);\n    sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n    if ix >= 0x7ff00000 {\n        return 1.0 / (x * x);\n    }\n    if ix >= 0x40000000 {\n        /* |x| >= 2 */\n        return common(ix, fabs(x), false, sign);\n    }\n    if ix >= 0x38000000 {\n        /* |x| >= 2**-127 */\n        z = x * x;\n        r = z * (R00 + z * (R01 + z * (R02 + z * R03)));\n        s = 1.0 + z * (S01 + z * (S02 + z * (S03 + z * (S04 + z * S05))));\n        z = r / s;\n    } else {\n        /* avoid underflow, raise inexact if x!=0 */\n        z = x;\n    }\n    return (0.5 + z) * x;\n}\n\nconst U0: [f64; 5] = [\n    -1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */\n    5.04438716639811282616e-02,  /* 0x3FA9D3C7, 0x76292CD1 */\n    -1.91256895875763547298e-03, /* 0xBF5F55E5, 0x4844F50F */\n    2.35252600561610495928e-05,  /* 0x3EF8AB03, 0x8FA6B88E */\n    -9.19099158039878874504e-08, /* 0xBE78AC00, 0x569105B8 */\n];\nconst V0: [f64; 5] = [\n    1.99167318236649903973e-02, /* 0x3F94650D, 0x3F4DA9F0 */\n    2.02552581025135171496e-04, /* 0x3F2A8C89, 0x6C257764 */\n    1.35608801097516229404e-06, /* 0x3EB6C05A, 0x894E8CA6 */\n    6.22741452364621501295e-09, /* 0x3E3ABF1D, 0x5BA69A86 */\n    1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */\n];\n\n/// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn y1(x: f64) -> f64 {\n    let z: f64;\n    let u: f64;\n    let v: f64;\n    let ix: u32;\n    let lx: u32;\n\n    ix = get_high_word(x);\n    lx = get_low_word(x);\n\n    /* y1(nan)=nan, y1(<0)=nan, y1(0)=-inf, y1(inf)=0 */\n    if (ix << 1) | lx == 0 {\n        return -1.0 / 0.0;\n    }\n    if ix >> 31 != 0 {\n        return 0.0 / 0.0;\n    }\n    if ix >= 0x7ff00000 {\n        return 1.0 / x;\n    }\n\n    if ix >= 0x40000000 {\n        /* x >= 2 */\n        return common(ix, x, true, false);\n    }\n    if ix < 0x3c900000 {\n        /* x < 2**-54 */\n        return -TPI / x;\n    }\n    z = x * x;\n    u = U0[0] + z * (U0[1] + z * (U0[2] + z * (U0[3] + z * U0[4])));\n    v = 1.0 + z * (V0[0] + z * (V0[1] + z * (V0[2] + z * (V0[3] + z * V0[4]))));\n    return x * (u / v) + TPI * (j1(x) * log(x) - 1.0 / x);\n}\n\n/* For x >= 8, the asymptotic expansions of pone is\n *      1 + 15/128 s^2 - 4725/2^15 s^4 - ...,   where s = 1/x.\n * We approximate pone by\n *      pone(x) = 1 + (R/S)\n * where  R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10\n *        S = 1 + ps0*s^2 + ... + ps4*s^10\n * and\n *      | pone(x)-1-R/S | <= 2  ** ( -60.06)\n */\n\nconst PR8: [f64; 6] = [\n    /* for x in [inf, 8]=1/[0,0.125] */\n    0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */\n    1.17187499999988647970e-01, /* 0x3FBDFFFF, 0xFFFFFCCE */\n    1.32394806593073575129e+01, /* 0x402A7A9D, 0x357F7FCE */\n    4.12051854307378562225e+02, /* 0x4079C0D4, 0x652EA590 */\n    3.87474538913960532227e+03, /* 0x40AE457D, 0xA3A532CC */\n    7.91447954031891731574e+03, /* 0x40BEEA7A, 0xC32782DD */\n];\nconst PS8: [f64; 5] = [\n    1.14207370375678408436e+02, /* 0x405C8D45, 0x8E656CAC */\n    3.65093083420853463394e+03, /* 0x40AC85DC, 0x964D274F */\n    3.69562060269033463555e+04, /* 0x40E20B86, 0x97C5BB7F */\n    9.76027935934950801311e+04, /* 0x40F7D42C, 0xB28F17BB */\n    3.08042720627888811578e+04, /* 0x40DE1511, 0x697A0B2D */\n];\n\nconst PR5: [f64; 6] = [\n    /* for x in [8,4.5454]=1/[0.125,0.22001] */\n    1.31990519556243522749e-11, /* 0x3DAD0667, 0xDAE1CA7D */\n    1.17187493190614097638e-01, /* 0x3FBDFFFF, 0xE2C10043 */\n    6.80275127868432871736e+00, /* 0x401B3604, 0x6E6315E3 */\n    1.08308182990189109773e+02, /* 0x405B13B9, 0x452602ED */\n    5.17636139533199752805e+02, /* 0x40802D16, 0xD052D649 */\n    5.28715201363337541807e+02, /* 0x408085B8, 0xBB7E0CB7 */\n];\nconst PS5: [f64; 5] = [\n    5.92805987221131331921e+01, /* 0x404DA3EA, 0xA8AF633D */\n    9.91401418733614377743e+02, /* 0x408EFB36, 0x1B066701 */\n    5.35326695291487976647e+03, /* 0x40B4E944, 0x5706B6FB */\n    7.84469031749551231769e+03, /* 0x40BEA4B0, 0xB8A5BB15 */\n    1.50404688810361062679e+03, /* 0x40978030, 0x036F5E51 */\n];\n\nconst PR3: [f64; 6] = [\n    3.02503916137373618024e-09, /* 0x3E29FC21, 0xA7AD9EDD */\n    1.17186865567253592491e-01, /* 0x3FBDFFF5, 0x5B21D17B */\n    3.93297750033315640650e+00, /* 0x400F76BC, 0xE85EAD8A */\n    3.51194035591636932736e+01, /* 0x40418F48, 0x9DA6D129 */\n    9.10550110750781271918e+01, /* 0x4056C385, 0x4D2C1837 */\n    4.85590685197364919645e+01, /* 0x4048478F, 0x8EA83EE5 */\n];\nconst PS3: [f64; 5] = [\n    3.47913095001251519989e+01, /* 0x40416549, 0xA134069C */\n    3.36762458747825746741e+02, /* 0x40750C33, 0x07F1A75F */\n    1.04687139975775130551e+03, /* 0x40905B7C, 0x5037D523 */\n    8.90811346398256432622e+02, /* 0x408BD67D, 0xA32E31E9 */\n    1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */\n];\n\nconst PR2: [f64; 6] = [\n    /* for x in [2.8570,2]=1/[0.3499,0.5] */\n    1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */\n    1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */\n    2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */\n    1.22426109148261232917e+01, /* 0x40287C37, 0x7F71A964 */\n    1.76939711271687727390e+01, /* 0x4031B1A8, 0x177F8EE2 */\n    5.07352312588818499250e+00, /* 0x40144B49, 0xA574C1FE */\n];\nconst PS2: [f64; 5] = [\n    2.14364859363821409488e+01, /* 0x40356FBD, 0x8AD5ECDC */\n    1.25290227168402751090e+02, /* 0x405F5293, 0x14F92CD5 */\n    2.32276469057162813669e+02, /* 0x406D08D8, 0xD5A2DBD9 */\n    1.17679373287147100768e+02, /* 0x405D6B7A, 0xDA1884A9 */\n    8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */\n];\n\nfn pone(x: f64) -> f64 {\n    let p: &[f64; 6];\n    let q: &[f64; 5];\n    let z: f64;\n    let r: f64;\n    let s: f64;\n    let mut ix: u32;\n\n    ix = get_high_word(x);\n    ix &= 0x7fffffff;\n    if ix >= 0x40200000 {\n        p = &PR8;\n        q = &PS8;\n    } else if ix >= 0x40122E8B {\n        p = &PR5;\n        q = &PS5;\n    } else if ix >= 0x4006DB6D {\n        p = &PR3;\n        q = &PS3;\n    } else\n    /*ix >= 0x40000000*/\n    {\n        p = &PR2;\n        q = &PS2;\n    }\n    z = 1.0 / (x * x);\n    r = p[0] + z * (p[1] + z * (p[2] + z * (p[3] + z * (p[4] + z * p[5]))));\n    s = 1.0 + z * (q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * q[4]))));\n    return 1.0 + r / s;\n}\n\n/* For x >= 8, the asymptotic expansions of qone is\n *      3/8 s - 105/1024 s^3 - ..., where s = 1/x.\n * We approximate pone by\n *      qone(x) = s*(0.375 + (R/S))\n * where  R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10\n *        S = 1 + qs1*s^2 + ... + qs6*s^12\n * and\n *      | qone(x)/s -0.375-R/S | <= 2  ** ( -61.13)\n */\n\nconst QR8: [f64; 6] = [\n    /* for x in [inf, 8]=1/[0,0.125] */\n    0.00000000000000000000e+00,  /* 0x00000000, 0x00000000 */\n    -1.02539062499992714161e-01, /* 0xBFBA3FFF, 0xFFFFFDF3 */\n    -1.62717534544589987888e+01, /* 0xC0304591, 0xA26779F7 */\n    -7.59601722513950107896e+02, /* 0xC087BCD0, 0x53E4B576 */\n    -1.18498066702429587167e+04, /* 0xC0C724E7, 0x40F87415 */\n    -4.84385124285750353010e+04, /* 0xC0E7A6D0, 0x65D09C6A */\n];\nconst QS8: [f64; 6] = [\n    1.61395369700722909556e+02,  /* 0x40642CA6, 0xDE5BCDE5 */\n    7.82538599923348465381e+03,  /* 0x40BE9162, 0xD0D88419 */\n    1.33875336287249578163e+05,  /* 0x4100579A, 0xB0B75E98 */\n    7.19657723683240939863e+05,  /* 0x4125F653, 0x72869C19 */\n    6.66601232617776375264e+05,  /* 0x412457D2, 0x7719AD5C */\n    -2.94490264303834643215e+05, /* 0xC111F969, 0x0EA5AA18 */\n];\n\nconst QR5: [f64; 6] = [\n    /* for x in [8,4.5454]=1/[0.125,0.22001] */\n    -2.08979931141764104297e-11, /* 0xBDB6FA43, 0x1AA1A098 */\n    -1.02539050241375426231e-01, /* 0xBFBA3FFF, 0xCB597FEF */\n    -8.05644828123936029840e+00, /* 0xC0201CE6, 0xCA03AD4B */\n    -1.83669607474888380239e+02, /* 0xC066F56D, 0x6CA7B9B0 */\n    -1.37319376065508163265e+03, /* 0xC09574C6, 0x6931734F */\n    -2.61244440453215656817e+03, /* 0xC0A468E3, 0x88FDA79D */\n];\nconst QS5: [f64; 6] = [\n    8.12765501384335777857e+01,  /* 0x405451B2, 0xFF5A11B2 */\n    1.99179873460485964642e+03,  /* 0x409F1F31, 0xE77BF839 */\n    1.74684851924908907677e+04,  /* 0x40D10F1F, 0x0D64CE29 */\n    4.98514270910352279316e+04,  /* 0x40E8576D, 0xAABAD197 */\n    2.79480751638918118260e+04,  /* 0x40DB4B04, 0xCF7C364B */\n    -4.71918354795128470869e+03, /* 0xC0B26F2E, 0xFCFFA004 */\n];\n\nconst QR3: [f64; 6] = [\n    -5.07831226461766561369e-09, /* 0xBE35CFA9, 0xD38FC84F */\n    -1.02537829820837089745e-01, /* 0xBFBA3FEB, 0x51AEED54 */\n    -4.61011581139473403113e+00, /* 0xC01270C2, 0x3302D9FF */\n    -5.78472216562783643212e+01, /* 0xC04CEC71, 0xC25D16DA */\n    -2.28244540737631695038e+02, /* 0xC06C87D3, 0x4718D55F */\n    -2.19210128478909325622e+02, /* 0xC06B66B9, 0x5F5C1BF6 */\n];\nconst QS3: [f64; 6] = [\n    4.76651550323729509273e+01,  /* 0x4047D523, 0xCCD367E4 */\n    6.73865112676699709482e+02,  /* 0x40850EEB, 0xC031EE3E */\n    3.38015286679526343505e+03,  /* 0x40AA684E, 0x448E7C9A */\n    5.54772909720722782367e+03,  /* 0x40B5ABBA, 0xA61D54A6 */\n    1.90311919338810798763e+03,  /* 0x409DBC7A, 0x0DD4DF4B */\n    -1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */\n];\n\nconst QR2: [f64; 6] = [\n    /* for x in [2.8570,2]=1/[0.3499,0.5] */\n    -1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */\n    -1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */\n    -2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */\n    -1.96636162643703720221e+01, /* 0xC033A9E2, 0xC168907F */\n    -4.23253133372830490089e+01, /* 0xC04529A3, 0xDE104AAA */\n    -2.13719211703704061733e+01, /* 0xC0355F36, 0x39CF6E52 */\n];\nconst QS2: [f64; 6] = [\n    2.95333629060523854548e+01,  /* 0x403D888A, 0x78AE64FF */\n    2.52981549982190529136e+02,  /* 0x406F9F68, 0xDB821CBA */\n    7.57502834868645436472e+02,  /* 0x4087AC05, 0xCE49A0F7 */\n    7.39393205320467245656e+02,  /* 0x40871B25, 0x48D4C029 */\n    1.55949003336666123687e+02,  /* 0x40637E5E, 0x3C3ED8D4 */\n    -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */\n];\n\nfn qone(x: f64) -> f64 {\n    let p: &[f64; 6];\n    let q: &[f64; 6];\n    let s: f64;\n    let r: f64;\n    let z: f64;\n    let mut ix: u32;\n\n    ix = get_high_word(x);\n    ix &= 0x7fffffff;\n    if ix >= 0x40200000 {\n        p = &QR8;\n        q = &QS8;\n    } else if ix >= 0x40122E8B {\n        p = &QR5;\n        q = &QS5;\n    } else if ix >= 0x4006DB6D {\n        p = &QR3;\n        q = &QS3;\n    } else\n    /*ix >= 0x40000000*/\n    {\n        p = &QR2;\n        q = &QS2;\n    }\n    z = 1.0 / (x * x);\n    r = p[0] + z * (p[1] + z * (p[2] + z * (p[3] + z * (p[4] + z * p[5]))));\n    s = 1.0 + z * (q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * (q[4] + z * q[5])))));\n    return (0.375 + r / s) / x;\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/j1f.rs",
    "sha256": "6d9c562e966fcc0a953ca93c83657fc8dc0892f0c56106132890371a8469b8f4",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_j1f.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{cosf, fabsf, logf, sinf, sqrtf};\n\nconst INVSQRTPI: f32 = 5.6418961287e-01; /* 0x3f106ebb */\nconst TPI: f32 = 6.3661974669e-01; /* 0x3f22f983 */\n\nfn common(ix: u32, x: f32, y1: bool, sign: bool) -> f32 {\n    let z: f64;\n    let mut s: f64;\n    let c: f64;\n    let mut ss: f64;\n    let mut cc: f64;\n\n    s = sinf(x) as f64;\n    if y1 {\n        s = -s;\n    }\n    c = cosf(x) as f64;\n    cc = s - c;\n    if ix < 0x7f000000 {\n        ss = -s - c;\n        z = cosf(2.0 * x) as f64;\n        if s * c > 0.0 {\n            cc = z / ss;\n        } else {\n            ss = z / cc;\n        }\n        if ix < 0x58800000 {\n            if y1 {\n                ss = -ss;\n            }\n            cc = (ponef(x) as f64) * cc - (qonef(x) as f64) * ss;\n        }\n    }\n    if sign {\n        cc = -cc;\n    }\n    return (((INVSQRTPI as f64) * cc) / (sqrtf(x) as f64)) as f32;\n}\n\n/* R0/S0 on [0,2] */\nconst R00: f32 = -6.2500000000e-02; /* 0xbd800000 */\nconst R01: f32 = 1.4070566976e-03; /* 0x3ab86cfd */\nconst R02: f32 = -1.5995563444e-05; /* 0xb7862e36 */\nconst R03: f32 = 4.9672799207e-08; /* 0x335557d2 */\nconst S01: f32 = 1.9153760746e-02; /* 0x3c9ce859 */\nconst S02: f32 = 1.8594678841e-04; /* 0x3942fab6 */\nconst S03: f32 = 1.1771846857e-06; /* 0x359dffc2 */\nconst S04: f32 = 5.0463624390e-09; /* 0x31ad6446 */\nconst S05: f32 = 1.2354227016e-11; /* 0x2d59567e */\n\n/// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn j1f(x: f32) -> f32 {\n    let mut z: f32;\n    let r: f32;\n    let s: f32;\n    let mut ix: u32;\n    let sign: bool;\n\n    ix = x.to_bits();\n    sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n    if ix >= 0x7f800000 {\n        return 1.0 / (x * x);\n    }\n    if ix >= 0x40000000 {\n        /* |x| >= 2 */\n        return common(ix, fabsf(x), false, sign);\n    }\n    if ix >= 0x39000000 {\n        /* |x| >= 2**-13 */\n        z = x * x;\n        r = z * (R00 + z * (R01 + z * (R02 + z * R03)));\n        s = 1.0 + z * (S01 + z * (S02 + z * (S03 + z * (S04 + z * S05))));\n        z = 0.5 + r / s;\n    } else {\n        z = 0.5;\n    }\n    return z * x;\n}\n\nconst U0: [f32; 5] = [\n    -1.9605709612e-01, /* 0xbe48c331 */\n    5.0443872809e-02,  /* 0x3d4e9e3c */\n    -1.9125689287e-03, /* 0xbafaaf2a */\n    2.3525259166e-05,  /* 0x37c5581c */\n    -9.1909917899e-08, /* 0xb3c56003 */\n];\nconst V0: [f32; 5] = [\n    1.9916731864e-02, /* 0x3ca3286a */\n    2.0255257550e-04, /* 0x3954644b */\n    1.3560879779e-06, /* 0x35b602d4 */\n    6.2274145840e-09, /* 0x31d5f8eb */\n    1.6655924903e-11, /* 0x2d9281cf */\n];\n\n/// First order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn y1f(x: f32) -> f32 {\n    let z: f32;\n    let u: f32;\n    let v: f32;\n    let ix: u32;\n\n    ix = x.to_bits();\n    if (ix & 0x7fffffff) == 0 {\n        return -1.0 / 0.0;\n    }\n    if (ix >> 31) != 0 {\n        return 0.0 / 0.0;\n    }\n    if ix >= 0x7f800000 {\n        return 1.0 / x;\n    }\n    if ix >= 0x40000000 {\n        /* |x| >= 2.0 */\n        return common(ix, x, true, false);\n    }\n    if ix < 0x33000000 {\n        /* x < 2**-25 */\n        return -TPI / x;\n    }\n    z = x * x;\n    u = U0[0] + z * (U0[1] + z * (U0[2] + z * (U0[3] + z * U0[4])));\n    v = 1.0 + z * (V0[0] + z * (V0[1] + z * (V0[2] + z * (V0[3] + z * V0[4]))));\n    return x * (u / v) + TPI * (j1f(x) * logf(x) - 1.0 / x);\n}\n\n/* For x >= 8, the asymptotic expansions of pone is\n *      1 + 15/128 s^2 - 4725/2^15 s^4 - ...,   where s = 1/x.\n * We approximate pone by\n *      pone(x) = 1 + (R/S)\n * where  R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10\n *        S = 1 + ps0*s^2 + ... + ps4*s^10\n * and\n *      | pone(x)-1-R/S | <= 2  ** ( -60.06)\n */\n\nconst PR8: [f32; 6] = [\n    /* for x in [inf, 8]=1/[0,0.125] */\n    0.0000000000e+00, /* 0x00000000 */\n    1.1718750000e-01, /* 0x3df00000 */\n    1.3239480972e+01, /* 0x4153d4ea */\n    4.1205184937e+02, /* 0x43ce06a3 */\n    3.8747453613e+03, /* 0x45722bed */\n    7.9144794922e+03, /* 0x45f753d6 */\n];\nconst PS8: [f32; 5] = [\n    1.1420736694e+02, /* 0x42e46a2c */\n    3.6509309082e+03, /* 0x45642ee5 */\n    3.6956207031e+04, /* 0x47105c35 */\n    9.7602796875e+04, /* 0x47bea166 */\n    3.0804271484e+04, /* 0x46f0a88b */\n];\n\nconst PR5: [f32; 6] = [\n    /* for x in [8,4.5454]=1/[0.125,0.22001] */\n    1.3199052094e-11, /* 0x2d68333f */\n    1.1718749255e-01, /* 0x3defffff */\n    6.8027510643e+00, /* 0x40d9b023 */\n    1.0830818176e+02, /* 0x42d89dca */\n    5.1763616943e+02, /* 0x440168b7 */\n    5.2871520996e+02, /* 0x44042dc6 */\n];\nconst PS5: [f32; 5] = [\n    5.9280597687e+01, /* 0x426d1f55 */\n    9.9140142822e+02, /* 0x4477d9b1 */\n    5.3532670898e+03, /* 0x45a74a23 */\n    7.8446904297e+03, /* 0x45f52586 */\n    1.5040468750e+03, /* 0x44bc0180 */\n];\n\nconst PR3: [f32; 6] = [\n    3.0250391081e-09, /* 0x314fe10d */\n    1.1718686670e-01, /* 0x3defffab */\n    3.9329774380e+00, /* 0x407bb5e7 */\n    3.5119403839e+01, /* 0x420c7a45 */\n    9.1055007935e+01, /* 0x42b61c2a */\n    4.8559066772e+01, /* 0x42423c7c */\n];\nconst PS3: [f32; 5] = [\n    3.4791309357e+01, /* 0x420b2a4d */\n    3.3676245117e+02, /* 0x43a86198 */\n    1.0468714600e+03, /* 0x4482dbe3 */\n    8.9081134033e+02, /* 0x445eb3ed */\n    1.0378793335e+02, /* 0x42cf936c */\n];\n\nconst PR2: [f32; 6] = [\n    /* for x in [2.8570,2]=1/[0.3499,0.5] */\n    1.0771083225e-07, /* 0x33e74ea8 */\n    1.1717621982e-01, /* 0x3deffa16 */\n    2.3685150146e+00, /* 0x401795c0 */\n    1.2242610931e+01, /* 0x4143e1bc */\n    1.7693971634e+01, /* 0x418d8d41 */\n    5.0735230446e+00, /* 0x40a25a4d */\n];\nconst PS2: [f32; 5] = [\n    2.1436485291e+01, /* 0x41ab7dec */\n    1.2529022980e+02, /* 0x42fa9499 */\n    2.3227647400e+02, /* 0x436846c7 */\n    1.1767937469e+02, /* 0x42eb5bd7 */\n    8.3646392822e+00, /* 0x4105d590 */\n];\n\nfn ponef(x: f32) -> f32 {\n    let p: &[f32; 6];\n    let q: &[f32; 5];\n    let z: f32;\n    let r: f32;\n    let s: f32;\n    let mut ix: u32;\n\n    ix = x.to_bits();\n    ix &= 0x7fffffff;\n    if ix >= 0x41000000 {\n        p = &PR8;\n        q = &PS8;\n    } else if ix >= 0x409173eb {\n        p = &PR5;\n        q = &PS5;\n    } else if ix >= 0x4036d917 {\n        p = &PR3;\n        q = &PS3;\n    } else\n    /*ix >= 0x40000000*/\n    {\n        p = &PR2;\n        q = &PS2;\n    }\n    z = 1.0 / (x * x);\n    r = p[0] + z * (p[1] + z * (p[2] + z * (p[3] + z * (p[4] + z * p[5]))));\n    s = 1.0 + z * (q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * q[4]))));\n    return 1.0 + r / s;\n}\n\n/* For x >= 8, the asymptotic expansions of qone is\n *      3/8 s - 105/1024 s^3 - ..., where s = 1/x.\n * We approximate pone by\n *      qone(x) = s*(0.375 + (R/S))\n * where  R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10\n *        S = 1 + qs1*s^2 + ... + qs6*s^12\n * and\n *      | qone(x)/s -0.375-R/S | <= 2  ** ( -61.13)\n */\n\nconst QR8: [f32; 6] = [\n    /* for x in [inf, 8]=1/[0,0.125] */\n    0.0000000000e+00,  /* 0x00000000 */\n    -1.0253906250e-01, /* 0xbdd20000 */\n    -1.6271753311e+01, /* 0xc1822c8d */\n    -7.5960174561e+02, /* 0xc43de683 */\n    -1.1849806641e+04, /* 0xc639273a */\n    -4.8438511719e+04, /* 0xc73d3683 */\n];\nconst QS8: [f32; 6] = [\n    1.6139537048e+02,  /* 0x43216537 */\n    7.8253862305e+03,  /* 0x45f48b17 */\n    1.3387534375e+05,  /* 0x4802bcd6 */\n    7.1965775000e+05,  /* 0x492fb29c */\n    6.6660125000e+05,  /* 0x4922be94 */\n    -2.9449025000e+05, /* 0xc88fcb48 */\n];\n\nconst QR5: [f32; 6] = [\n    /* for x in [8,4.5454]=1/[0.125,0.22001] */\n    -2.0897993405e-11, /* 0xadb7d219 */\n    -1.0253904760e-01, /* 0xbdd1fffe */\n    -8.0564479828e+00, /* 0xc100e736 */\n    -1.8366960144e+02, /* 0xc337ab6b */\n    -1.3731937256e+03, /* 0xc4aba633 */\n    -2.6124443359e+03, /* 0xc523471c */\n];\nconst QS5: [f32; 6] = [\n    8.1276550293e+01,  /* 0x42a28d98 */\n    1.9917987061e+03,  /* 0x44f8f98f */\n    1.7468484375e+04,  /* 0x468878f8 */\n    4.9851425781e+04,  /* 0x4742bb6d */\n    2.7948074219e+04,  /* 0x46da5826 */\n    -4.7191835938e+03, /* 0xc5937978 */\n];\n\nconst QR3: [f32; 6] = [\n    -5.0783124372e-09, /* 0xb1ae7d4f */\n    -1.0253783315e-01, /* 0xbdd1ff5b */\n    -4.6101160049e+00, /* 0xc0938612 */\n    -5.7847221375e+01, /* 0xc267638e */\n    -2.2824453735e+02, /* 0xc3643e9a */\n    -2.1921012878e+02, /* 0xc35b35cb */\n];\nconst QS3: [f32; 6] = [\n    4.7665153503e+01,  /* 0x423ea91e */\n    6.7386511230e+02,  /* 0x4428775e */\n    3.3801528320e+03,  /* 0x45534272 */\n    5.5477290039e+03,  /* 0x45ad5dd5 */\n    1.9031191406e+03,  /* 0x44ede3d0 */\n    -1.3520118713e+02, /* 0xc3073381 */\n];\n\nconst QR2: [f32; 6] = [\n    /* for x in [2.8570,2]=1/[0.3499,0.5] */\n    -1.7838172539e-07, /* 0xb43f8932 */\n    -1.0251704603e-01, /* 0xbdd1f475 */\n    -2.7522056103e+00, /* 0xc0302423 */\n    -1.9663616180e+01, /* 0xc19d4f16 */\n    -4.2325313568e+01, /* 0xc2294d1f */\n    -2.1371921539e+01, /* 0xc1aaf9b2 */\n];\nconst QS2: [f32; 6] = [\n    2.9533363342e+01,  /* 0x41ec4454 */\n    2.5298155212e+02,  /* 0x437cfb47 */\n    7.5750280762e+02,  /* 0x443d602e */\n    7.3939318848e+02,  /* 0x4438d92a */\n    1.5594900513e+02,  /* 0x431bf2f2 */\n    -4.9594988823e+00, /* 0xc09eb437 */\n];\n\nfn qonef(x: f32) -> f32 {\n    let p: &[f32; 6];\n    let q: &[f32; 6];\n    let s: f32;\n    let r: f32;\n    let z: f32;\n    let mut ix: u32;\n\n    ix = x.to_bits();\n    ix &= 0x7fffffff;\n    if ix >= 0x41000000 {\n        p = &QR8;\n        q = &QS8;\n    } else if ix >= 0x409173eb {\n        p = &QR5;\n        q = &QS5;\n    } else if ix >= 0x4036d917 {\n        p = &QR3;\n        q = &QS3;\n    } else\n    /*ix >= 0x40000000*/\n    {\n        p = &QR2;\n        q = &QS2;\n    }\n    z = 1.0 / (x * x);\n    r = p[0] + z * (p[1] + z * (p[2] + z * (p[3] + z * (p[4] + z * p[5]))));\n    s = 1.0 + z * (q[0] + z * (q[1] + z * (q[2] + z * (q[3] + z * (q[4] + z * q[5])))));\n    return (0.375 + r / s) / x;\n}\n\n// PowerPC tests are failing on LLVM 13: https://github.com/rust-lang/rust/issues/88520\n#[cfg(not(target_arch = \"powerpc64\"))]\n#[cfg(test)]\nmod tests {\n    use super::{j1f, y1f};\n    #[test]\n    fn test_j1f_2488() {\n        // 0x401F3E49\n        assert_eq!(j1f(2.4881766_f32), 0.49999475_f32);\n    }\n    #[test]\n    fn test_y1f_2002() {\n        //allow slightly different result on x87\n        let res = y1f(2.0000002_f32);\n        if cfg!(all(target_arch = \"x86\", not(target_feature = \"sse2\"))) && (res == -0.10703231_f32)\n        {\n            return;\n        }\n        assert_eq!(res, -0.10703229_f32);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/jn.rs",
    "sha256": "344c39e3d44b20fabc67c82ec1e6d9cafb3b215b1138878c513c020fc5189dd9",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_jn.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/*\n * jn(n, x), yn(n, x)\n * floating point Bessel's function of the 1st and 2nd kind\n * of order n\n *\n * Special cases:\n *      y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;\n *      y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.\n * Note 2. About jn(n,x), yn(n,x)\n *      For n=0, j0(x) is called,\n *      for n=1, j1(x) is called,\n *      for n<=x, forward recursion is used starting\n *      from values of j0(x) and j1(x).\n *      for n>x, a continued fraction approximation to\n *      j(n,x)/j(n-1,x) is evaluated and then backward\n *      recursion is used starting from a supposed value\n *      for j(n,x). The resulting value of j(0,x) is\n *      compared with the actual value to correct the\n *      supposed value of j(n,x).\n *\n *      yn(n,x) is similar in all respects, except\n *      that forward recursion is used for all\n *      values of n>1.\n */\n\nuse super::{cos, fabs, get_high_word, get_low_word, j0, j1, log, sin, sqrt, y0, y1};\n\nconst INVSQRTPI: f64 = 5.64189583547756279280e-01; /* 0x3FE20DD7, 0x50429B6D */\n\n/// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn jn(n: i32, mut x: f64) -> f64 {\n    let mut ix: u32;\n    let lx: u32;\n    let nm1: i32;\n    let mut i: i32;\n    let mut sign: bool;\n    let mut a: f64;\n    let mut b: f64;\n    let mut temp: f64;\n\n    ix = get_high_word(x);\n    lx = get_low_word(x);\n    sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n\n    // -lx == !lx + 1\n    if ix | ((lx | (!lx).wrapping_add(1)) >> 31) > 0x7ff00000 {\n        /* nan */\n        return x;\n    }\n\n    /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x)\n     * Thus, J(-n,x) = J(n,-x)\n     */\n    /* nm1 = |n|-1 is used instead of |n| to handle n==INT_MIN */\n    if n == 0 {\n        return j0(x);\n    }\n    if n < 0 {\n        nm1 = -(n + 1);\n        x = -x;\n        sign = !sign;\n    } else {\n        nm1 = n - 1;\n    }\n    if nm1 == 0 {\n        return j1(x);\n    }\n\n    sign &= (n & 1) != 0; /* even n: 0, odd n: signbit(x) */\n    x = fabs(x);\n    if (ix | lx) == 0 || ix == 0x7ff00000 {\n        /* if x is 0 or inf */\n        b = 0.0;\n    } else if (nm1 as f64) < x {\n        /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */\n        if ix >= 0x52d00000 {\n            /* x > 2**302 */\n            /* (x >> n**2)\n             *      Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)\n             *      Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)\n             *      Let s=sin(x), c=cos(x),\n             *          xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then\n             *\n             *             n    sin(xn)*sqt2    cos(xn)*sqt2\n             *          ----------------------------------\n             *             0     s-c             c+s\n             *             1    -s-c            -c+s\n             *             2    -s+c            -c-s\n             *             3     s+c             c-s\n             */\n            temp = match nm1 & 3 {\n                0 => -cos(x) + sin(x),\n                1 => -cos(x) - sin(x),\n                2 => cos(x) - sin(x),\n                // 3\n                _ => cos(x) + sin(x),\n            };\n            b = INVSQRTPI * temp / sqrt(x);\n        } else {\n            a = j0(x);\n            b = j1(x);\n            i = 0;\n            while i < nm1 {\n                i += 1;\n                temp = b;\n                b = b * (2.0 * (i as f64) / x) - a; /* avoid underflow */\n                a = temp;\n            }\n        }\n    } else if ix < 0x3e100000 {\n        /* x < 2**-29 */\n        /* x is tiny, return the first Taylor expansion of J(n,x)\n         * J(n,x) = 1/n!*(x/2)^n  - ...\n         */\n        if nm1 > 32 {\n            /* underflow */\n            b = 0.0;\n        } else {\n            temp = x * 0.5;\n            b = temp;\n            a = 1.0;\n            i = 2;\n            while i <= nm1 + 1 {\n                a *= i as f64; /* a = n! */\n                b *= temp; /* b = (x/2)^n */\n                i += 1;\n            }\n            b = b / a;\n        }\n    } else {\n        /* use backward recurrence */\n        /*                      x      x^2      x^2\n         *  J(n,x)/J(n-1,x) =  ----   ------   ------   .....\n         *                      2n  - 2(n+1) - 2(n+2)\n         *\n         *                      1      1        1\n         *  (for large x)   =  ----  ------   ------   .....\n         *                      2n   2(n+1)   2(n+2)\n         *                      -- - ------ - ------ -\n         *                       x     x         x\n         *\n         * Let w = 2n/x and h=2/x, then the above quotient\n         * is equal to the continued fraction:\n         *                  1\n         *      = -----------------------\n         *                     1\n         *         w - -----------------\n         *                        1\n         *              w+h - ---------\n         *                     w+2h - ...\n         *\n         * To determine how many terms needed, let\n         * Q(0) = w, Q(1) = w(w+h) - 1,\n         * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),\n         * When Q(k) > 1e4      good for single\n         * When Q(k) > 1e9      good for double\n         * When Q(k) > 1e17     good for quadruple\n         */\n        /* determine k */\n        let mut t: f64;\n        let mut q0: f64;\n        let mut q1: f64;\n        let mut w: f64;\n        let h: f64;\n        let mut z: f64;\n        let mut tmp: f64;\n        let nf: f64;\n\n        let mut k: i32;\n\n        nf = (nm1 as f64) + 1.0;\n        w = 2.0 * nf / x;\n        h = 2.0 / x;\n        z = w + h;\n        q0 = w;\n        q1 = w * z - 1.0;\n        k = 1;\n        while q1 < 1.0e9 {\n            k += 1;\n            z += h;\n            tmp = z * q1 - q0;\n            q0 = q1;\n            q1 = tmp;\n        }\n        t = 0.0;\n        i = k;\n        while i >= 0 {\n            t = 1.0 / (2.0 * ((i as f64) + nf) / x - t);\n            i -= 1;\n        }\n        a = t;\n        b = 1.0;\n        /*  estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)\n         *  Hence, if n*(log(2n/x)) > ...\n         *  single 8.8722839355e+01\n         *  double 7.09782712893383973096e+02\n         *  long double 1.1356523406294143949491931077970765006170e+04\n         *  then recurrent value may overflow and the result is\n         *  likely underflow to zero\n         */\n        tmp = nf * log(fabs(w));\n        if tmp < 7.09782712893383973096e+02 {\n            i = nm1;\n            while i > 0 {\n                temp = b;\n                b = b * (2.0 * (i as f64)) / x - a;\n                a = temp;\n                i -= 1;\n            }\n        } else {\n            i = nm1;\n            while i > 0 {\n                temp = b;\n                b = b * (2.0 * (i as f64)) / x - a;\n                a = temp;\n                /* scale b to avoid spurious overflow */\n                let x1p500 = f64::from_bits(0x5f30000000000000); // 0x1p500 == 2^500\n                if b > x1p500 {\n                    a /= b;\n                    t /= b;\n                    b = 1.0;\n                }\n                i -= 1;\n            }\n        }\n        z = j0(x);\n        w = j1(x);\n        if fabs(z) >= fabs(w) {\n            b = t * z / b;\n        } else {\n            b = t * w / a;\n        }\n    }\n\n    if sign { -b } else { b }\n}\n\n/// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn yn(n: i32, x: f64) -> f64 {\n    let mut ix: u32;\n    let lx: u32;\n    let mut ib: u32;\n    let nm1: i32;\n    let mut sign: bool;\n    let mut i: i32;\n    let mut a: f64;\n    let mut b: f64;\n    let mut temp: f64;\n\n    ix = get_high_word(x);\n    lx = get_low_word(x);\n    sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n\n    // -lx == !lx + 1\n    if ix | ((lx | (!lx).wrapping_add(1)) >> 31) > 0x7ff00000 {\n        /* nan */\n        return x;\n    }\n    if sign && (ix | lx) != 0 {\n        /* x < 0 */\n        return 0.0 / 0.0;\n    }\n    if ix == 0x7ff00000 {\n        return 0.0;\n    }\n\n    if n == 0 {\n        return y0(x);\n    }\n    if n < 0 {\n        nm1 = -(n + 1);\n        sign = (n & 1) != 0;\n    } else {\n        nm1 = n - 1;\n        sign = false;\n    }\n    if nm1 == 0 {\n        if sign {\n            return -y1(x);\n        } else {\n            return y1(x);\n        }\n    }\n\n    if ix >= 0x52d00000 {\n        /* x > 2**302 */\n        /* (x >> n**2)\n         *      Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi)\n         *      Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi)\n         *      Let s=sin(x), c=cos(x),\n         *          xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then\n         *\n         *             n    sin(xn)*sqt2    cos(xn)*sqt2\n         *          ----------------------------------\n         *             0     s-c             c+s\n         *             1    -s-c            -c+s\n         *             2    -s+c            -c-s\n         *             3     s+c             c-s\n         */\n        temp = match nm1 & 3 {\n            0 => -sin(x) - cos(x),\n            1 => -sin(x) + cos(x),\n            2 => sin(x) + cos(x),\n            // 3\n            _ => sin(x) - cos(x),\n        };\n        b = INVSQRTPI * temp / sqrt(x);\n    } else {\n        a = y0(x);\n        b = y1(x);\n        /* quit if b is -inf */\n        ib = get_high_word(b);\n        i = 0;\n        while i < nm1 && ib != 0xfff00000 {\n            i += 1;\n            temp = b;\n            b = (2.0 * (i as f64) / x) * b - a;\n            ib = get_high_word(b);\n            a = temp;\n        }\n    }\n\n    if sign { -b } else { b }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/jnf.rs",
    "sha256": "8a5684299af094154373b91477de17fe56e11e69d6fa1b3a717a2c4f0eab1f25",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_jnf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{fabsf, j0f, j1f, logf, y0f, y1f};\n\n/// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the first kind (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn jnf(n: i32, mut x: f32) -> f32 {\n    let mut ix: u32;\n    let mut nm1: i32;\n    let mut sign: bool;\n    let mut i: i32;\n    let mut a: f32;\n    let mut b: f32;\n    let mut temp: f32;\n\n    ix = x.to_bits();\n    sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n    if ix > 0x7f800000 {\n        /* nan */\n        return x;\n    }\n\n    /* J(-n,x) = J(n,-x), use |n|-1 to avoid overflow in -n */\n    if n == 0 {\n        return j0f(x);\n    }\n    if n < 0 {\n        nm1 = -(n + 1);\n        x = -x;\n        sign = !sign;\n    } else {\n        nm1 = n - 1;\n    }\n    if nm1 == 0 {\n        return j1f(x);\n    }\n\n    sign &= (n & 1) != 0; /* even n: 0, odd n: signbit(x) */\n    x = fabsf(x);\n    if ix == 0 || ix == 0x7f800000 {\n        /* if x is 0 or inf */\n        b = 0.0;\n    } else if (nm1 as f32) < x {\n        /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */\n        a = j0f(x);\n        b = j1f(x);\n        i = 0;\n        while i < nm1 {\n            i += 1;\n            temp = b;\n            b = b * (2.0 * (i as f32) / x) - a;\n            a = temp;\n        }\n    } else if ix < 0x35800000 {\n        /* x < 2**-20 */\n        /* x is tiny, return the first Taylor expansion of J(n,x)\n         * J(n,x) = 1/n!*(x/2)^n  - ...\n         */\n        if nm1 > 8 {\n            /* underflow */\n            nm1 = 8;\n        }\n        temp = 0.5 * x;\n        b = temp;\n        a = 1.0;\n        i = 2;\n        while i <= nm1 + 1 {\n            a *= i as f32; /* a = n! */\n            b *= temp; /* b = (x/2)^n */\n            i += 1;\n        }\n        b = b / a;\n    } else {\n        /* use backward recurrence */\n        /*                      x      x^2      x^2\n         *  J(n,x)/J(n-1,x) =  ----   ------   ------   .....\n         *                      2n  - 2(n+1) - 2(n+2)\n         *\n         *                      1      1        1\n         *  (for large x)   =  ----  ------   ------   .....\n         *                      2n   2(n+1)   2(n+2)\n         *                      -- - ------ - ------ -\n         *                       x     x         x\n         *\n         * Let w = 2n/x and h=2/x, then the above quotient\n         * is equal to the continued fraction:\n         *                  1\n         *      = -----------------------\n         *                     1\n         *         w - -----------------\n         *                        1\n         *              w+h - ---------\n         *                     w+2h - ...\n         *\n         * To determine how many terms needed, let\n         * Q(0) = w, Q(1) = w(w+h) - 1,\n         * Q(k) = (w+k*h)*Q(k-1) - Q(k-2),\n         * When Q(k) > 1e4      good for single\n         * When Q(k) > 1e9      good for double\n         * When Q(k) > 1e17     good for quadruple\n         */\n        /* determine k */\n        let mut t: f32;\n        let mut q0: f32;\n        let mut q1: f32;\n        let mut w: f32;\n        let h: f32;\n        let mut z: f32;\n        let mut tmp: f32;\n        let nf: f32;\n        let mut k: i32;\n\n        nf = (nm1 as f32) + 1.0;\n        w = 2.0 * nf / x;\n        h = 2.0 / x;\n        z = w + h;\n        q0 = w;\n        q1 = w * z - 1.0;\n        k = 1;\n        while q1 < 1.0e4 {\n            k += 1;\n            z += h;\n            tmp = z * q1 - q0;\n            q0 = q1;\n            q1 = tmp;\n        }\n        t = 0.0;\n        i = k;\n        while i >= 0 {\n            t = 1.0 / (2.0 * ((i as f32) + nf) / x - t);\n            i -= 1;\n        }\n        a = t;\n        b = 1.0;\n        /*  estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n)\n         *  Hence, if n*(log(2n/x)) > ...\n         *  single 8.8722839355e+01\n         *  double 7.09782712893383973096e+02\n         *  long double 1.1356523406294143949491931077970765006170e+04\n         *  then recurrent value may overflow and the result is\n         *  likely underflow to zero\n         */\n        tmp = nf * logf(fabsf(w));\n        if tmp < 88.721679688 {\n            i = nm1;\n            while i > 0 {\n                temp = b;\n                b = 2.0 * (i as f32) * b / x - a;\n                a = temp;\n                i -= 1;\n            }\n        } else {\n            i = nm1;\n            while i > 0 {\n                temp = b;\n                b = 2.0 * (i as f32) * b / x - a;\n                a = temp;\n                /* scale b to avoid spurious overflow */\n                let x1p60 = f32::from_bits(0x5d800000); // 0x1p60 == 2^60\n                if b > x1p60 {\n                    a /= b;\n                    t /= b;\n                    b = 1.0;\n                }\n                i -= 1;\n            }\n        }\n        z = j0f(x);\n        w = j1f(x);\n        if fabsf(z) >= fabsf(w) {\n            b = t * z / b;\n        } else {\n            b = t * w / a;\n        }\n    }\n\n    if sign { -b } else { b }\n}\n\n/// Integer order of the [Bessel function](https://en.wikipedia.org/wiki/Bessel_function) of the second kind (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn ynf(n: i32, x: f32) -> f32 {\n    let mut ix: u32;\n    let mut ib: u32;\n    let nm1: i32;\n    let mut sign: bool;\n    let mut i: i32;\n    let mut a: f32;\n    let mut b: f32;\n    let mut temp: f32;\n\n    ix = x.to_bits();\n    sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n    if ix > 0x7f800000 {\n        /* nan */\n        return x;\n    }\n    if sign && ix != 0 {\n        /* x < 0 */\n        return 0.0 / 0.0;\n    }\n    if ix == 0x7f800000 {\n        return 0.0;\n    }\n\n    if n == 0 {\n        return y0f(x);\n    }\n    if n < 0 {\n        nm1 = -(n + 1);\n        sign = (n & 1) != 0;\n    } else {\n        nm1 = n - 1;\n        sign = false;\n    }\n    if nm1 == 0 {\n        if sign {\n            return -y1f(x);\n        } else {\n            return y1f(x);\n        }\n    }\n\n    a = y0f(x);\n    b = y1f(x);\n    /* quit if b is -inf */\n    ib = b.to_bits();\n    i = 0;\n    while i < nm1 && ib != 0xff800000 {\n        i += 1;\n        temp = b;\n        b = (2.0 * (i as f32) / x) * b - a;\n        ib = b.to_bits();\n        a = temp;\n    }\n\n    if sign { -b } else { b }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/k_cos.rs",
    "sha256": "f34a69e44d6b8901b03b578a75972f438ab20a7b98a0903fc1903d6fde3899be",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/k_cos.c\n//\n// ====================================================\n// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n//\n// Developed at SunSoft, a Sun Microsystems, Inc. business.\n// Permission to use, copy, modify, and distribute this\n// software is freely granted, provided that this notice\n// is preserved.\n// ====================================================\n\nconst C1: f64 = 4.16666666666666019037e-02; /* 0x3FA55555, 0x5555554C */\nconst C2: f64 = -1.38888888888741095749e-03; /* 0xBF56C16C, 0x16C15177 */\nconst C3: f64 = 2.48015872894767294178e-05; /* 0x3EFA01A0, 0x19CB1590 */\nconst C4: f64 = -2.75573143513906633035e-07; /* 0xBE927E4F, 0x809C52AD */\nconst C5: f64 = 2.08757232129817482790e-09; /* 0x3E21EE9E, 0xBDB4B1C4 */\nconst C6: f64 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */\n\n// kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164\n// Input x is assumed to be bounded by ~pi/4 in magnitude.\n// Input y is the tail of x.\n//\n// Algorithm\n//      1. Since cos(-x) = cos(x), we need only to consider positive x.\n//      2. if x < 2^-27 (hx<0x3e400000 0), return 1 with inexact if x!=0.\n//      3. cos(x) is approximated by a polynomial of degree 14 on\n//         [0,pi/4]\n//                                       4            14\n//              cos(x) ~ 1 - x*x/2 + C1*x + ... + C6*x\n//         where the remez error is\n//\n//      |              2     4     6     8     10    12     14 |     -58\n//      |cos(x)-(1-.5*x +C1*x +C2*x +C3*x +C4*x +C5*x  +C6*x  )| <= 2\n//      |                                                      |\n//\n//                     4     6     8     10    12     14\n//      4. let r = C1*x +C2*x +C3*x +C4*x +C5*x  +C6*x  , then\n//             cos(x) ~ 1 - x*x/2 + r\n//         since cos(x+y) ~ cos(x) - sin(x)*y\n//                        ~ cos(x) - x*y,\n//         a correction term is necessary in cos(x) and hence\n//              cos(x+y) = 1 - (x*x/2 - (r - x*y))\n//         For better accuracy, rearrange to\n//              cos(x+y) ~ w + (tmp + (r-x*y))\n//         where w = 1 - x*x/2 and tmp is a tiny correction term\n//         (1 - x*x/2 == w + tmp exactly in infinite precision).\n//         The exactness of w + tmp in infinite precision depends on w\n//         and tmp having the same precision as x.  If they have extra\n//         precision due to compiler bugs, then the extra precision is\n//         only good provided it is retained in all terms of the final\n//         expression for cos().  Retention happens in all cases tested\n//         under FreeBSD, so don't pessimize things by forcibly clipping\n//         any extra precision in w.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn k_cos(x: f64, y: f64) -> f64 {\n    let z = x * x;\n    let w = z * z;\n    let r = z * (C1 + z * (C2 + z * C3)) + w * w * (C4 + z * (C5 + z * C6));\n    let hz = 0.5 * z;\n    let w = 1.0 - hz;\n    w + (((1.0 - w) - hz) + (z * r - x * y))\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/k_cosf.rs",
    "sha256": "8f7117ff21cebf8e890a5bcfd7ea858a94172f4172b79a66d53824c2cb0888b1",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/k_cosf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n * Debugged and optimized by Bruce D. Evans.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\n/* |cos(x) - c(x)| < 2**-34.1 (~[-5.37e-11, 5.295e-11]). */\nconst C0: f64 = -0.499999997251031003120; /* -0x1ffffffd0c5e81.0p-54 */\nconst C1: f64 = 0.0416666233237390631894; /*  0x155553e1053a42.0p-57 */\nconst C2: f64 = -0.00138867637746099294692; /* -0x16c087e80f1e27.0p-62 */\nconst C3: f64 = 0.0000243904487962774090654; /*  0x199342e0ee5069.0p-68 */\n\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn k_cosf(x: f64) -> f32 {\n    let z = x * x;\n    let w = z * z;\n    let r = C2 + z * C3;\n    (((1.0 + z * C0) + w * C1) + (w * z) * r) as f32\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/k_sin.rs",
    "sha256": "14b2aba6ca07150c92768b5a72acaf5cde6a11d6619e14896512a7ba242e289a",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/k_sin.c\n//\n// ====================================================\n// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n//\n// Developed at SunSoft, a Sun Microsystems, Inc. business.\n// Permission to use, copy, modify, and distribute this\n// software is freely granted, provided that this notice\n// is preserved.\n// ====================================================\n\nconst S1: f64 = -1.66666666666666324348e-01; /* 0xBFC55555, 0x55555549 */\nconst S2: f64 = 8.33333333332248946124e-03; /* 0x3F811111, 0x1110F8A6 */\nconst S3: f64 = -1.98412698298579493134e-04; /* 0xBF2A01A0, 0x19C161D5 */\nconst S4: f64 = 2.75573137070700676789e-06; /* 0x3EC71DE3, 0x57B1FE7D */\nconst S5: f64 = -2.50507602534068634195e-08; /* 0xBE5AE5E6, 0x8A2B9CEB */\nconst S6: f64 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */\n\n// kernel sin function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854\n// Input x is assumed to be bounded by ~pi/4 in magnitude.\n// Input y is the tail of x.\n// Input iy indicates whether y is 0. (if iy=0, y assume to be 0).\n//\n// Algorithm\n//      1. Since sin(-x) = -sin(x), we need only to consider positive x.\n//      2. Callers must return sin(-0) = -0 without calling here since our\n//         odd polynomial is not evaluated in a way that preserves -0.\n//         Callers may do the optimization sin(x) ~ x for tiny x.\n//      3. sin(x) is approximated by a polynomial of degree 13 on\n//         [0,pi/4]\n//                               3            13\n//              sin(x) ~ x + S1*x + ... + S6*x\n//         where\n//\n//      |sin(x)         2     4     6     8     10     12  |     -58\n//      |----- - (1+S1*x +S2*x +S3*x +S4*x +S5*x  +S6*x   )| <= 2\n//      |  x                                               |\n//\n//      4. sin(x+y) = sin(x) + sin'(x')*y\n//                  ~ sin(x) + (1-x*x/2)*y\n//         For better accuracy, let\n//                   3      2      2      2      2\n//              r = x *(S2+x *(S3+x *(S4+x *(S5+x *S6))))\n//         then                   3    2\n//              sin(x) = x + (S1*x + (x *(r-y/2)+y))\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn k_sin(x: f64, y: f64, iy: i32) -> f64 {\n    let z = x * x;\n    let w = z * z;\n    let r = S2 + z * (S3 + z * S4) + z * w * (S5 + z * S6);\n    let v = z * x;\n    if iy == 0 {\n        x + v * (S1 + z * r)\n    } else {\n        x - ((z * (0.5 * y - v * r) - y) - v * S1)\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/k_sinf.rs",
    "sha256": "2775fcc710807164e6f37a4f8da3c8143cd5f16e19ce7c31c5591522151d7a96",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/k_sinf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n * Optimized by Bruce D. Evans.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\n/* |sin(x)/x - s(x)| < 2**-37.5 (~[-4.89e-12, 4.824e-12]). */\nconst S1: f64 = -0.166666666416265235595; /* -0x15555554cbac77.0p-55 */\nconst S2: f64 = 0.0083333293858894631756; /*  0x111110896efbb2.0p-59 */\nconst S3: f64 = -0.000198393348360966317347; /* -0x1a00f9e2cae774.0p-65 */\nconst S4: f64 = 0.0000027183114939898219064; /*  0x16cd878c3b46a7.0p-71 */\n\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn k_sinf(x: f64) -> f32 {\n    let z = x * x;\n    let w = z * z;\n    let r = S3 + z * S4;\n    let s = z * x;\n    ((x + s * (S1 + z * S2)) + s * w * r) as f32\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/k_tan.rs",
    "sha256": "a72beae4ccd9631eeeb61d6365bbeecae81c8411f3120a999c515cca0d5ea5c5",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/k_tan.c */\n//\n// ====================================================\n// Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.\n//\n// Permission to use, copy, modify, and distribute this\n// software is freely granted, provided that this notice\n// is preserved.\n// ====================================================\n\n// kernel tan function on ~[-pi/4, pi/4] (except on -0), pi/4 ~ 0.7854\n// Input x is assumed to be bounded by ~pi/4 in magnitude.\n// Input y is the tail of x.\n// Input odd indicates whether tan (if odd = 0) or -1/tan (if odd = 1) is returned.\n//\n// Algorithm\n//      1. Since tan(-x) = -tan(x), we need only to consider positive x.\n//      2. Callers must return tan(-0) = -0 without calling here since our\n//         odd polynomial is not evaluated in a way that preserves -0.\n//         Callers may do the optimization tan(x) ~ x for tiny x.\n//      3. tan(x) is approximated by a odd polynomial of degree 27 on\n//         [0,0.67434]\n//                               3             27\n//              tan(x) ~ x + T1*x + ... + T13*x\n//         where\n//\n//              |tan(x)         2     4            26   |     -59.2\n//              |----- - (1+T1*x +T2*x +.... +T13*x    )| <= 2\n//              |  x                                    |\n//\n//         Note: tan(x+y) = tan(x) + tan'(x)*y\n//                        ~ tan(x) + (1+x*x)*y\n//         Therefore, for better accuracy in computing tan(x+y), let\n//                   3      2      2       2       2\n//              r = x *(T2+x *(T3+x *(...+x *(T12+x *T13))))\n//         then\n//                                  3    2\n//              tan(x+y) = x + (T1*x + (x *(r+y)+y))\n//\n//      4. For x in [0.67434,pi/4],  let y = pi/4 - x, then\n//              tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y))\n//                     = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))\nstatic T: [f64; 13] = [\n    3.33333333333334091986e-01,  /* 3FD55555, 55555563 */\n    1.33333333333201242699e-01,  /* 3FC11111, 1110FE7A */\n    5.39682539762260521377e-02,  /* 3FABA1BA, 1BB341FE */\n    2.18694882948595424599e-02,  /* 3F9664F4, 8406D637 */\n    8.86323982359930005737e-03,  /* 3F8226E3, E96E8493 */\n    3.59207910759131235356e-03,  /* 3F6D6D22, C9560328 */\n    1.45620945432529025516e-03,  /* 3F57DBC8, FEE08315 */\n    5.88041240820264096874e-04,  /* 3F4344D8, F2F26501 */\n    2.46463134818469906812e-04,  /* 3F3026F7, 1A8D1068 */\n    7.81794442939557092300e-05,  /* 3F147E88, A03792A6 */\n    7.14072491382608190305e-05,  /* 3F12B80F, 32F0A7E9 */\n    -1.85586374855275456654e-05, /* BEF375CB, DB605373 */\n    2.59073051863633712884e-05,  /* 3EFB2A70, 74BF7AD4 */\n];\nconst PIO4: f64 = 7.85398163397448278999e-01; /* 3FE921FB, 54442D18 */\nconst PIO4_LO: f64 = 3.06161699786838301793e-17; /* 3C81A626, 33145C07 */\n\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn k_tan(mut x: f64, mut y: f64, odd: i32) -> f64 {\n    let hx = (f64::to_bits(x) >> 32) as u32;\n    let big = (hx & 0x7fffffff) >= 0x3FE59428; /* |x| >= 0.6744 */\n    if big {\n        let sign = hx >> 31;\n        if sign != 0 {\n            x = -x;\n            y = -y;\n        }\n        x = (PIO4 - x) + (PIO4_LO - y);\n        y = 0.0;\n    }\n    let z = x * x;\n    let w = z * z;\n    /*\n     * Break x^5*(T[1]+x^2*T[2]+...) into\n     * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) +\n     * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12]))\n     */\n    let r = T[1] + w * (T[3] + w * (T[5] + w * (T[7] + w * (T[9] + w * T[11]))));\n    let v = z * (T[2] + w * (T[4] + w * (T[6] + w * (T[8] + w * (T[10] + w * T[12])))));\n    let s = z * x;\n    let r = y + z * (s * (r + v) + y) + s * T[0];\n    let w = x + r;\n    if big {\n        let sign = hx >> 31;\n        let s = 1.0 - 2.0 * odd as f64;\n        let v = s - 2.0 * (x + (r - w * w / (w + s)));\n        return if sign != 0 { -v } else { v };\n    }\n    if odd == 0 {\n        return w;\n    }\n    /* -1.0/(x+r) has up to 2ulp error, so compute it accurately */\n    let w0 = zero_low_word(w);\n    let v = r - (w0 - x); /* w0+v = r+x */\n    let a = -1.0 / w;\n    let a0 = zero_low_word(a);\n    a0 + a * (1.0 + a0 * w0 + a0 * v)\n}\n\nfn zero_low_word(x: f64) -> f64 {\n    f64::from_bits(f64::to_bits(x) & 0xFFFF_FFFF_0000_0000)\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/k_tanf.rs",
    "sha256": "6a794be56fa4b2f60452b9bab19af01c388f174560acbf829a351378ea39495d",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/k_tan.c */\n/*\n * ====================================================\n * Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.\n *\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\n/* |tan(x)/x - t(x)| < 2**-25.5 (~[-2e-08, 2e-08]). */\nconst T: [f64; 6] = [\n    0.333331395030791399758,   /* 0x15554d3418c99f.0p-54 */\n    0.133392002712976742718,   /* 0x1112fd38999f72.0p-55 */\n    0.0533812378445670393523,  /* 0x1b54c91d865afe.0p-57 */\n    0.0245283181166547278873,  /* 0x191df3908c33ce.0p-58 */\n    0.00297435743359967304927, /* 0x185dadfcecf44e.0p-61 */\n    0.00946564784943673166728, /* 0x1362b9bf971bcd.0p-59 */\n];\n\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn k_tanf(x: f64, odd: bool) -> f32 {\n    let z = x * x;\n    /*\n     * Split up the polynomial into small independent terms to give\n     * opportunities for parallel evaluation.  The chosen splitting is\n     * micro-optimized for Athlons (XP, X64).  It costs 2 multiplications\n     * relative to Horner's method on sequential machines.\n     *\n     * We add the small terms from lowest degree up for efficiency on\n     * non-sequential machines (the lowest degree terms tend to be ready\n     * earlier).  Apart from this, we don't care about order of\n     * operations, and don't need to to care since we have precision to\n     * spare.  However, the chosen splitting is good for accuracy too,\n     * and would give results as accurate as Horner's method if the\n     * small terms were added from highest degree down.\n     */\n    let mut r = T[4] + z * T[5];\n    let t = T[2] + z * T[3];\n    let w = z * z;\n    let s = z * x;\n    let u = T[0] + z * T[1];\n    r = (x + s * u) + (s * w) * (t + w * r);\n    (if odd { -1. / r } else { r }) as f32\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/lgamma_r.rs",
    "sha256": "b25f8aac64fd371b2b62b6f86063e16a98f2a71d0701ce6eb5e25732eafc7134",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_lgamma_r.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n *\n */\n/* lgamma_r(x, signgamp)\n * Reentrant version of the logarithm of the Gamma function\n * with user provide pointer for the sign of Gamma(x).\n *\n * Method:\n *   1. Argument Reduction for 0 < x <= 8\n *      Since gamma(1+s)=s*gamma(s), for x in [0,8], we may\n *      reduce x to a number in [1.5,2.5] by\n *              lgamma(1+s) = log(s) + lgamma(s)\n *      for example,\n *              lgamma(7.3) = log(6.3) + lgamma(6.3)\n *                          = log(6.3*5.3) + lgamma(5.3)\n *                          = log(6.3*5.3*4.3*3.3*2.3) + lgamma(2.3)\n *   2. Polynomial approximation of lgamma around its\n *      minimun ymin=1.461632144968362245 to maintain monotonicity.\n *      On [ymin-0.23, ymin+0.27] (i.e., [1.23164,1.73163]), use\n *              Let z = x-ymin;\n *              lgamma(x) = -1.214862905358496078218 + z^2*poly(z)\n *      where\n *              poly(z) is a 14 degree polynomial.\n *   2. Rational approximation in the primary interval [2,3]\n *      We use the following approximation:\n *              s = x-2.0;\n *              lgamma(x) = 0.5*s + s*P(s)/Q(s)\n *      with accuracy\n *              |P/Q - (lgamma(x)-0.5s)| < 2**-61.71\n *      Our algorithms are based on the following observation\n *\n *                             zeta(2)-1    2    zeta(3)-1    3\n * lgamma(2+s) = s*(1-Euler) + --------- * s  -  --------- * s  + ...\n *                                 2                 3\n *\n *      where Euler = 0.5771... is the Euler constant, which is very\n *      close to 0.5.\n *\n *   3. For x>=8, we have\n *      lgamma(x)~(x-0.5)log(x)-x+0.5*log(2pi)+1/(12x)-1/(360x**3)+....\n *      (better formula:\n *         lgamma(x)~(x-0.5)*(log(x)-1)-.5*(log(2pi)-1) + ...)\n *      Let z = 1/x, then we approximation\n *              f(z) = lgamma(x) - (x-0.5)(log(x)-1)\n *      by\n *                                  3       5             11\n *              w = w0 + w1*z + w2*z  + w3*z  + ... + w6*z\n *      where\n *              |w - f(z)| < 2**-58.74\n *\n *   4. For negative x, since (G is gamma function)\n *              -x*G(-x)*G(x) = PI/sin(PI*x),\n *      we have\n *              G(x) = PI/(sin(PI*x)*(-x)*G(-x))\n *      since G(-x) is positive, sign(G(x)) = sign(sin(PI*x)) for x<0\n *      Hence, for x<0, signgam = sign(sin(PI*x)) and\n *              lgamma(x) = log(|Gamma(x)|)\n *                        = log(PI/(|x*sin(PI*x)|)) - lgamma(-x);\n *      Note: one should avoid compute PI*(-x) directly in the\n *            computation of sin(PI*(-x)).\n *\n *   5. Special Cases\n *              lgamma(2+s) ~ s*(1-Euler) for tiny s\n *              lgamma(1) = lgamma(2) = 0\n *              lgamma(x) ~ -log(|x|) for tiny x\n *              lgamma(0) = lgamma(neg.integer) = inf and raise divide-by-zero\n *              lgamma(inf) = inf\n *              lgamma(-inf) = inf (bug for bug compatible with C99!?)\n *\n */\n\nuse super::{floor, k_cos, k_sin, log};\n\nconst PI: f64 = 3.14159265358979311600e+00; /* 0x400921FB, 0x54442D18 */\nconst A0: f64 = 7.72156649015328655494e-02; /* 0x3FB3C467, 0xE37DB0C8 */\nconst A1: f64 = 3.22467033424113591611e-01; /* 0x3FD4A34C, 0xC4A60FAD */\nconst A2: f64 = 6.73523010531292681824e-02; /* 0x3FB13E00, 0x1A5562A7 */\nconst A3: f64 = 2.05808084325167332806e-02; /* 0x3F951322, 0xAC92547B */\nconst A4: f64 = 7.38555086081402883957e-03; /* 0x3F7E404F, 0xB68FEFE8 */\nconst A5: f64 = 2.89051383673415629091e-03; /* 0x3F67ADD8, 0xCCB7926B */\nconst A6: f64 = 1.19270763183362067845e-03; /* 0x3F538A94, 0x116F3F5D */\nconst A7: f64 = 5.10069792153511336608e-04; /* 0x3F40B6C6, 0x89B99C00 */\nconst A8: f64 = 2.20862790713908385557e-04; /* 0x3F2CF2EC, 0xED10E54D */\nconst A9: f64 = 1.08011567247583939954e-04; /* 0x3F1C5088, 0x987DFB07 */\nconst A10: f64 = 2.52144565451257326939e-05; /* 0x3EFA7074, 0x428CFA52 */\nconst A11: f64 = 4.48640949618915160150e-05; /* 0x3F07858E, 0x90A45837 */\nconst TC: f64 = 1.46163214496836224576e+00; /* 0x3FF762D8, 0x6356BE3F */\nconst TF: f64 = -1.21486290535849611461e-01; /* 0xBFBF19B9, 0xBCC38A42 */\n/* tt = -(tail of TF) */\nconst TT: f64 = -3.63867699703950536541e-18; /* 0xBC50C7CA, 0xA48A971F */\nconst T0: f64 = 4.83836122723810047042e-01; /* 0x3FDEF72B, 0xC8EE38A2 */\nconst T1: f64 = -1.47587722994593911752e-01; /* 0xBFC2E427, 0x8DC6C509 */\nconst T2: f64 = 6.46249402391333854778e-02; /* 0x3FB08B42, 0x94D5419B */\nconst T3: f64 = -3.27885410759859649565e-02; /* 0xBFA0C9A8, 0xDF35B713 */\nconst T4: f64 = 1.79706750811820387126e-02; /* 0x3F9266E7, 0x970AF9EC */\nconst T5: f64 = -1.03142241298341437450e-02; /* 0xBF851F9F, 0xBA91EC6A */\nconst T6: f64 = 6.10053870246291332635e-03; /* 0x3F78FCE0, 0xE370E344 */\nconst T7: f64 = -3.68452016781138256760e-03; /* 0xBF6E2EFF, 0xB3E914D7 */\nconst T8: f64 = 2.25964780900612472250e-03; /* 0x3F6282D3, 0x2E15C915 */\nconst T9: f64 = -1.40346469989232843813e-03; /* 0xBF56FE8E, 0xBF2D1AF1 */\nconst T10: f64 = 8.81081882437654011382e-04; /* 0x3F4CDF0C, 0xEF61A8E9 */\nconst T11: f64 = -5.38595305356740546715e-04; /* 0xBF41A610, 0x9C73E0EC */\nconst T12: f64 = 3.15632070903625950361e-04; /* 0x3F34AF6D, 0x6C0EBBF7 */\nconst T13: f64 = -3.12754168375120860518e-04; /* 0xBF347F24, 0xECC38C38 */\nconst T14: f64 = 3.35529192635519073543e-04; /* 0x3F35FD3E, 0xE8C2D3F4 */\nconst U0: f64 = -7.72156649015328655494e-02; /* 0xBFB3C467, 0xE37DB0C8 */\nconst U1: f64 = 6.32827064025093366517e-01; /* 0x3FE4401E, 0x8B005DFF */\nconst U2: f64 = 1.45492250137234768737e+00; /* 0x3FF7475C, 0xD119BD6F */\nconst U3: f64 = 9.77717527963372745603e-01; /* 0x3FEF4976, 0x44EA8450 */\nconst U4: f64 = 2.28963728064692451092e-01; /* 0x3FCD4EAE, 0xF6010924 */\nconst U5: f64 = 1.33810918536787660377e-02; /* 0x3F8B678B, 0xBF2BAB09 */\nconst V1: f64 = 2.45597793713041134822e+00; /* 0x4003A5D7, 0xC2BD619C */\nconst V2: f64 = 2.12848976379893395361e+00; /* 0x40010725, 0xA42B18F5 */\nconst V3: f64 = 7.69285150456672783825e-01; /* 0x3FE89DFB, 0xE45050AF */\nconst V4: f64 = 1.04222645593369134254e-01; /* 0x3FBAAE55, 0xD6537C88 */\nconst V5: f64 = 3.21709242282423911810e-03; /* 0x3F6A5ABB, 0x57D0CF61 */\nconst S0: f64 = -7.72156649015328655494e-02; /* 0xBFB3C467, 0xE37DB0C8 */\nconst S1: f64 = 2.14982415960608852501e-01; /* 0x3FCB848B, 0x36E20878 */\nconst S2: f64 = 3.25778796408930981787e-01; /* 0x3FD4D98F, 0x4F139F59 */\nconst S3: f64 = 1.46350472652464452805e-01; /* 0x3FC2BB9C, 0xBEE5F2F7 */\nconst S4: f64 = 2.66422703033638609560e-02; /* 0x3F9B481C, 0x7E939961 */\nconst S5: f64 = 1.84028451407337715652e-03; /* 0x3F5E26B6, 0x7368F239 */\nconst S6: f64 = 3.19475326584100867617e-05; /* 0x3F00BFEC, 0xDD17E945 */\nconst R1: f64 = 1.39200533467621045958e+00; /* 0x3FF645A7, 0x62C4AB74 */\nconst R2: f64 = 7.21935547567138069525e-01; /* 0x3FE71A18, 0x93D3DCDC */\nconst R3: f64 = 1.71933865632803078993e-01; /* 0x3FC601ED, 0xCCFBDF27 */\nconst R4: f64 = 1.86459191715652901344e-02; /* 0x3F9317EA, 0x742ED475 */\nconst R5: f64 = 7.77942496381893596434e-04; /* 0x3F497DDA, 0xCA41A95B */\nconst R6: f64 = 7.32668430744625636189e-06; /* 0x3EDEBAF7, 0xA5B38140 */\nconst W0: f64 = 4.18938533204672725052e-01; /* 0x3FDACFE3, 0x90C97D69 */\nconst W1: f64 = 8.33333333333329678849e-02; /* 0x3FB55555, 0x5555553B */\nconst W2: f64 = -2.77777777728775536470e-03; /* 0xBF66C16C, 0x16B02E5C */\nconst W3: f64 = 7.93650558643019558500e-04; /* 0x3F4A019F, 0x98CF38B6 */\nconst W4: f64 = -5.95187557450339963135e-04; /* 0xBF4380CB, 0x8C0FE741 */\nconst W5: f64 = 8.36339918996282139126e-04; /* 0x3F4B67BA, 0x4CDAD5D1 */\nconst W6: f64 = -1.63092934096575273989e-03; /* 0xBF5AB89D, 0x0B9E43E4 */\n\n/* sin(PI*x) assuming x > 2^-100, if sin(PI*x)==0 the sign is arbitrary */\nfn sin_pi(mut x: f64) -> f64 {\n    let mut n: i32;\n\n    /* spurious inexact if odd int */\n    x = 2.0 * (x * 0.5 - floor(x * 0.5)); /* x mod 2.0 */\n\n    n = (x * 4.0) as i32;\n    n = div!(n + 1, 2);\n    x -= (n as f64) * 0.5;\n    x *= PI;\n\n    match n {\n        1 => k_cos(x, 0.0),\n        2 => k_sin(-x, 0.0, 0),\n        3 => -k_cos(x, 0.0),\n        // 0\n        _ => k_sin(x, 0.0, 0),\n    }\n}\n\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn lgamma_r(mut x: f64) -> (f64, i32) {\n    let u: u64 = x.to_bits();\n    let mut t: f64;\n    let y: f64;\n    let mut z: f64;\n    let nadj: f64;\n    let p: f64;\n    let p1: f64;\n    let p2: f64;\n    let p3: f64;\n    let q: f64;\n    let mut r: f64;\n    let w: f64;\n    let ix: u32;\n    let sign: bool;\n    let i: i32;\n    let mut signgam: i32;\n\n    /* purge off +-inf, NaN, +-0, tiny and negative arguments */\n    signgam = 1;\n    sign = (u >> 63) != 0;\n    ix = ((u >> 32) as u32) & 0x7fffffff;\n    if ix >= 0x7ff00000 {\n        return (x * x, signgam);\n    }\n    if ix < (0x3ff - 70) << 20 {\n        /* |x|<2**-70, return -log(|x|) */\n        if sign {\n            x = -x;\n            signgam = -1;\n        }\n        return (-log(x), signgam);\n    }\n    if sign {\n        x = -x;\n        t = sin_pi(x);\n        if t == 0.0 {\n            /* -integer */\n            return (1.0 / (x - x), signgam);\n        }\n        if t > 0.0 {\n            signgam = -1;\n        } else {\n            t = -t;\n        }\n        nadj = log(PI / (t * x));\n    } else {\n        nadj = 0.0;\n    }\n\n    /* purge off 1 and 2 */\n    if (ix == 0x3ff00000 || ix == 0x40000000) && (u & 0xffffffff) == 0 {\n        r = 0.0;\n    }\n    /* for x < 2.0 */\n    else if ix < 0x40000000 {\n        if ix <= 0x3feccccc {\n            /* lgamma(x) = lgamma(x+1)-log(x) */\n            r = -log(x);\n            if ix >= 0x3FE76944 {\n                y = 1.0 - x;\n                i = 0;\n            } else if ix >= 0x3FCDA661 {\n                y = x - (TC - 1.0);\n                i = 1;\n            } else {\n                y = x;\n                i = 2;\n            }\n        } else {\n            r = 0.0;\n            if ix >= 0x3FFBB4C3 {\n                /* [1.7316,2] */\n                y = 2.0 - x;\n                i = 0;\n            } else if ix >= 0x3FF3B4C4 {\n                /* [1.23,1.73] */\n                y = x - TC;\n                i = 1;\n            } else {\n                y = x - 1.0;\n                i = 2;\n            }\n        }\n        match i {\n            0 => {\n                z = y * y;\n                p1 = A0 + z * (A2 + z * (A4 + z * (A6 + z * (A8 + z * A10))));\n                p2 = z * (A1 + z * (A3 + z * (A5 + z * (A7 + z * (A9 + z * A11)))));\n                p = y * p1 + p2;\n                r += p - 0.5 * y;\n            }\n            1 => {\n                z = y * y;\n                w = z * y;\n                p1 = T0 + w * (T3 + w * (T6 + w * (T9 + w * T12))); /* parallel comp */\n                p2 = T1 + w * (T4 + w * (T7 + w * (T10 + w * T13)));\n                p3 = T2 + w * (T5 + w * (T8 + w * (T11 + w * T14)));\n                p = z * p1 - (TT - w * (p2 + y * p3));\n                r += TF + p;\n            }\n            2 => {\n                p1 = y * (U0 + y * (U1 + y * (U2 + y * (U3 + y * (U4 + y * U5)))));\n                p2 = 1.0 + y * (V1 + y * (V2 + y * (V3 + y * (V4 + y * V5))));\n                r += -0.5 * y + p1 / p2;\n            }\n            #[cfg(debug_assertions)]\n            _ => unreachable!(),\n            #[cfg(not(debug_assertions))]\n            _ => {}\n        }\n    } else if ix < 0x40200000 {\n        /* x < 8.0 */\n        i = x as i32;\n        y = x - (i as f64);\n        p = y * (S0 + y * (S1 + y * (S2 + y * (S3 + y * (S4 + y * (S5 + y * S6))))));\n        q = 1.0 + y * (R1 + y * (R2 + y * (R3 + y * (R4 + y * (R5 + y * R6)))));\n        r = 0.5 * y + p / q;\n        z = 1.0; /* lgamma(1+s) = log(s) + lgamma(s) */\n        // TODO: In C, this was implemented using switch jumps with fallthrough.\n        // Does this implementation have performance problems?\n        if i >= 7 {\n            z *= y + 6.0;\n        }\n        if i >= 6 {\n            z *= y + 5.0;\n        }\n        if i >= 5 {\n            z *= y + 4.0;\n        }\n        if i >= 4 {\n            z *= y + 3.0;\n        }\n        if i >= 3 {\n            z *= y + 2.0;\n            r += log(z);\n        }\n    } else if ix < 0x43900000 {\n        /* 8.0 <= x < 2**58 */\n        t = log(x);\n        z = 1.0 / x;\n        y = z * z;\n        w = W0 + z * (W1 + y * (W2 + y * (W3 + y * (W4 + y * (W5 + y * W6)))));\n        r = (x - 0.5) * (t - 1.0) + w;\n    } else {\n        /* 2**58 <= x <= inf */\n        r = x * (log(x) - 1.0);\n    }\n    if sign {\n        r = nadj - r;\n    }\n    return (r, signgam);\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/lgammaf_r.rs",
    "sha256": "7a6069d52cf95dca56e8e505ca0e1f8813e116d06368b1f6936ccd383a677690",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_lgammaf_r.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{floorf, k_cosf, k_sinf, logf};\n\nconst PI: f32 = 3.1415927410e+00; /* 0x40490fdb */\nconst A0: f32 = 7.7215664089e-02; /* 0x3d9e233f */\nconst A1: f32 = 3.2246702909e-01; /* 0x3ea51a66 */\nconst A2: f32 = 6.7352302372e-02; /* 0x3d89f001 */\nconst A3: f32 = 2.0580807701e-02; /* 0x3ca89915 */\nconst A4: f32 = 7.3855509982e-03; /* 0x3bf2027e */\nconst A5: f32 = 2.8905137442e-03; /* 0x3b3d6ec6 */\nconst A6: f32 = 1.1927076848e-03; /* 0x3a9c54a1 */\nconst A7: f32 = 5.1006977446e-04; /* 0x3a05b634 */\nconst A8: f32 = 2.2086278477e-04; /* 0x39679767 */\nconst A9: f32 = 1.0801156895e-04; /* 0x38e28445 */\nconst A10: f32 = 2.5214456400e-05; /* 0x37d383a2 */\nconst A11: f32 = 4.4864096708e-05; /* 0x383c2c75 */\nconst TC: f32 = 1.4616321325e+00; /* 0x3fbb16c3 */\nconst TF: f32 = -1.2148628384e-01; /* 0xbdf8cdcd */\n/* TT = -(tail of TF) */\nconst TT: f32 = 6.6971006518e-09; /* 0x31e61c52 */\nconst T0: f32 = 4.8383611441e-01; /* 0x3ef7b95e */\nconst T1: f32 = -1.4758771658e-01; /* 0xbe17213c */\nconst T2: f32 = 6.4624942839e-02; /* 0x3d845a15 */\nconst T3: f32 = -3.2788541168e-02; /* 0xbd064d47 */\nconst T4: f32 = 1.7970675603e-02; /* 0x3c93373d */\nconst T5: f32 = -1.0314224288e-02; /* 0xbc28fcfe */\nconst T6: f32 = 6.1005386524e-03; /* 0x3bc7e707 */\nconst T7: f32 = -3.6845202558e-03; /* 0xbb7177fe */\nconst T8: f32 = 2.2596477065e-03; /* 0x3b141699 */\nconst T9: f32 = -1.4034647029e-03; /* 0xbab7f476 */\nconst T10: f32 = 8.8108185446e-04; /* 0x3a66f867 */\nconst T11: f32 = -5.3859531181e-04; /* 0xba0d3085 */\nconst T12: f32 = 3.1563205994e-04; /* 0x39a57b6b */\nconst T13: f32 = -3.1275415677e-04; /* 0xb9a3f927 */\nconst T14: f32 = 3.3552918467e-04; /* 0x39afe9f7 */\nconst U0: f32 = -7.7215664089e-02; /* 0xbd9e233f */\nconst U1: f32 = 6.3282704353e-01; /* 0x3f2200f4 */\nconst U2: f32 = 1.4549225569e+00; /* 0x3fba3ae7 */\nconst U3: f32 = 9.7771751881e-01; /* 0x3f7a4bb2 */\nconst U4: f32 = 2.2896373272e-01; /* 0x3e6a7578 */\nconst U5: f32 = 1.3381091878e-02; /* 0x3c5b3c5e */\nconst V1: f32 = 2.4559779167e+00; /* 0x401d2ebe */\nconst V2: f32 = 2.1284897327e+00; /* 0x4008392d */\nconst V3: f32 = 7.6928514242e-01; /* 0x3f44efdf */\nconst V4: f32 = 1.0422264785e-01; /* 0x3dd572af */\nconst V5: f32 = 3.2170924824e-03; /* 0x3b52d5db */\nconst S0: f32 = -7.7215664089e-02; /* 0xbd9e233f */\nconst S1: f32 = 2.1498242021e-01; /* 0x3e5c245a */\nconst S2: f32 = 3.2577878237e-01; /* 0x3ea6cc7a */\nconst S3: f32 = 1.4635047317e-01; /* 0x3e15dce6 */\nconst S4: f32 = 2.6642270386e-02; /* 0x3cda40e4 */\nconst S5: f32 = 1.8402845599e-03; /* 0x3af135b4 */\nconst S6: f32 = 3.1947532989e-05; /* 0x3805ff67 */\nconst R1: f32 = 1.3920053244e+00; /* 0x3fb22d3b */\nconst R2: f32 = 7.2193557024e-01; /* 0x3f38d0c5 */\nconst R3: f32 = 1.7193385959e-01; /* 0x3e300f6e */\nconst R4: f32 = 1.8645919859e-02; /* 0x3c98bf54 */\nconst R5: f32 = 7.7794247773e-04; /* 0x3a4beed6 */\nconst R6: f32 = 7.3266842264e-06; /* 0x36f5d7bd */\nconst W0: f32 = 4.1893854737e-01; /* 0x3ed67f1d */\nconst W1: f32 = 8.3333335817e-02; /* 0x3daaaaab */\nconst W2: f32 = -2.7777778450e-03; /* 0xbb360b61 */\nconst W3: f32 = 7.9365057172e-04; /* 0x3a500cfd */\nconst W4: f32 = -5.9518753551e-04; /* 0xba1c065c */\nconst W5: f32 = 8.3633989561e-04; /* 0x3a5b3dd2 */\nconst W6: f32 = -1.6309292987e-03; /* 0xbad5c4e8 */\n\n/* sin(PI*x) assuming x > 2^-100, if sin(PI*x)==0 the sign is arbitrary */\nfn sin_pi(mut x: f32) -> f32 {\n    let mut y: f64;\n    let mut n: isize;\n\n    /* spurious inexact if odd int */\n    x = 2.0 * (x * 0.5 - floorf(x * 0.5)); /* x mod 2.0 */\n\n    n = (x * 4.0) as isize;\n    n = div!(n + 1, 2);\n    y = (x as f64) - (n as f64) * 0.5;\n    y *= 3.14159265358979323846;\n    match n {\n        1 => k_cosf(y),\n        2 => k_sinf(-y),\n        3 => -k_cosf(y),\n        // 0\n        _ => k_sinf(y),\n    }\n}\n\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn lgammaf_r(mut x: f32) -> (f32, i32) {\n    let u = x.to_bits();\n    let mut t: f32;\n    let y: f32;\n    let mut z: f32;\n    let nadj: f32;\n    let p: f32;\n    let p1: f32;\n    let p2: f32;\n    let p3: f32;\n    let q: f32;\n    let mut r: f32;\n    let w: f32;\n    let ix: u32;\n    let i: i32;\n    let sign: bool;\n    let mut signgam: i32;\n\n    /* purge off +-inf, NaN, +-0, tiny and negative arguments */\n    signgam = 1;\n    sign = (u >> 31) != 0;\n    ix = u & 0x7fffffff;\n    if ix >= 0x7f800000 {\n        return (x * x, signgam);\n    }\n    if ix < 0x35000000 {\n        /* |x| < 2**-21, return -log(|x|) */\n        if sign {\n            signgam = -1;\n            x = -x;\n        }\n        return (-logf(x), signgam);\n    }\n    if sign {\n        x = -x;\n        t = sin_pi(x);\n        if t == 0.0 {\n            /* -integer */\n            return (1.0 / (x - x), signgam);\n        }\n        if t > 0.0 {\n            signgam = -1;\n        } else {\n            t = -t;\n        }\n        nadj = logf(PI / (t * x));\n    } else {\n        nadj = 0.0;\n    }\n\n    /* purge off 1 and 2 */\n    if ix == 0x3f800000 || ix == 0x40000000 {\n        r = 0.0;\n    }\n    /* for x < 2.0 */\n    else if ix < 0x40000000 {\n        if ix <= 0x3f666666 {\n            /* lgamma(x) = lgamma(x+1)-log(x) */\n            r = -logf(x);\n            if ix >= 0x3f3b4a20 {\n                y = 1.0 - x;\n                i = 0;\n            } else if ix >= 0x3e6d3308 {\n                y = x - (TC - 1.0);\n                i = 1;\n            } else {\n                y = x;\n                i = 2;\n            }\n        } else {\n            r = 0.0;\n            if ix >= 0x3fdda618 {\n                /* [1.7316,2] */\n                y = 2.0 - x;\n                i = 0;\n            } else if ix >= 0x3F9da620 {\n                /* [1.23,1.73] */\n                y = x - TC;\n                i = 1;\n            } else {\n                y = x - 1.0;\n                i = 2;\n            }\n        }\n        match i {\n            0 => {\n                z = y * y;\n                p1 = A0 + z * (A2 + z * (A4 + z * (A6 + z * (A8 + z * A10))));\n                p2 = z * (A1 + z * (A3 + z * (A5 + z * (A7 + z * (A9 + z * A11)))));\n                p = y * p1 + p2;\n                r += p - 0.5 * y;\n            }\n            1 => {\n                z = y * y;\n                w = z * y;\n                p1 = T0 + w * (T3 + w * (T6 + w * (T9 + w * T12))); /* parallel comp */\n                p2 = T1 + w * (T4 + w * (T7 + w * (T10 + w * T13)));\n                p3 = T2 + w * (T5 + w * (T8 + w * (T11 + w * T14)));\n                p = z * p1 - (TT - w * (p2 + y * p3));\n                r += TF + p;\n            }\n            2 => {\n                p1 = y * (U0 + y * (U1 + y * (U2 + y * (U3 + y * (U4 + y * U5)))));\n                p2 = 1.0 + y * (V1 + y * (V2 + y * (V3 + y * (V4 + y * V5))));\n                r += -0.5 * y + p1 / p2;\n            }\n            #[cfg(debug_assertions)]\n            _ => unreachable!(),\n            #[cfg(not(debug_assertions))]\n            _ => {}\n        }\n    } else if ix < 0x41000000 {\n        /* x < 8.0 */\n        i = x as i32;\n        y = x - (i as f32);\n        p = y * (S0 + y * (S1 + y * (S2 + y * (S3 + y * (S4 + y * (S5 + y * S6))))));\n        q = 1.0 + y * (R1 + y * (R2 + y * (R3 + y * (R4 + y * (R5 + y * R6)))));\n        r = 0.5 * y + p / q;\n        z = 1.0; /* lgamma(1+s) = log(s) + lgamma(s) */\n        // TODO: In C, this was implemented using switch jumps with fallthrough.\n        // Does this implementation have performance problems?\n        if i >= 7 {\n            z *= y + 6.0;\n        }\n        if i >= 6 {\n            z *= y + 5.0;\n        }\n        if i >= 5 {\n            z *= y + 4.0;\n        }\n        if i >= 4 {\n            z *= y + 3.0;\n        }\n        if i >= 3 {\n            z *= y + 2.0;\n            r += logf(z);\n        }\n    } else if ix < 0x5c800000 {\n        /* 8.0 <= x < 2**58 */\n        t = logf(x);\n        z = 1.0 / x;\n        y = z * z;\n        w = W0 + z * (W1 + y * (W2 + y * (W3 + y * (W4 + y * (W5 + y * W6)))));\n        r = (x - 0.5) * (t - 1.0) + w;\n    } else {\n        /* 2**58 <= x <= inf */\n        r = x * (logf(x) - 1.0);\n    }\n    if sign {\n        r = nadj - r;\n    }\n    return (r, signgam);\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/log.rs",
    "sha256": "568aa4bfe309d1925929415227fffbed5653dbc66fe70ee732802c0e6cdf4cf7",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_log.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* log(x)\n * Return the logarithm of x\n *\n * Method :\n *   1. Argument Reduction: find k and f such that\n *                      x = 2^k * (1+f),\n *         where  sqrt(2)/2 < 1+f < sqrt(2) .\n *\n *   2. Approximation of log(1+f).\n *      Let s = f/(2+f) ; based on log(1+f) = log(1+s) - log(1-s)\n *               = 2s + 2/3 s**3 + 2/5 s**5 + .....,\n *               = 2s + s*R\n *      We use a special Remez algorithm on [0,0.1716] to generate\n *      a polynomial of degree 14 to approximate R The maximum error\n *      of this polynomial approximation is bounded by 2**-58.45. In\n *      other words,\n *                      2      4      6      8      10      12      14\n *          R(z) ~ Lg1*s +Lg2*s +Lg3*s +Lg4*s +Lg5*s  +Lg6*s  +Lg7*s\n *      (the values of Lg1 to Lg7 are listed in the program)\n *      and\n *          |      2          14          |     -58.45\n *          | Lg1*s +...+Lg7*s    -  R(z) | <= 2\n *          |                             |\n *      Note that 2s = f - s*f = f - hfsq + s*hfsq, where hfsq = f*f/2.\n *      In order to guarantee error in log below 1ulp, we compute log\n *      by\n *              log(1+f) = f - s*(f - R)        (if f is not too large)\n *              log(1+f) = f - (hfsq - s*(hfsq+R)).     (better accuracy)\n *\n *      3. Finally,  log(x) = k*ln2 + log(1+f).\n *                          = k*ln2_hi+(f-(hfsq-(s*(hfsq+R)+k*ln2_lo)))\n *         Here ln2 is split into two floating point number:\n *                      ln2_hi + ln2_lo,\n *         where n*ln2_hi is always exact for |n| < 2000.\n *\n * Special cases:\n *      log(x) is NaN with signal if x < 0 (including -INF) ;\n *      log(+INF) is +INF; log(0) is -INF with signal;\n *      log(NaN) is that NaN with no signal.\n *\n * Accuracy:\n *      according to an error analysis, the error is always less than\n *      1 ulp (unit in the last place).\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n */\n\nconst LN2_HI: f64 = 6.93147180369123816490e-01; /* 3fe62e42 fee00000 */\nconst LN2_LO: f64 = 1.90821492927058770002e-10; /* 3dea39ef 35793c76 */\nconst LG1: f64 = 6.666666666666735130e-01; /* 3FE55555 55555593 */\nconst LG2: f64 = 3.999999999940941908e-01; /* 3FD99999 9997FA04 */\nconst LG3: f64 = 2.857142874366239149e-01; /* 3FD24924 94229359 */\nconst LG4: f64 = 2.222219843214978396e-01; /* 3FCC71C5 1D8E78AF */\nconst LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */\nconst LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */\nconst LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */\n\n/// The natural logarithm of `x` (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn log(mut x: f64) -> f64 {\n    let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54\n\n    let mut ui = x.to_bits();\n    let mut hx: u32 = (ui >> 32) as u32;\n    let mut k: i32 = 0;\n\n    if (hx < 0x00100000) || ((hx >> 31) != 0) {\n        /* x < 2**-126  */\n        if ui << 1 == 0 {\n            return -1. / (x * x); /* log(+-0)=-inf */\n        }\n        if hx >> 31 != 0 {\n            return (x - x) / 0.0; /* log(-#) = NaN */\n        }\n        /* subnormal number, scale x up */\n        k -= 54;\n        x *= x1p54;\n        ui = x.to_bits();\n        hx = (ui >> 32) as u32;\n    } else if hx >= 0x7ff00000 {\n        return x;\n    } else if hx == 0x3ff00000 && ui << 32 == 0 {\n        return 0.;\n    }\n\n    /* reduce x into [sqrt(2)/2, sqrt(2)] */\n    hx += 0x3ff00000 - 0x3fe6a09e;\n    k += ((hx >> 20) as i32) - 0x3ff;\n    hx = (hx & 0x000fffff) + 0x3fe6a09e;\n    ui = ((hx as u64) << 32) | (ui & 0xffffffff);\n    x = f64::from_bits(ui);\n\n    let f: f64 = x - 1.0;\n    let hfsq: f64 = 0.5 * f * f;\n    let s: f64 = f / (2.0 + f);\n    let z: f64 = s * s;\n    let w: f64 = z * z;\n    let t1: f64 = w * (LG2 + w * (LG4 + w * LG6));\n    let t2: f64 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7)));\n    let r: f64 = t2 + t1;\n    let dk: f64 = k as f64;\n    s * (hfsq + r) + dk * LN2_LO - hfsq + f + dk * LN2_HI\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/log10.rs",
    "sha256": "2655e642136ba4201882342512a54a6574704d2dff940309613e3183e1116b4d",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_log10.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/*\n * Return the base 10 logarithm of x.  See log.c for most comments.\n *\n * Reduce x to 2^k (1+f) and calculate r = log(1+f) - f + f*f/2\n * as in log.c, then combine and scale in extra precision:\n *    log10(x) = (f - f*f/2 + r)/log(10) + k*log10(2)\n */\n\nuse core::f64;\n\nconst IVLN10HI: f64 = 4.34294481878168880939e-01; /* 0x3fdbcb7b, 0x15200000 */\nconst IVLN10LO: f64 = 2.50829467116452752298e-11; /* 0x3dbb9438, 0xca9aadd5 */\nconst LOG10_2HI: f64 = 3.01029995663611771306e-01; /* 0x3FD34413, 0x509F6000 */\nconst LOG10_2LO: f64 = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */\nconst LG1: f64 = 6.666666666666735130e-01; /* 3FE55555 55555593 */\nconst LG2: f64 = 3.999999999940941908e-01; /* 3FD99999 9997FA04 */\nconst LG3: f64 = 2.857142874366239149e-01; /* 3FD24924 94229359 */\nconst LG4: f64 = 2.222219843214978396e-01; /* 3FCC71C5 1D8E78AF */\nconst LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */\nconst LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */\nconst LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */\n\n/// The base 10 logarithm of `x` (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn log10(mut x: f64) -> f64 {\n    let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54\n\n    let mut ui: u64 = x.to_bits();\n    let hfsq: f64;\n    let f: f64;\n    let s: f64;\n    let z: f64;\n    let r: f64;\n    let mut w: f64;\n    let t1: f64;\n    let t2: f64;\n    let dk: f64;\n    let y: f64;\n    let mut hi: f64;\n    let lo: f64;\n    let mut val_hi: f64;\n    let mut val_lo: f64;\n    let mut hx: u32;\n    let mut k: i32;\n\n    hx = (ui >> 32) as u32;\n    k = 0;\n    if hx < 0x00100000 || (hx >> 31) > 0 {\n        if ui << 1 == 0 {\n            return -1. / (x * x); /* log(+-0)=-inf */\n        }\n        if (hx >> 31) > 0 {\n            return (x - x) / 0.0; /* log(-#) = NaN */\n        }\n        /* subnormal number, scale x up */\n        k -= 54;\n        x *= x1p54;\n        ui = x.to_bits();\n        hx = (ui >> 32) as u32;\n    } else if hx >= 0x7ff00000 {\n        return x;\n    } else if hx == 0x3ff00000 && ui << 32 == 0 {\n        return 0.;\n    }\n\n    /* reduce x into [sqrt(2)/2, sqrt(2)] */\n    hx += 0x3ff00000 - 0x3fe6a09e;\n    k += (hx >> 20) as i32 - 0x3ff;\n    hx = (hx & 0x000fffff) + 0x3fe6a09e;\n    ui = ((hx as u64) << 32) | (ui & 0xffffffff);\n    x = f64::from_bits(ui);\n\n    f = x - 1.0;\n    hfsq = 0.5 * f * f;\n    s = f / (2.0 + f);\n    z = s * s;\n    w = z * z;\n    t1 = w * (LG2 + w * (LG4 + w * LG6));\n    t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7)));\n    r = t2 + t1;\n\n    /* See log2.c for details. */\n    /* hi+lo = f - hfsq + s*(hfsq+R) ~ log(1+f) */\n    hi = f - hfsq;\n    ui = hi.to_bits();\n    ui &= (-1i64 as u64) << 32;\n    hi = f64::from_bits(ui);\n    lo = f - hi - hfsq + s * (hfsq + r);\n\n    /* val_hi+val_lo ~ log10(1+f) + k*log10(2) */\n    val_hi = hi * IVLN10HI;\n    dk = k as f64;\n    y = dk * LOG10_2HI;\n    val_lo = dk * LOG10_2LO + (lo + hi) * IVLN10LO + lo * IVLN10HI;\n\n    /*\n     * Extra precision in for adding y is not strictly needed\n     * since there is no very large cancellation near x = sqrt(2) or\n     * x = 1/sqrt(2), but we do it anyway since it costs little on CPUs\n     * with some parallelism and it reduces the error for many args.\n     */\n    w = y + val_hi;\n    val_lo += (y - w) + val_hi;\n    val_hi = w;\n\n    val_lo + val_hi\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/log10f.rs",
    "sha256": "a25fd5ff50353c72e17dea41a2ebbe7db466c09fe53401508f7e80d2985bba9b",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_log10f.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/*\n * See comments in log10.c.\n */\n\nuse core::f32;\n\nconst IVLN10HI: f32 = 4.3432617188e-01; /* 0x3ede6000 */\nconst IVLN10LO: f32 = -3.1689971365e-05; /* 0xb804ead9 */\nconst LOG10_2HI: f32 = 3.0102920532e-01; /* 0x3e9a2080 */\nconst LOG10_2LO: f32 = 7.9034151668e-07; /* 0x355427db */\n/* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */\nconst LG1: f32 = 0.66666662693; /* 0xaaaaaa.0p-24 */\nconst LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */\nconst LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */\nconst LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */\n\n/// The base 10 logarithm of `x` (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn log10f(mut x: f32) -> f32 {\n    let x1p25f = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25\n\n    let mut ui: u32 = x.to_bits();\n    let hfsq: f32;\n    let f: f32;\n    let s: f32;\n    let z: f32;\n    let r: f32;\n    let w: f32;\n    let t1: f32;\n    let t2: f32;\n    let dk: f32;\n    let mut hi: f32;\n    let lo: f32;\n    let mut ix: u32;\n    let mut k: i32;\n\n    ix = ui;\n    k = 0;\n    if ix < 0x00800000 || (ix >> 31) > 0 {\n        /* x < 2**-126  */\n        if ix << 1 == 0 {\n            return -1. / (x * x); /* log(+-0)=-inf */\n        }\n        if (ix >> 31) > 0 {\n            return (x - x) / 0.0; /* log(-#) = NaN */\n        }\n        /* subnormal number, scale up x */\n        k -= 25;\n        x *= x1p25f;\n        ui = x.to_bits();\n        ix = ui;\n    } else if ix >= 0x7f800000 {\n        return x;\n    } else if ix == 0x3f800000 {\n        return 0.;\n    }\n\n    /* reduce x into [sqrt(2)/2, sqrt(2)] */\n    ix += 0x3f800000 - 0x3f3504f3;\n    k += (ix >> 23) as i32 - 0x7f;\n    ix = (ix & 0x007fffff) + 0x3f3504f3;\n    ui = ix;\n    x = f32::from_bits(ui);\n\n    f = x - 1.0;\n    s = f / (2.0 + f);\n    z = s * s;\n    w = z * z;\n    t1 = w * (LG2 + w * LG4);\n    t2 = z * (LG1 + w * LG3);\n    r = t2 + t1;\n    hfsq = 0.5 * f * f;\n\n    hi = f - hfsq;\n    ui = hi.to_bits();\n    ui &= 0xfffff000;\n    hi = f32::from_bits(ui);\n    lo = f - hi - hfsq + s * (hfsq + r);\n    dk = k as f32;\n    dk * LOG10_2LO + (lo + hi) * IVLN10LO + lo * IVLN10HI + hi * IVLN10HI + dk * LOG10_2HI\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/log1p.rs",
    "sha256": "e65b47f6e2f7dabf83b9a9de2a1eaf8008756adbde912c003d2eb1ed305a4a27",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_log1p.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/* double log1p(double x)\n * Return the natural logarithm of 1+x.\n *\n * Method :\n *   1. Argument Reduction: find k and f such that\n *                      1+x = 2^k * (1+f),\n *         where  sqrt(2)/2 < 1+f < sqrt(2) .\n *\n *      Note. If k=0, then f=x is exact. However, if k!=0, then f\n *      may not be representable exactly. In that case, a correction\n *      term is need. Let u=1+x rounded. Let c = (1+x)-u, then\n *      log(1+x) - log(u) ~ c/u. Thus, we proceed to compute log(u),\n *      and add back the correction term c/u.\n *      (Note: when x > 2**53, one can simply return log(x))\n *\n *   2. Approximation of log(1+f): See log.c\n *\n *   3. Finally, log1p(x) = k*ln2 + log(1+f) + c/u. See log.c\n *\n * Special cases:\n *      log1p(x) is NaN with signal if x < -1 (including -INF) ;\n *      log1p(+INF) is +INF; log1p(-1) is -INF with signal;\n *      log1p(NaN) is that NaN with no signal.\n *\n * Accuracy:\n *      according to an error analysis, the error is always less than\n *      1 ulp (unit in the last place).\n *\n * Constants:\n * The hexadecimal values are the intended ones for the following\n * constants. The decimal values may be used, provided that the\n * compiler will convert from decimal to binary accurately enough\n * to produce the hexadecimal values shown.\n *\n * Note: Assuming log() return accurate answer, the following\n *       algorithm can be used to compute log1p(x) to within a few ULP:\n *\n *              u = 1+x;\n *              if(u==1.0) return x ; else\n *                         return log(u)*(x/(u-1.0));\n *\n *       See HP-15C Advanced Functions Handbook, p.193.\n */\n\nuse core::f64;\n\nconst LN2_HI: f64 = 6.93147180369123816490e-01; /* 3fe62e42 fee00000 */\nconst LN2_LO: f64 = 1.90821492927058770002e-10; /* 3dea39ef 35793c76 */\nconst LG1: f64 = 6.666666666666735130e-01; /* 3FE55555 55555593 */\nconst LG2: f64 = 3.999999999940941908e-01; /* 3FD99999 9997FA04 */\nconst LG3: f64 = 2.857142874366239149e-01; /* 3FD24924 94229359 */\nconst LG4: f64 = 2.222219843214978396e-01; /* 3FCC71C5 1D8E78AF */\nconst LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */\nconst LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */\nconst LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */\n\n/// The natural logarithm of 1+`x` (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn log1p(x: f64) -> f64 {\n    let mut ui: u64 = x.to_bits();\n    let hfsq: f64;\n    let mut f: f64 = 0.;\n    let mut c: f64 = 0.;\n    let s: f64;\n    let z: f64;\n    let r: f64;\n    let w: f64;\n    let t1: f64;\n    let t2: f64;\n    let dk: f64;\n    let hx: u32;\n    let mut hu: u32;\n    let mut k: i32;\n\n    hx = (ui >> 32) as u32;\n    k = 1;\n    if hx < 0x3fda827a || (hx >> 31) > 0 {\n        /* 1+x < sqrt(2)+ */\n        if hx >= 0xbff00000 {\n            /* x <= -1.0 */\n            if x == -1. {\n                return x / 0.0; /* log1p(-1) = -inf */\n            }\n            return (x - x) / 0.0; /* log1p(x<-1) = NaN */\n        }\n        if hx << 1 < 0x3ca00000 << 1 {\n            /* |x| < 2**-53 */\n            /* underflow if subnormal */\n            if (hx & 0x7ff00000) == 0 {\n                force_eval!(x as f32);\n            }\n            return x;\n        }\n        if hx <= 0xbfd2bec4 {\n            /* sqrt(2)/2- <= 1+x < sqrt(2)+ */\n            k = 0;\n            c = 0.;\n            f = x;\n        }\n    } else if hx >= 0x7ff00000 {\n        return x;\n    }\n    if k > 0 {\n        ui = (1. + x).to_bits();\n        hu = (ui >> 32) as u32;\n        hu += 0x3ff00000 - 0x3fe6a09e;\n        k = (hu >> 20) as i32 - 0x3ff;\n        /* correction term ~ log(1+x)-log(u), avoid underflow in c/u */\n        if k < 54 {\n            c = if k >= 2 {\n                1. - (f64::from_bits(ui) - x)\n            } else {\n                x - (f64::from_bits(ui) - 1.)\n            };\n            c /= f64::from_bits(ui);\n        } else {\n            c = 0.;\n        }\n        /* reduce u into [sqrt(2)/2, sqrt(2)] */\n        hu = (hu & 0x000fffff) + 0x3fe6a09e;\n        ui = ((hu as u64) << 32) | (ui & 0xffffffff);\n        f = f64::from_bits(ui) - 1.;\n    }\n    hfsq = 0.5 * f * f;\n    s = f / (2.0 + f);\n    z = s * s;\n    w = z * z;\n    t1 = w * (LG2 + w * (LG4 + w * LG6));\n    t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7)));\n    r = t2 + t1;\n    dk = k as f64;\n    s * (hfsq + r) + (dk * LN2_LO + c) - hfsq + f + dk * LN2_HI\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/log1pf.rs",
    "sha256": "66c3ce3cea0d147055d63d14de1b78bcc865803331366b0c34f32d25e23b4e45",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_log1pf.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse core::f32;\n\nconst LN2_HI: f32 = 6.9313812256e-01; /* 0x3f317180 */\nconst LN2_LO: f32 = 9.0580006145e-06; /* 0x3717f7d1 */\n/* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */\nconst LG1: f32 = 0.66666662693; /* 0xaaaaaa.0p-24 */\nconst LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */\nconst LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */\nconst LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */\n\n/// The natural logarithm of 1+`x` (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn log1pf(x: f32) -> f32 {\n    let mut ui: u32 = x.to_bits();\n    let hfsq: f32;\n    let mut f: f32 = 0.;\n    let mut c: f32 = 0.;\n    let s: f32;\n    let z: f32;\n    let r: f32;\n    let w: f32;\n    let t1: f32;\n    let t2: f32;\n    let dk: f32;\n    let ix: u32;\n    let mut iu: u32;\n    let mut k: i32;\n\n    ix = ui;\n    k = 1;\n    if ix < 0x3ed413d0 || (ix >> 31) > 0 {\n        /* 1+x < sqrt(2)+  */\n        if ix >= 0xbf800000 {\n            /* x <= -1.0 */\n            if x == -1. {\n                return x / 0.0; /* log1p(-1)=+inf */\n            }\n            return (x - x) / 0.0; /* log1p(x<-1)=NaN */\n        }\n        if ix << 1 < 0x33800000 << 1 {\n            /* |x| < 2**-24 */\n            /* underflow if subnormal */\n            if (ix & 0x7f800000) == 0 {\n                force_eval!(x * x);\n            }\n            return x;\n        }\n        if ix <= 0xbe95f619 {\n            /* sqrt(2)/2- <= 1+x < sqrt(2)+ */\n            k = 0;\n            c = 0.;\n            f = x;\n        }\n    } else if ix >= 0x7f800000 {\n        return x;\n    }\n    if k > 0 {\n        ui = (1. + x).to_bits();\n        iu = ui;\n        iu += 0x3f800000 - 0x3f3504f3;\n        k = (iu >> 23) as i32 - 0x7f;\n        /* correction term ~ log(1+x)-log(u), avoid underflow in c/u */\n        if k < 25 {\n            c = if k >= 2 {\n                1. - (f32::from_bits(ui) - x)\n            } else {\n                x - (f32::from_bits(ui) - 1.)\n            };\n            c /= f32::from_bits(ui);\n        } else {\n            c = 0.;\n        }\n        /* reduce u into [sqrt(2)/2, sqrt(2)] */\n        iu = (iu & 0x007fffff) + 0x3f3504f3;\n        ui = iu;\n        f = f32::from_bits(ui) - 1.;\n    }\n    s = f / (2.0 + f);\n    z = s * s;\n    w = z * z;\n    t1 = w * (LG2 + w * LG4);\n    t2 = z * (LG1 + w * LG3);\n    r = t2 + t1;\n    hfsq = 0.5 * f * f;\n    dk = k as f32;\n    s * (hfsq + r) + (dk * LN2_LO + c) - hfsq + f + dk * LN2_HI\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/log2.rs",
    "sha256": "b68ef2ab36c010ae7a63756d07f34e36054ed4574a3b0f09b778e29dd9706a91",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_log2.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/*\n * Return the base 2 logarithm of x.  See log.c for most comments.\n *\n * Reduce x to 2^k (1+f) and calculate r = log(1+f) - f + f*f/2\n * as in log.c, then combine and scale in extra precision:\n *    log2(x) = (f - f*f/2 + r)/log(2) + k\n */\n\nuse core::f64;\n\nconst IVLN2HI: f64 = 1.44269504072144627571e+00; /* 0x3ff71547, 0x65200000 */\nconst IVLN2LO: f64 = 1.67517131648865118353e-10; /* 0x3de705fc, 0x2eefa200 */\nconst LG1: f64 = 6.666666666666735130e-01; /* 3FE55555 55555593 */\nconst LG2: f64 = 3.999999999940941908e-01; /* 3FD99999 9997FA04 */\nconst LG3: f64 = 2.857142874366239149e-01; /* 3FD24924 94229359 */\nconst LG4: f64 = 2.222219843214978396e-01; /* 3FCC71C5 1D8E78AF */\nconst LG5: f64 = 1.818357216161805012e-01; /* 3FC74664 96CB03DE */\nconst LG6: f64 = 1.531383769920937332e-01; /* 3FC39A09 D078C69F */\nconst LG7: f64 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */\n\n/// The base 2 logarithm of `x` (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn log2(mut x: f64) -> f64 {\n    let x1p54 = f64::from_bits(0x4350000000000000); // 0x1p54 === 2 ^ 54\n\n    let mut ui: u64 = x.to_bits();\n    let hfsq: f64;\n    let f: f64;\n    let s: f64;\n    let z: f64;\n    let r: f64;\n    let mut w: f64;\n    let t1: f64;\n    let t2: f64;\n    let y: f64;\n    let mut hi: f64;\n    let lo: f64;\n    let mut val_hi: f64;\n    let mut val_lo: f64;\n    let mut hx: u32;\n    let mut k: i32;\n\n    hx = (ui >> 32) as u32;\n    k = 0;\n    if hx < 0x00100000 || (hx >> 31) > 0 {\n        if ui << 1 == 0 {\n            return -1. / (x * x); /* log(+-0)=-inf */\n        }\n        if (hx >> 31) > 0 {\n            return (x - x) / 0.0; /* log(-#) = NaN */\n        }\n        /* subnormal number, scale x up */\n        k -= 54;\n        x *= x1p54;\n        ui = x.to_bits();\n        hx = (ui >> 32) as u32;\n    } else if hx >= 0x7ff00000 {\n        return x;\n    } else if hx == 0x3ff00000 && ui << 32 == 0 {\n        return 0.;\n    }\n\n    /* reduce x into [sqrt(2)/2, sqrt(2)] */\n    hx += 0x3ff00000 - 0x3fe6a09e;\n    k += (hx >> 20) as i32 - 0x3ff;\n    hx = (hx & 0x000fffff) + 0x3fe6a09e;\n    ui = ((hx as u64) << 32) | (ui & 0xffffffff);\n    x = f64::from_bits(ui);\n\n    f = x - 1.0;\n    hfsq = 0.5 * f * f;\n    s = f / (2.0 + f);\n    z = s * s;\n    w = z * z;\n    t1 = w * (LG2 + w * (LG4 + w * LG6));\n    t2 = z * (LG1 + w * (LG3 + w * (LG5 + w * LG7)));\n    r = t2 + t1;\n\n    /* hi+lo = f - hfsq + s*(hfsq+R) ~ log(1+f) */\n    hi = f - hfsq;\n    ui = hi.to_bits();\n    ui &= (-1i64 as u64) << 32;\n    hi = f64::from_bits(ui);\n    lo = f - hi - hfsq + s * (hfsq + r);\n\n    val_hi = hi * IVLN2HI;\n    val_lo = (lo + hi) * IVLN2LO + lo * IVLN2HI;\n\n    /* spadd(val_hi, val_lo, y), except for not using double_t: */\n    y = k.into();\n    w = y + val_hi;\n    val_lo += (y - w) + val_hi;\n    val_hi = w;\n\n    val_lo + val_hi\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/log2f.rs",
    "sha256": "56f0f7d3c8e112e8058d54e8d8a440e7ad3ec8d3584d59783c0e7a6b3e9b9215",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_log2f.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n/*\n * See comments in log2.c.\n */\n\nuse core::f32;\n\nconst IVLN2HI: f32 = 1.4428710938e+00; /* 0x3fb8b000 */\nconst IVLN2LO: f32 = -1.7605285393e-04; /* 0xb9389ad4 */\n/* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */\nconst LG1: f32 = 0.66666662693; /* 0xaaaaaa.0p-24 */\nconst LG2: f32 = 0.40000972152; /* 0xccce13.0p-25 */\nconst LG3: f32 = 0.28498786688; /* 0x91e9ee.0p-25 */\nconst LG4: f32 = 0.24279078841; /* 0xf89e26.0p-26 */\n\n/// The base 2 logarithm of `x` (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn log2f(mut x: f32) -> f32 {\n    let x1p25f = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25\n\n    let mut ui: u32 = x.to_bits();\n    let hfsq: f32;\n    let f: f32;\n    let s: f32;\n    let z: f32;\n    let r: f32;\n    let w: f32;\n    let t1: f32;\n    let t2: f32;\n    let mut hi: f32;\n    let lo: f32;\n    let mut ix: u32;\n    let mut k: i32;\n\n    ix = ui;\n    k = 0;\n    if ix < 0x00800000 || (ix >> 31) > 0 {\n        /* x < 2**-126  */\n        if ix << 1 == 0 {\n            return -1. / (x * x); /* log(+-0)=-inf */\n        }\n        if (ix >> 31) > 0 {\n            return (x - x) / 0.0; /* log(-#) = NaN */\n        }\n        /* subnormal number, scale up x */\n        k -= 25;\n        x *= x1p25f;\n        ui = x.to_bits();\n        ix = ui;\n    } else if ix >= 0x7f800000 {\n        return x;\n    } else if ix == 0x3f800000 {\n        return 0.;\n    }\n\n    /* reduce x into [sqrt(2)/2, sqrt(2)] */\n    ix += 0x3f800000 - 0x3f3504f3;\n    k += (ix >> 23) as i32 - 0x7f;\n    ix = (ix & 0x007fffff) + 0x3f3504f3;\n    ui = ix;\n    x = f32::from_bits(ui);\n\n    f = x - 1.0;\n    s = f / (2.0 + f);\n    z = s * s;\n    w = z * z;\n    t1 = w * (LG2 + w * LG4);\n    t2 = z * (LG1 + w * LG3);\n    r = t2 + t1;\n    hfsq = 0.5 * f * f;\n\n    hi = f - hfsq;\n    ui = hi.to_bits();\n    ui &= 0xfffff000;\n    hi = f32::from_bits(ui);\n    lo = f - hi - hfsq + s * (hfsq + r);\n    (lo + hi) * IVLN2LO + lo * IVLN2HI + hi * IVLN2HI + k as f32\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/logf.rs",
    "sha256": "a371279e4f713a8a25bdbeba96430ed537c6ac60cc4153cbc5f6e1872a341d3e",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_logf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nconst LN2_HI: f32 = 6.9313812256e-01; /* 0x3f317180 */\nconst LN2_LO: f32 = 9.0580006145e-06; /* 0x3717f7d1 */\n/* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */\nconst LG1: f32 = 0.66666662693; /*  0xaaaaaa.0p-24*/\nconst LG2: f32 = 0.40000972152; /*  0xccce13.0p-25 */\nconst LG3: f32 = 0.28498786688; /*  0x91e9ee.0p-25 */\nconst LG4: f32 = 0.24279078841; /*  0xf89e26.0p-26 */\n\n/// The natural logarithm of `x` (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn logf(mut x: f32) -> f32 {\n    let x1p25 = f32::from_bits(0x4c000000); // 0x1p25f === 2 ^ 25\n\n    let mut ix = x.to_bits();\n    let mut k = 0i32;\n\n    if (ix < 0x00800000) || ((ix >> 31) != 0) {\n        /* x < 2**-126  */\n        if ix << 1 == 0 {\n            return -1. / (x * x); /* log(+-0)=-inf */\n        }\n        if (ix >> 31) != 0 {\n            return (x - x) / 0.; /* log(-#) = NaN */\n        }\n        /* subnormal number, scale up x */\n        k -= 25;\n        x *= x1p25;\n        ix = x.to_bits();\n    } else if ix >= 0x7f800000 {\n        return x;\n    } else if ix == 0x3f800000 {\n        return 0.;\n    }\n\n    /* reduce x into [sqrt(2)/2, sqrt(2)] */\n    ix += 0x3f800000 - 0x3f3504f3;\n    k += ((ix >> 23) as i32) - 0x7f;\n    ix = (ix & 0x007fffff) + 0x3f3504f3;\n    x = f32::from_bits(ix);\n\n    let f = x - 1.;\n    let s = f / (2. + f);\n    let z = s * s;\n    let w = z * z;\n    let t1 = w * (LG2 + w * LG4);\n    let t2 = z * (LG1 + w * LG3);\n    let r = t2 + t1;\n    let hfsq = 0.5 * f * f;\n    let dk = k as f32;\n    s * (hfsq + r) + dk * LN2_LO - hfsq + f + dk * LN2_HI\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/pow.rs",
    "sha256": "2794a72e5d401e55d0d756bcbcc2844f723cf9530dcb3a5c3f443b1333295762",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_pow.c */\n/*\n * ====================================================\n * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.\n *\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\n// pow(x,y) return x**y\n//\n//                    n\n// Method:  Let x =  2   * (1+f)\n//      1. Compute and return log2(x) in two pieces:\n//              log2(x) = w1 + w2,\n//         where w1 has 53-24 = 29 bit trailing zeros.\n//      2. Perform y*log2(x) = n+y' by simulating multi-precision\n//         arithmetic, where |y'|<=0.5.\n//      3. Return x**y = 2**n*exp(y'*log2)\n//\n// Special cases:\n//      1.  (anything) ** 0  is 1\n//      2.  1 ** (anything)  is 1\n//      3.  (anything except 1) ** NAN is NAN\n//      4.  NAN ** (anything except 0) is NAN\n//      5.  +-(|x| > 1) **  +INF is +INF\n//      6.  +-(|x| > 1) **  -INF is +0\n//      7.  +-(|x| < 1) **  +INF is +0\n//      8.  +-(|x| < 1) **  -INF is +INF\n//      9.  -1          ** +-INF is 1\n//      10. +0 ** (+anything except 0, NAN)               is +0\n//      11. -0 ** (+anything except 0, NAN, odd integer)  is +0\n//      12. +0 ** (-anything except 0, NAN)               is +INF, raise divbyzero\n//      13. -0 ** (-anything except 0, NAN, odd integer)  is +INF, raise divbyzero\n//      14. -0 ** (+odd integer) is -0\n//      15. -0 ** (-odd integer) is -INF, raise divbyzero\n//      16. +INF ** (+anything except 0,NAN) is +INF\n//      17. +INF ** (-anything except 0,NAN) is +0\n//      18. -INF ** (+odd integer) is -INF\n//      19. -INF ** (anything) = -0 ** (-anything), (anything except odd integer)\n//      20. (anything) ** 1 is (anything)\n//      21. (anything) ** -1 is 1/(anything)\n//      22. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer)\n//      23. (-anything except 0 and inf) ** (non-integer) is NAN\n//\n// Accuracy:\n//      pow(x,y) returns x**y nearly rounded. In particular\n//                      pow(integer,integer)\n//      always returns the correct integer provided it is\n//      representable.\n//\n// Constants :\n// The hexadecimal values are the intended ones for the following\n// constants. The decimal values may be used, provided that the\n// compiler will convert from decimal to binary accurately enough\n// to produce the hexadecimal values shown.\n//\nuse super::{fabs, get_high_word, scalbn, sqrt, with_set_high_word, with_set_low_word};\n\nconst BP: [f64; 2] = [1.0, 1.5];\nconst DP_H: [f64; 2] = [0.0, 5.84962487220764160156e-01]; /* 0x3fe2b803_40000000 */\nconst DP_L: [f64; 2] = [0.0, 1.35003920212974897128e-08]; /* 0x3E4CFDEB, 0x43CFD006 */\nconst TWO53: f64 = 9007199254740992.0; /* 0x43400000_00000000 */\nconst HUGE: f64 = 1.0e300;\nconst TINY: f64 = 1.0e-300;\n\n// poly coefs for (3/2)*(log(x)-2s-2/3*s**3:\nconst L1: f64 = 5.99999999999994648725e-01; /* 0x3fe33333_33333303 */\nconst L2: f64 = 4.28571428578550184252e-01; /* 0x3fdb6db6_db6fabff */\nconst L3: f64 = 3.33333329818377432918e-01; /* 0x3fd55555_518f264d */\nconst L4: f64 = 2.72728123808534006489e-01; /* 0x3fd17460_a91d4101 */\nconst L5: f64 = 2.30660745775561754067e-01; /* 0x3fcd864a_93c9db65 */\nconst L6: f64 = 2.06975017800338417784e-01; /* 0x3fca7e28_4a454eef */\nconst P1: f64 = 1.66666666666666019037e-01; /* 0x3fc55555_5555553e */\nconst P2: f64 = -2.77777777770155933842e-03; /* 0xbf66c16c_16bebd93 */\nconst P3: f64 = 6.61375632143793436117e-05; /* 0x3f11566a_af25de2c */\nconst P4: f64 = -1.65339022054652515390e-06; /* 0xbebbbd41_c5d26bf1 */\nconst P5: f64 = 4.13813679705723846039e-08; /* 0x3e663769_72bea4d0 */\nconst LG2: f64 = 6.93147180559945286227e-01; /* 0x3fe62e42_fefa39ef */\nconst LG2_H: f64 = 6.93147182464599609375e-01; /* 0x3fe62e43_00000000 */\nconst LG2_L: f64 = -1.90465429995776804525e-09; /* 0xbe205c61_0ca86c39 */\nconst OVT: f64 = 8.0085662595372944372e-017; /* -(1024-log2(ovfl+.5ulp)) */\nconst CP: f64 = 9.61796693925975554329e-01; /* 0x3feec709_dc3a03fd =2/(3ln2) */\nconst CP_H: f64 = 9.61796700954437255859e-01; /* 0x3feec709_e0000000 =(float)cp */\nconst CP_L: f64 = -7.02846165095275826516e-09; /* 0xbe3e2fe0_145b01f5 =tail of cp_h*/\nconst IVLN2: f64 = 1.44269504088896338700e+00; /* 0x3ff71547_652b82fe =1/ln2 */\nconst IVLN2_H: f64 = 1.44269502162933349609e+00; /* 0x3ff71547_60000000 =24b 1/ln2*/\nconst IVLN2_L: f64 = 1.92596299112661746887e-08; /* 0x3e54ae0b_f85ddf44 =1/ln2 tail*/\n\n/// Returns `x` to the power of `y` (f64).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn pow(x: f64, y: f64) -> f64 {\n    let t1: f64;\n    let t2: f64;\n\n    let (hx, lx): (i32, u32) = ((x.to_bits() >> 32) as i32, x.to_bits() as u32);\n    let (hy, ly): (i32, u32) = ((y.to_bits() >> 32) as i32, y.to_bits() as u32);\n\n    let mut ix: i32 = hx & 0x7fffffff_i32;\n    let iy: i32 = hy & 0x7fffffff_i32;\n\n    /* x**0 = 1, even if x is NaN */\n    if ((iy as u32) | ly) == 0 {\n        return 1.0;\n    }\n\n    /* 1**y = 1, even if y is NaN */\n    if hx == 0x3ff00000 && lx == 0 {\n        return 1.0;\n    }\n\n    /* NaN if either arg is NaN */\n    if ix > 0x7ff00000\n        || (ix == 0x7ff00000 && lx != 0)\n        || iy > 0x7ff00000\n        || (iy == 0x7ff00000 && ly != 0)\n    {\n        return x + y;\n    }\n\n    /* determine if y is an odd int when x < 0\n     * yisint = 0       ... y is not an integer\n     * yisint = 1       ... y is an odd int\n     * yisint = 2       ... y is an even int\n     */\n    let mut yisint: i32 = 0;\n    let mut k: i32;\n    let mut j: i32;\n    if hx < 0 {\n        if iy >= 0x43400000 {\n            yisint = 2; /* even integer y */\n        } else if iy >= 0x3ff00000 {\n            k = (iy >> 20) - 0x3ff; /* exponent */\n\n            if k > 20 {\n                j = (ly >> (52 - k)) as i32;\n\n                if (j << (52 - k)) == (ly as i32) {\n                    yisint = 2 - (j & 1);\n                }\n            } else if ly == 0 {\n                j = iy >> (20 - k);\n\n                if (j << (20 - k)) == iy {\n                    yisint = 2 - (j & 1);\n                }\n            }\n        }\n    }\n\n    if ly == 0 {\n        /* special value of y */\n        if iy == 0x7ff00000 {\n            /* y is +-inf */\n\n            return if ((ix - 0x3ff00000) | (lx as i32)) == 0 {\n                /* (-1)**+-inf is 1 */\n                1.0\n            } else if ix >= 0x3ff00000 {\n                /* (|x|>1)**+-inf = inf,0 */\n                if hy >= 0 { y } else { 0.0 }\n            } else {\n                /* (|x|<1)**+-inf = 0,inf */\n                if hy >= 0 { 0.0 } else { -y }\n            };\n        }\n\n        if iy == 0x3ff00000 {\n            /* y is +-1 */\n            return if hy >= 0 { x } else { 1.0 / x };\n        }\n\n        if hy == 0x40000000 {\n            /* y is 2 */\n            return x * x;\n        }\n\n        if hy == 0x3fe00000 {\n            /* y is 0.5 */\n            if hx >= 0 {\n                /* x >= +0 */\n                return sqrt(x);\n            }\n        }\n    }\n\n    let mut ax: f64 = fabs(x);\n    if lx == 0 {\n        /* special value of x */\n        if ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000 {\n            /* x is +-0,+-inf,+-1 */\n            let mut z: f64 = ax;\n\n            if hy < 0 {\n                /* z = (1/|x|) */\n                z = 1.0 / z;\n            }\n\n            if hx < 0 {\n                if ((ix - 0x3ff00000) | yisint) == 0 {\n                    z = (z - z) / (z - z); /* (-1)**non-int is NaN */\n                } else if yisint == 1 {\n                    z = -z; /* (x<0)**odd = -(|x|**odd) */\n                }\n            }\n\n            return z;\n        }\n    }\n\n    let mut s: f64 = 1.0; /* sign of result */\n    if hx < 0 {\n        if yisint == 0 {\n            /* (x<0)**(non-int) is NaN */\n            return (x - x) / (x - x);\n        }\n\n        if yisint == 1 {\n            /* (x<0)**(odd int) */\n            s = -1.0;\n        }\n    }\n\n    /* |y| is HUGE */\n    if iy > 0x41e00000 {\n        /* if |y| > 2**31 */\n        if iy > 0x43f00000 {\n            /* if |y| > 2**64, must o/uflow */\n            if ix <= 0x3fefffff {\n                return if hy < 0 { HUGE * HUGE } else { TINY * TINY };\n            }\n\n            if ix >= 0x3ff00000 {\n                return if hy > 0 { HUGE * HUGE } else { TINY * TINY };\n            }\n        }\n\n        /* over/underflow if x is not close to one */\n        if ix < 0x3fefffff {\n            return if hy < 0 {\n                s * HUGE * HUGE\n            } else {\n                s * TINY * TINY\n            };\n        }\n        if ix > 0x3ff00000 {\n            return if hy > 0 {\n                s * HUGE * HUGE\n            } else {\n                s * TINY * TINY\n            };\n        }\n\n        /* now |1-x| is TINY <= 2**-20, suffice to compute\n        log(x) by x-x^2/2+x^3/3-x^4/4 */\n        let t: f64 = ax - 1.0; /* t has 20 trailing zeros */\n        let w: f64 = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25));\n        let u: f64 = IVLN2_H * t; /* ivln2_h has 21 sig. bits */\n        let v: f64 = t * IVLN2_L - w * IVLN2;\n        t1 = with_set_low_word(u + v, 0);\n        t2 = v - (t1 - u);\n    } else {\n        // double ss,s2,s_h,s_l,t_h,t_l;\n        let mut n: i32 = 0;\n\n        if ix < 0x00100000 {\n            /* take care subnormal number */\n            ax *= TWO53;\n            n -= 53;\n            ix = get_high_word(ax) as i32;\n        }\n\n        n += (ix >> 20) - 0x3ff;\n        j = ix & 0x000fffff;\n\n        /* determine interval */\n        let k: i32;\n        ix = j | 0x3ff00000; /* normalize ix */\n        if j <= 0x3988E {\n            /* |x|<sqrt(3/2) */\n            k = 0;\n        } else if j < 0xBB67A {\n            /* |x|<sqrt(3)   */\n            k = 1;\n        } else {\n            k = 0;\n            n += 1;\n            ix -= 0x00100000;\n        }\n        ax = with_set_high_word(ax, ix as u32);\n\n        /* compute ss = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */\n        let u: f64 = ax - i!(BP, k as usize); /* bp[0]=1.0, bp[1]=1.5 */\n        let v: f64 = 1.0 / (ax + i!(BP, k as usize));\n        let ss: f64 = u * v;\n        let s_h = with_set_low_word(ss, 0);\n\n        /* t_h=ax+bp[k] High */\n        let t_h: f64 = with_set_high_word(\n            0.0,\n            ((ix as u32 >> 1) | 0x20000000) + 0x00080000 + ((k as u32) << 18),\n        );\n        let t_l: f64 = ax - (t_h - i!(BP, k as usize));\n        let s_l: f64 = v * ((u - s_h * t_h) - s_h * t_l);\n\n        /* compute log(ax) */\n        let s2: f64 = ss * ss;\n        let mut r: f64 = s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6)))));\n        r += s_l * (s_h + ss);\n        let s2: f64 = s_h * s_h;\n        let t_h: f64 = with_set_low_word(3.0 + s2 + r, 0);\n        let t_l: f64 = r - ((t_h - 3.0) - s2);\n\n        /* u+v = ss*(1+...) */\n        let u: f64 = s_h * t_h;\n        let v: f64 = s_l * t_h + t_l * ss;\n\n        /* 2/(3log2)*(ss+...) */\n        let p_h: f64 = with_set_low_word(u + v, 0);\n        let p_l = v - (p_h - u);\n        let z_h: f64 = CP_H * p_h; /* cp_h+cp_l = 2/(3*log2) */\n        let z_l: f64 = CP_L * p_h + p_l * CP + i!(DP_L, k as usize);\n\n        /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */\n        let t: f64 = n as f64;\n        t1 = with_set_low_word(((z_h + z_l) + i!(DP_H, k as usize)) + t, 0);\n        t2 = z_l - (((t1 - t) - i!(DP_H, k as usize)) - z_h);\n    }\n\n    /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */\n    let y1: f64 = with_set_low_word(y, 0);\n    let p_l: f64 = (y - y1) * t1 + y * t2;\n    let mut p_h: f64 = y1 * t1;\n    let z: f64 = p_l + p_h;\n    let mut j: i32 = (z.to_bits() >> 32) as i32;\n    let i: i32 = z.to_bits() as i32;\n    // let (j, i): (i32, i32) = ((z.to_bits() >> 32) as i32, z.to_bits() as i32);\n\n    if j >= 0x40900000 {\n        /* z >= 1024 */\n        if (j - 0x40900000) | i != 0 {\n            /* if z > 1024 */\n            return s * HUGE * HUGE; /* overflow */\n        }\n\n        if p_l + OVT > z - p_h {\n            return s * HUGE * HUGE; /* overflow */\n        }\n    } else if (j & 0x7fffffff) >= 0x4090cc00 {\n        /* z <= -1075 */\n        // FIXME: instead of abs(j) use unsigned j\n\n        if (((j as u32) - 0xc090cc00) | (i as u32)) != 0 {\n            /* z < -1075 */\n            return s * TINY * TINY; /* underflow */\n        }\n\n        if p_l <= z - p_h {\n            return s * TINY * TINY; /* underflow */\n        }\n    }\n\n    /* compute 2**(p_h+p_l) */\n    let i: i32 = j & 0x7fffffff_i32;\n    k = (i >> 20) - 0x3ff;\n    let mut n: i32 = 0;\n\n    if i > 0x3fe00000 {\n        /* if |z| > 0.5, set n = [z+0.5] */\n        n = j + (0x00100000 >> (k + 1));\n        k = ((n & 0x7fffffff) >> 20) - 0x3ff; /* new k for n */\n        let t: f64 = with_set_high_word(0.0, (n & !(0x000fffff >> k)) as u32);\n        n = ((n & 0x000fffff) | 0x00100000) >> (20 - k);\n        if j < 0 {\n            n = -n;\n        }\n        p_h -= t;\n    }\n\n    let t: f64 = with_set_low_word(p_l + p_h, 0);\n    let u: f64 = t * LG2_H;\n    let v: f64 = (p_l - (t - p_h)) * LG2 + t * LG2_L;\n    let mut z: f64 = u + v;\n    let w: f64 = v - (z - u);\n    let t: f64 = z * z;\n    let t1: f64 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));\n    let r: f64 = (z * t1) / (t1 - 2.0) - (w + z * w);\n    z = 1.0 - (r - z);\n    j = get_high_word(z) as i32;\n    j += n << 20;\n\n    if (j >> 20) <= 0 {\n        /* subnormal output */\n        z = scalbn(z, n);\n    } else {\n        z = with_set_high_word(z, j as u32);\n    }\n\n    s * z\n}\n\n#[cfg(test)]\nmod tests {\n    extern crate core;\n\n    use self::core::f64::consts::{E, PI};\n    use super::pow;\n\n    const POS_ZERO: &[f64] = &[0.0];\n    const NEG_ZERO: &[f64] = &[-0.0];\n    const POS_ONE: &[f64] = &[1.0];\n    const NEG_ONE: &[f64] = &[-1.0];\n    const POS_FLOATS: &[f64] = &[99.0 / 70.0, E, PI];\n    const NEG_FLOATS: &[f64] = &[-99.0 / 70.0, -E, -PI];\n    const POS_SMALL_FLOATS: &[f64] = &[(1.0 / 2.0), f64::MIN_POSITIVE, f64::EPSILON];\n    const NEG_SMALL_FLOATS: &[f64] = &[-(1.0 / 2.0), -f64::MIN_POSITIVE, -f64::EPSILON];\n    const POS_EVENS: &[f64] = &[2.0, 6.0, 8.0, 10.0, 22.0, 100.0, f64::MAX];\n    const NEG_EVENS: &[f64] = &[f64::MIN, -100.0, -22.0, -10.0, -8.0, -6.0, -2.0];\n    const POS_ODDS: &[f64] = &[3.0, 7.0];\n    const NEG_ODDS: &[f64] = &[-7.0, -3.0];\n    const NANS: &[f64] = &[f64::NAN];\n    const POS_INF: &[f64] = &[f64::INFINITY];\n    const NEG_INF: &[f64] = &[f64::NEG_INFINITY];\n\n    const ALL: &[&[f64]] = &[\n        POS_ZERO,\n        NEG_ZERO,\n        NANS,\n        NEG_SMALL_FLOATS,\n        POS_SMALL_FLOATS,\n        NEG_FLOATS,\n        POS_FLOATS,\n        NEG_EVENS,\n        POS_EVENS,\n        NEG_ODDS,\n        POS_ODDS,\n        NEG_INF,\n        POS_INF,\n        NEG_ONE,\n        POS_ONE,\n    ];\n    const POS: &[&[f64]] = &[POS_ZERO, POS_ODDS, POS_ONE, POS_FLOATS, POS_EVENS, POS_INF];\n    const NEG: &[&[f64]] = &[NEG_ZERO, NEG_ODDS, NEG_ONE, NEG_FLOATS, NEG_EVENS, NEG_INF];\n\n    fn pow_test(base: f64, exponent: f64, expected: f64) {\n        let res = pow(base, exponent);\n        assert!(\n            if expected.is_nan() {\n                res.is_nan()\n            } else {\n                pow(base, exponent) == expected\n            },\n            \"{base} ** {exponent} was {res} instead of {expected}\",\n        );\n    }\n\n    fn test_sets_as_base(sets: &[&[f64]], exponent: f64, expected: f64) {\n        sets.iter()\n            .for_each(|s| s.iter().for_each(|val| pow_test(*val, exponent, expected)));\n    }\n\n    fn test_sets_as_exponent(base: f64, sets: &[&[f64]], expected: f64) {\n        sets.iter()\n            .for_each(|s| s.iter().for_each(|val| pow_test(base, *val, expected)));\n    }\n\n    fn test_sets(sets: &[&[f64]], computed: &dyn Fn(f64) -> f64, expected: &dyn Fn(f64) -> f64) {\n        sets.iter().for_each(|s| {\n            s.iter().for_each(|val| {\n                let exp = expected(*val);\n                let res = computed(*val);\n\n                #[cfg(all(target_arch = \"x86\", not(target_feature = \"sse2\")))]\n                let exp = force_eval!(exp);\n                #[cfg(all(target_arch = \"x86\", not(target_feature = \"sse2\")))]\n                let res = force_eval!(res);\n                assert!(\n                    if exp.is_nan() {\n                        res.is_nan()\n                    } else {\n                        exp == res\n                    },\n                    \"test for {val} was {res} instead of {exp}\",\n                );\n            })\n        });\n    }\n\n    #[test]\n    fn zero_as_exponent() {\n        test_sets_as_base(ALL, 0.0, 1.0);\n        test_sets_as_base(ALL, -0.0, 1.0);\n    }\n\n    #[test]\n    fn one_as_base() {\n        test_sets_as_exponent(1.0, ALL, 1.0);\n    }\n\n    #[test]\n    fn nan_inputs() {\n        // NAN as the base:\n        // (f64::NAN ^ anything *but 0* should be f64::NAN)\n        test_sets_as_exponent(f64::NAN, &ALL[2..], f64::NAN);\n\n        // f64::NAN as the exponent:\n        // (anything *but 1* ^ f64::NAN should be f64::NAN)\n        test_sets_as_base(&ALL[..(ALL.len() - 2)], f64::NAN, f64::NAN);\n    }\n\n    #[test]\n    fn infinity_as_base() {\n        // Positive Infinity as the base:\n        // (+Infinity ^ positive anything but 0 and f64::NAN should be +Infinity)\n        test_sets_as_exponent(f64::INFINITY, &POS[1..], f64::INFINITY);\n\n        // (+Infinity ^ negative anything except 0 and f64::NAN should be 0.0)\n        test_sets_as_exponent(f64::INFINITY, &NEG[1..], 0.0);\n\n        // Negative Infinity as the base:\n        // (-Infinity ^ positive odd ints should be -Infinity)\n        test_sets_as_exponent(f64::NEG_INFINITY, &[POS_ODDS], f64::NEG_INFINITY);\n\n        // (-Infinity ^ anything but odd ints should be == -0 ^ (-anything))\n        // We can lump in pos/neg odd ints here because they don't seem to\n        // cause panics (div by zero) in release mode (I think).\n        test_sets(ALL, &|v: f64| pow(f64::NEG_INFINITY, v), &|v: f64| {\n            pow(-0.0, -v)\n        });\n    }\n\n    #[test]\n    fn infinity_as_exponent() {\n        // Positive/Negative base greater than 1:\n        // (pos/neg > 1 ^ Infinity should be Infinity - note this excludes f64::NAN as the base)\n        test_sets_as_base(&ALL[5..(ALL.len() - 2)], f64::INFINITY, f64::INFINITY);\n\n        // (pos/neg > 1 ^ -Infinity should be 0.0)\n        test_sets_as_base(&ALL[5..ALL.len() - 2], f64::NEG_INFINITY, 0.0);\n\n        // Positive/Negative base less than 1:\n        let base_below_one = &[POS_ZERO, NEG_ZERO, NEG_SMALL_FLOATS, POS_SMALL_FLOATS];\n\n        // (pos/neg < 1 ^ Infinity should be 0.0 - this also excludes f64::NAN as the base)\n        test_sets_as_base(base_below_one, f64::INFINITY, 0.0);\n\n        // (pos/neg < 1 ^ -Infinity should be Infinity)\n        test_sets_as_base(base_below_one, f64::NEG_INFINITY, f64::INFINITY);\n\n        // Positive/Negative 1 as the base:\n        // (pos/neg 1 ^ Infinity should be 1)\n        test_sets_as_base(&[NEG_ONE, POS_ONE], f64::INFINITY, 1.0);\n\n        // (pos/neg 1 ^ -Infinity should be 1)\n        test_sets_as_base(&[NEG_ONE, POS_ONE], f64::NEG_INFINITY, 1.0);\n    }\n\n    #[test]\n    fn zero_as_base() {\n        // Positive Zero as the base:\n        // (+0 ^ anything positive but 0 and f64::NAN should be +0)\n        test_sets_as_exponent(0.0, &POS[1..], 0.0);\n\n        // (+0 ^ anything negative but 0 and f64::NAN should be Infinity)\n        // (this should panic because we're dividing by zero)\n        test_sets_as_exponent(0.0, &NEG[1..], f64::INFINITY);\n\n        // Negative Zero as the base:\n        // (-0 ^ anything positive but 0, f64::NAN, and odd ints should be +0)\n        test_sets_as_exponent(-0.0, &POS[3..], 0.0);\n\n        // (-0 ^ anything negative but 0, f64::NAN, and odd ints should be Infinity)\n        // (should panic because of divide by zero)\n        test_sets_as_exponent(-0.0, &NEG[3..], f64::INFINITY);\n\n        // (-0 ^ positive odd ints should be -0)\n        test_sets_as_exponent(-0.0, &[POS_ODDS], -0.0);\n\n        // (-0 ^ negative odd ints should be -Infinity)\n        // (should panic because of divide by zero)\n        test_sets_as_exponent(-0.0, &[NEG_ODDS], f64::NEG_INFINITY);\n    }\n\n    #[test]\n    fn special_cases() {\n        // One as the exponent:\n        // (anything ^ 1 should be anything - i.e. the base)\n        test_sets(ALL, &|v: f64| pow(v, 1.0), &|v: f64| v);\n\n        // Negative One as the exponent:\n        // (anything ^ -1 should be 1/anything)\n        test_sets(ALL, &|v: f64| pow(v, -1.0), &|v: f64| 1.0 / v);\n\n        // Factoring -1 out:\n        // (negative anything ^ integer should be (-1 ^ integer) * (positive anything ^ integer))\n        [POS_ZERO, NEG_ZERO, POS_ONE, NEG_ONE, POS_EVENS, NEG_EVENS]\n            .iter()\n            .for_each(|int_set| {\n                int_set.iter().for_each(|int| {\n                    test_sets(ALL, &|v: f64| pow(-v, *int), &|v: f64| {\n                        pow(-1.0, *int) * pow(v, *int)\n                    });\n                })\n            });\n\n        // Negative base (imaginary results):\n        // (-anything except 0 and Infinity ^ non-integer should be NAN)\n        NEG[1..(NEG.len() - 1)].iter().for_each(|set| {\n            set.iter().for_each(|val| {\n                test_sets(&ALL[3..7], &|v: f64| pow(*val, v), &|_| f64::NAN);\n            })\n        });\n    }\n\n    #[test]\n    fn normal_cases() {\n        assert_eq!(pow(2.0, 20.0), (1 << 20) as f64);\n        assert_eq!(pow(-1.0, 9.0), -1.0);\n        assert!(pow(-1.0, 2.2).is_nan());\n        assert!(pow(-1.0, -1.14).is_nan());\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/powf.rs",
    "sha256": "c6b057433038fda1104bd585155d9106b8eb8eb24951c11774874ad6fe449256",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_powf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse core::cmp::Ordering;\n\nuse super::{fabsf, scalbnf, sqrtf};\n\nconst BP: [f32; 2] = [1.0, 1.5];\nconst DP_H: [f32; 2] = [0.0, 5.84960938e-01]; /* 0x3f15c000 */\nconst DP_L: [f32; 2] = [0.0, 1.56322085e-06]; /* 0x35d1cfdc */\nconst TWO24: f32 = 16777216.0; /* 0x4b800000 */\nconst HUGE: f32 = 1.0e30;\nconst TINY: f32 = 1.0e-30;\nconst L1: f32 = 6.0000002384e-01; /* 0x3f19999a */\nconst L2: f32 = 4.2857143283e-01; /* 0x3edb6db7 */\nconst L3: f32 = 3.3333334327e-01; /* 0x3eaaaaab */\nconst L4: f32 = 2.7272811532e-01; /* 0x3e8ba305 */\nconst L5: f32 = 2.3066075146e-01; /* 0x3e6c3255 */\nconst L6: f32 = 2.0697501302e-01; /* 0x3e53f142 */\nconst P1: f32 = 1.6666667163e-01; /* 0x3e2aaaab */\nconst P2: f32 = -2.7777778450e-03; /* 0xbb360b61 */\nconst P3: f32 = 6.6137559770e-05; /* 0x388ab355 */\nconst P4: f32 = -1.6533901999e-06; /* 0xb5ddea0e */\nconst P5: f32 = 4.1381369442e-08; /* 0x3331bb4c */\nconst LG2: f32 = 6.9314718246e-01; /* 0x3f317218 */\nconst LG2_H: f32 = 6.93145752e-01; /* 0x3f317200 */\nconst LG2_L: f32 = 1.42860654e-06; /* 0x35bfbe8c */\nconst OVT: f32 = 4.2995665694e-08; /* -(128-log2(ovfl+.5ulp)) */\nconst CP: f32 = 9.6179670095e-01; /* 0x3f76384f =2/(3ln2) */\nconst CP_H: f32 = 9.6191406250e-01; /* 0x3f764000 =12b cp */\nconst CP_L: f32 = -1.1736857402e-04; /* 0xb8f623c6 =tail of cp_h */\nconst IVLN2: f32 = 1.4426950216e+00;\nconst IVLN2_H: f32 = 1.4426879883e+00;\nconst IVLN2_L: f32 = 7.0526075433e-06;\n\n/// Returns `x` to the power of `y` (f32).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn powf(x: f32, y: f32) -> f32 {\n    let mut z: f32;\n    let mut ax: f32;\n    let z_h: f32;\n    let z_l: f32;\n    let mut p_h: f32;\n    let mut p_l: f32;\n    let y1: f32;\n    let mut t1: f32;\n    let t2: f32;\n    let mut r: f32;\n    let s: f32;\n    let mut sn: f32;\n    let mut t: f32;\n    let mut u: f32;\n    let mut v: f32;\n    let mut w: f32;\n    let i: i32;\n    let mut j: i32;\n    let mut k: i32;\n    let mut yisint: i32;\n    let mut n: i32;\n    let hx: i32;\n    let hy: i32;\n    let mut ix: i32;\n    let iy: i32;\n    let mut is: i32;\n\n    hx = x.to_bits() as i32;\n    hy = y.to_bits() as i32;\n\n    ix = hx & 0x7fffffff;\n    iy = hy & 0x7fffffff;\n\n    /* x**0 = 1, even if x is NaN */\n    if iy == 0 {\n        return 1.0;\n    }\n\n    /* 1**y = 1, even if y is NaN */\n    if hx == 0x3f800000 {\n        return 1.0;\n    }\n\n    /* NaN if either arg is NaN */\n    if ix > 0x7f800000 || iy > 0x7f800000 {\n        return x + y;\n    }\n\n    /* determine if y is an odd int when x < 0\n     * yisint = 0       ... y is not an integer\n     * yisint = 1       ... y is an odd int\n     * yisint = 2       ... y is an even int\n     */\n    yisint = 0;\n    if hx < 0 {\n        if iy >= 0x4b800000 {\n            yisint = 2; /* even integer y */\n        } else if iy >= 0x3f800000 {\n            k = (iy >> 23) - 0x7f; /* exponent */\n            j = iy >> (23 - k);\n            if (j << (23 - k)) == iy {\n                yisint = 2 - (j & 1);\n            }\n        }\n    }\n\n    /* special value of y */\n    if iy == 0x7f800000 {\n        /* y is +-inf */\n        match ix.cmp(&0x3f800000) {\n            /* (-1)**+-inf is 1 */\n            Ordering::Equal => return 1.0,\n            /* (|x|>1)**+-inf = inf,0 */\n            Ordering::Greater => return if hy >= 0 { y } else { 0.0 },\n            /* (|x|<1)**+-inf = 0,inf */\n            Ordering::Less => return if hy >= 0 { 0.0 } else { -y },\n        }\n    }\n    if iy == 0x3f800000 {\n        /* y is +-1 */\n        return if hy >= 0 { x } else { 1.0 / x };\n    }\n\n    if hy == 0x40000000 {\n        /* y is 2 */\n        return x * x;\n    }\n\n    if hy == 0x3f000000\n       /* y is  0.5 */\n       && hx >= 0\n    {\n        /* x >= +0 */\n        return sqrtf(x);\n    }\n\n    ax = fabsf(x);\n    /* special value of x */\n    if ix == 0x7f800000 || ix == 0 || ix == 0x3f800000 {\n        /* x is +-0,+-inf,+-1 */\n        z = ax;\n        if hy < 0 {\n            /* z = (1/|x|) */\n            z = 1.0 / z;\n        }\n\n        if hx < 0 {\n            if ((ix - 0x3f800000) | yisint) == 0 {\n                z = (z - z) / (z - z); /* (-1)**non-int is NaN */\n            } else if yisint == 1 {\n                z = -z; /* (x<0)**odd = -(|x|**odd) */\n            }\n        }\n        return z;\n    }\n\n    sn = 1.0; /* sign of result */\n    if hx < 0 {\n        if yisint == 0 {\n            /* (x<0)**(non-int) is NaN */\n            return (x - x) / (x - x);\n        }\n\n        if yisint == 1 {\n            /* (x<0)**(odd int) */\n            sn = -1.0;\n        }\n    }\n\n    /* |y| is HUGE */\n    if iy > 0x4d000000 {\n        /* if |y| > 2**27 */\n        /* over/underflow if x is not close to one */\n        if ix < 0x3f7ffff8 {\n            return if hy < 0 {\n                sn * HUGE * HUGE\n            } else {\n                sn * TINY * TINY\n            };\n        }\n\n        if ix > 0x3f800007 {\n            return if hy > 0 {\n                sn * HUGE * HUGE\n            } else {\n                sn * TINY * TINY\n            };\n        }\n\n        /* now |1-x| is TINY <= 2**-20, suffice to compute\n        log(x) by x-x^2/2+x^3/3-x^4/4 */\n        t = ax - 1.; /* t has 20 trailing zeros */\n        w = (t * t) * (0.5 - t * (0.333333333333 - t * 0.25));\n        u = IVLN2_H * t; /* IVLN2_H has 16 sig. bits */\n        v = t * IVLN2_L - w * IVLN2;\n        t1 = u + v;\n        is = t1.to_bits() as i32;\n        t1 = f32::from_bits(is as u32 & 0xfffff000);\n        t2 = v - (t1 - u);\n    } else {\n        let mut s2: f32;\n        let mut s_h: f32;\n        let s_l: f32;\n        let mut t_h: f32;\n        let mut t_l: f32;\n\n        n = 0;\n        /* take care subnormal number */\n        if ix < 0x00800000 {\n            ax *= TWO24;\n            n -= 24;\n            ix = ax.to_bits() as i32;\n        }\n        n += ((ix) >> 23) - 0x7f;\n        j = ix & 0x007fffff;\n        /* determine interval */\n        ix = j | 0x3f800000; /* normalize ix */\n        if j <= 0x1cc471 {\n            /* |x|<sqrt(3/2) */\n            k = 0;\n        } else if j < 0x5db3d7 {\n            /* |x|<sqrt(3)   */\n            k = 1;\n        } else {\n            k = 0;\n            n += 1;\n            ix -= 0x00800000;\n        }\n        ax = f32::from_bits(ix as u32);\n\n        /* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */\n        u = ax - i!(BP, k as usize); /* bp[0]=1.0, bp[1]=1.5 */\n        v = 1.0 / (ax + i!(BP, k as usize));\n        s = u * v;\n        s_h = s;\n        is = s_h.to_bits() as i32;\n        s_h = f32::from_bits(is as u32 & 0xfffff000);\n        /* t_h=ax+bp[k] High */\n        is = (((ix as u32 >> 1) & 0xfffff000) | 0x20000000) as i32;\n        t_h = f32::from_bits(is as u32 + 0x00400000 + ((k as u32) << 21));\n        t_l = ax - (t_h - i!(BP, k as usize));\n        s_l = v * ((u - s_h * t_h) - s_h * t_l);\n        /* compute log(ax) */\n        s2 = s * s;\n        r = s2 * s2 * (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6)))));\n        r += s_l * (s_h + s);\n        s2 = s_h * s_h;\n        t_h = 3.0 + s2 + r;\n        is = t_h.to_bits() as i32;\n        t_h = f32::from_bits(is as u32 & 0xfffff000);\n        t_l = r - ((t_h - 3.0) - s2);\n        /* u+v = s*(1+...) */\n        u = s_h * t_h;\n        v = s_l * t_h + t_l * s;\n        /* 2/(3log2)*(s+...) */\n        p_h = u + v;\n        is = p_h.to_bits() as i32;\n        p_h = f32::from_bits(is as u32 & 0xfffff000);\n        p_l = v - (p_h - u);\n        z_h = CP_H * p_h; /* cp_h+cp_l = 2/(3*log2) */\n        z_l = CP_L * p_h + p_l * CP + i!(DP_L, k as usize);\n        /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */\n        t = n as f32;\n        t1 = ((z_h + z_l) + i!(DP_H, k as usize)) + t;\n        is = t1.to_bits() as i32;\n        t1 = f32::from_bits(is as u32 & 0xfffff000);\n        t2 = z_l - (((t1 - t) - i!(DP_H, k as usize)) - z_h);\n    };\n\n    /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */\n    is = y.to_bits() as i32;\n    y1 = f32::from_bits(is as u32 & 0xfffff000);\n    p_l = (y - y1) * t1 + y * t2;\n    p_h = y1 * t1;\n    z = p_l + p_h;\n    j = z.to_bits() as i32;\n    if j > 0x43000000 {\n        /* if z > 128 */\n        return sn * HUGE * HUGE; /* overflow */\n    } else if j == 0x43000000 {\n        /* if z == 128 */\n        if p_l + OVT > z - p_h {\n            return sn * HUGE * HUGE; /* overflow */\n        }\n    } else if (j & 0x7fffffff) > 0x43160000 {\n        /* z < -150 */\n        // FIXME: check should be  (uint32_t)j > 0xc3160000\n        return sn * TINY * TINY; /* underflow */\n    } else if j as u32 == 0xc3160000\n              /* z == -150 */\n              && p_l <= z - p_h\n    {\n        return sn * TINY * TINY; /* underflow */\n    }\n\n    /*\n     * compute 2**(p_h+p_l)\n     */\n    i = j & 0x7fffffff;\n    k = (i >> 23) - 0x7f;\n    n = 0;\n    if i > 0x3f000000 {\n        /* if |z| > 0.5, set n = [z+0.5] */\n        n = j + (0x00800000 >> (k + 1));\n        k = ((n & 0x7fffffff) >> 23) - 0x7f; /* new k for n */\n        t = f32::from_bits(n as u32 & !(0x007fffff >> k));\n        n = ((n & 0x007fffff) | 0x00800000) >> (23 - k);\n        if j < 0 {\n            n = -n;\n        }\n        p_h -= t;\n    }\n    t = p_l + p_h;\n    is = t.to_bits() as i32;\n    t = f32::from_bits(is as u32 & 0xffff8000);\n    u = t * LG2_H;\n    v = (p_l - (t - p_h)) * LG2 + t * LG2_L;\n    z = u + v;\n    w = v - (z - u);\n    t = z * z;\n    t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));\n    r = (z * t1) / (t1 - 2.0) - (w + z * w);\n    z = 1.0 - (r - z);\n    j = z.to_bits() as i32;\n    j += n << 23;\n    if (j >> 23) <= 0 {\n        /* subnormal output */\n        z = scalbnf(z, n);\n    } else {\n        z = f32::from_bits(j as u32);\n    }\n    sn * z\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/rem_pio2.rs",
    "sha256": "46b6ae363a060093ecb37081f61355f36e0fc1576067cb3f8e353d3671981915",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2.c\n//\n// ====================================================\n// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n//\n// Developed at SunPro, a Sun Microsystems, Inc. business.\n// Permission to use, copy, modify, and distribute this\n// software is freely granted, provided that this notice\n// is preserved.\n// ====================================================\n//\n// Optimized by Bruce D. Evans. */\nuse super::rem_pio2_large;\n\n// #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1\n// #define EPS DBL_EPSILON\nconst EPS: f64 = 2.2204460492503131e-16;\n// #elif FLT_EVAL_METHOD==2\n// #define EPS LDBL_EPSILON\n// #endif\n\n// TODO: Support FLT_EVAL_METHOD?\n\nconst TO_INT: f64 = 1.5 / EPS;\n/// 53 bits of 2/pi\nconst INV_PIO2: f64 = 6.36619772367581382433e-01; /* 0x3FE45F30, 0x6DC9C883 */\n/// first 33 bits of pi/2\nconst PIO2_1: f64 = 1.57079632673412561417e+00; /* 0x3FF921FB, 0x54400000 */\n/// pi/2 - PIO2_1\nconst PIO2_1T: f64 = 6.07710050650619224932e-11; /* 0x3DD0B461, 0x1A626331 */\n/// second 33 bits of pi/2\nconst PIO2_2: f64 = 6.07710050630396597660e-11; /* 0x3DD0B461, 0x1A600000 */\n/// pi/2 - (PIO2_1+PIO2_2)\nconst PIO2_2T: f64 = 2.02226624879595063154e-21; /* 0x3BA3198A, 0x2E037073 */\n/// third 33 bits of pi/2\nconst PIO2_3: f64 = 2.02226624871116645580e-21; /* 0x3BA3198A, 0x2E000000 */\n/// pi/2 - (PIO2_1+PIO2_2+PIO2_3)\nconst PIO2_3T: f64 = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */\n\n// return the remainder of x rem pi/2 in y[0]+y[1]\n// use rem_pio2_large() for large x\n//\n// caller must handle the case when reduction is not needed: |x| ~<= pi/4 */\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn rem_pio2(x: f64) -> (i32, f64, f64) {\n    let x1p24 = f64::from_bits(0x4170000000000000);\n\n    let sign = (f64::to_bits(x) >> 63) as i32;\n    let ix = (f64::to_bits(x) >> 32) as u32 & 0x7fffffff;\n\n    fn medium(x: f64, ix: u32) -> (i32, f64, f64) {\n        /* rint(x/(pi/2)), Assume round-to-nearest. */\n        let tmp = x * INV_PIO2 + TO_INT;\n        // force rounding of tmp to it's storage format on x87 to avoid\n        // excess precision issues.\n        #[cfg(all(target_arch = \"x86\", not(target_feature = \"sse2\")))]\n        let tmp = force_eval!(tmp);\n        let f_n = tmp - TO_INT;\n        let n = f_n as i32;\n        let mut r = x - f_n * PIO2_1;\n        let mut w = f_n * PIO2_1T; /* 1st round, good to 85 bits */\n        let mut y0 = r - w;\n        let ui = f64::to_bits(y0);\n        let ey = (ui >> 52) as i32 & 0x7ff;\n        let ex = (ix >> 20) as i32;\n        if ex - ey > 16 {\n            /* 2nd round, good to 118 bits */\n            let t = r;\n            w = f_n * PIO2_2;\n            r = t - w;\n            w = f_n * PIO2_2T - ((t - r) - w);\n            y0 = r - w;\n            let ey = (f64::to_bits(y0) >> 52) as i32 & 0x7ff;\n            if ex - ey > 49 {\n                /* 3rd round, good to 151 bits, covers all cases */\n                let t = r;\n                w = f_n * PIO2_3;\n                r = t - w;\n                w = f_n * PIO2_3T - ((t - r) - w);\n                y0 = r - w;\n            }\n        }\n        let y1 = (r - y0) - w;\n        (n, y0, y1)\n    }\n\n    if ix <= 0x400f6a7a {\n        /* |x| ~<= 5pi/4 */\n        if (ix & 0xfffff) == 0x921fb {\n            /* |x| ~= pi/2 or 2pi/2 */\n            return medium(x, ix); /* cancellation -- use medium case */\n        }\n        if ix <= 0x4002d97c {\n            /* |x| ~<= 3pi/4 */\n            if sign == 0 {\n                let z = x - PIO2_1; /* one round good to 85 bits */\n                let y0 = z - PIO2_1T;\n                let y1 = (z - y0) - PIO2_1T;\n                return (1, y0, y1);\n            } else {\n                let z = x + PIO2_1;\n                let y0 = z + PIO2_1T;\n                let y1 = (z - y0) + PIO2_1T;\n                return (-1, y0, y1);\n            }\n        } else if sign == 0 {\n            let z = x - 2.0 * PIO2_1;\n            let y0 = z - 2.0 * PIO2_1T;\n            let y1 = (z - y0) - 2.0 * PIO2_1T;\n            return (2, y0, y1);\n        } else {\n            let z = x + 2.0 * PIO2_1;\n            let y0 = z + 2.0 * PIO2_1T;\n            let y1 = (z - y0) + 2.0 * PIO2_1T;\n            return (-2, y0, y1);\n        }\n    }\n    if ix <= 0x401c463b {\n        /* |x| ~<= 9pi/4 */\n        if ix <= 0x4015fdbc {\n            /* |x| ~<= 7pi/4 */\n            if ix == 0x4012d97c {\n                /* |x| ~= 3pi/2 */\n                return medium(x, ix);\n            }\n            if sign == 0 {\n                let z = x - 3.0 * PIO2_1;\n                let y0 = z - 3.0 * PIO2_1T;\n                let y1 = (z - y0) - 3.0 * PIO2_1T;\n                return (3, y0, y1);\n            } else {\n                let z = x + 3.0 * PIO2_1;\n                let y0 = z + 3.0 * PIO2_1T;\n                let y1 = (z - y0) + 3.0 * PIO2_1T;\n                return (-3, y0, y1);\n            }\n        } else {\n            if ix == 0x401921fb {\n                /* |x| ~= 4pi/2 */\n                return medium(x, ix);\n            }\n            if sign == 0 {\n                let z = x - 4.0 * PIO2_1;\n                let y0 = z - 4.0 * PIO2_1T;\n                let y1 = (z - y0) - 4.0 * PIO2_1T;\n                return (4, y0, y1);\n            } else {\n                let z = x + 4.0 * PIO2_1;\n                let y0 = z + 4.0 * PIO2_1T;\n                let y1 = (z - y0) + 4.0 * PIO2_1T;\n                return (-4, y0, y1);\n            }\n        }\n    }\n    if ix < 0x413921fb {\n        /* |x| ~< 2^20*(pi/2), medium size */\n        return medium(x, ix);\n    }\n    /*\n     * all other (large) arguments\n     */\n    if ix >= 0x7ff00000 {\n        /* x is inf or NaN */\n        let y0 = x - x;\n        let y1 = y0;\n        return (0, y0, y1);\n    }\n    /* set z = scalbn(|x|,-ilogb(x)+23) */\n    let mut ui = f64::to_bits(x);\n    ui &= (!1) >> 12;\n    ui |= (0x3ff + 23) << 52;\n    let mut z = f64::from_bits(ui);\n    let mut tx = [0.0; 3];\n    for i in 0..2 {\n        i!(tx,i, =, z as i32 as f64);\n        z = (z - i!(tx, i)) * x1p24;\n    }\n    i!(tx,2, =, z);\n    /* skip zero terms, first term is non-zero */\n    let mut i = 2;\n    while i != 0 && i!(tx, i) == 0.0 {\n        i -= 1;\n    }\n    let mut ty = [0.0; 3];\n    let n = rem_pio2_large(&tx[..=i], &mut ty, ((ix as i32) >> 20) - (0x3ff + 23), 1);\n    if sign != 0 {\n        return (-n, -i!(ty, 0), -i!(ty, 1));\n    }\n    (n, i!(ty, 0), i!(ty, 1))\n}\n\n#[cfg(test)]\nmod tests {\n    use super::rem_pio2;\n\n    #[test]\n    // FIXME(correctness): inaccurate results on i586\n    #[cfg_attr(all(target_arch = \"x86\", not(target_feature = \"sse\")), ignore)]\n    fn test_near_pi() {\n        let arg = 3.141592025756836;\n        let arg = force_eval!(arg);\n        assert_eq!(\n            rem_pio2(arg),\n            (2, -6.278329573009626e-7, -2.1125998133974653e-23)\n        );\n        let arg = 3.141592033207416;\n        let arg = force_eval!(arg);\n        assert_eq!(\n            rem_pio2(arg),\n            (2, -6.20382377148128e-7, -2.1125998133974653e-23)\n        );\n        let arg = 3.141592144966125;\n        let arg = force_eval!(arg);\n        assert_eq!(\n            rem_pio2(arg),\n            (2, -5.086236681942706e-7, -2.1125998133974653e-23)\n        );\n        let arg = 3.141592979431152;\n        let arg = force_eval!(arg);\n        assert_eq!(\n            rem_pio2(arg),\n            (2, 3.2584135866119817e-7, -2.1125998133974653e-23)\n        );\n    }\n\n    #[test]\n    fn test_overflow_b9b847() {\n        let _ = rem_pio2(-3054214.5490637687);\n    }\n\n    #[test]\n    fn test_overflow_4747b9() {\n        let _ = rem_pio2(917340800458.2274);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/rem_pio2_large.rs",
    "sha256": "13e5233278b4045833f2eeb5ba7182bd200222e5340ae2d61d7c49b788a3c63f",
    "text": "#![allow(unused_unsafe)]\n/* origin: FreeBSD /usr/src/lib/msun/src/k_rem_pio2.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunSoft, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{floor, scalbn};\n\n// initial value for jk\nconst INIT_JK: [usize; 4] = [3, 4, 4, 6];\n\n// Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi\n//\n//              integer array, contains the (24*i)-th to (24*i+23)-th\n//              bit of 2/pi after binary point. The corresponding\n//              floating value is\n//\n//                      ipio2[i] * 2^(-24(i+1)).\n//\n// NB: This table must have at least (e0-3)/24 + jk terms.\n//     For quad precision (e0 <= 16360, jk = 6), this is 686.\n#[cfg(any(target_pointer_width = \"32\", target_pointer_width = \"16\"))]\nconst IPIO2: [i32; 66] = [\n    0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C, 0x439041, 0xFE5163,\n    0xABDEBB, 0xC561B7, 0x246E3A, 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129,\n    0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C,\n    0x845F8B, 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF,\n    0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, 0xF17B3D, 0x0739F7, 0x8A5292,\n    0xEA6BFB, 0x5FB11F, 0x8D5D08, 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3,\n    0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, 0x4D7327, 0x310606, 0x1556CA,\n    0x73A8C9, 0x60E27B, 0xC08C6B,\n];\n\n#[cfg(target_pointer_width = \"64\")]\nconst IPIO2: [i32; 690] = [\n    0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C, 0x439041, 0xFE5163,\n    0xABDEBB, 0xC561B7, 0x246E3A, 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129,\n    0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C,\n    0x845F8B, 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF,\n    0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, 0xF17B3D, 0x0739F7, 0x8A5292,\n    0xEA6BFB, 0x5FB11F, 0x8D5D08, 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3,\n    0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, 0x4D7327, 0x310606, 0x1556CA,\n    0x73A8C9, 0x60E27B, 0xC08C6B, 0x47C419, 0xC367CD, 0xDCE809, 0x2A8359, 0xC4768B, 0x961CA6,\n    0xDDAF44, 0xD15719, 0x053EA5, 0xFF0705, 0x3F7E33, 0xE832C2, 0xDE4F98, 0x327DBB, 0xC33D26,\n    0xEF6B1E, 0x5EF89F, 0x3A1F35, 0xCAF27F, 0x1D87F1, 0x21907C, 0x7C246A, 0xFA6ED5, 0x772D30,\n    0x433B15, 0xC614B5, 0x9D19C3, 0xC2C4AD, 0x414D2C, 0x5D000C, 0x467D86, 0x2D71E3, 0x9AC69B,\n    0x006233, 0x7CD2B4, 0x97A7B4, 0xD55537, 0xF63ED7, 0x1810A3, 0xFC764D, 0x2A9D64, 0xABD770,\n    0xF87C63, 0x57B07A, 0xE71517, 0x5649C0, 0xD9D63B, 0x3884A7, 0xCB2324, 0x778AD6, 0x23545A,\n    0xB91F00, 0x1B0AF1, 0xDFCE19, 0xFF319F, 0x6A1E66, 0x615799, 0x47FBAC, 0xD87F7E, 0xB76522,\n    0x89E832, 0x60BFE6, 0xCDC4EF, 0x09366C, 0xD43F5D, 0xD7DE16, 0xDE3B58, 0x929BDE, 0x2822D2,\n    0xE88628, 0x4D58E2, 0x32CAC6, 0x16E308, 0xCB7DE0, 0x50C017, 0xA71DF3, 0x5BE018, 0x34132E,\n    0x621283, 0x014883, 0x5B8EF5, 0x7FB0AD, 0xF2E91E, 0x434A48, 0xD36710, 0xD8DDAA, 0x425FAE,\n    0xCE616A, 0xA4280A, 0xB499D3, 0xF2A606, 0x7F775C, 0x83C2A3, 0x883C61, 0x78738A, 0x5A8CAF,\n    0xBDD76F, 0x63A62D, 0xCBBFF4, 0xEF818D, 0x67C126, 0x45CA55, 0x36D9CA, 0xD2A828, 0x8D61C2,\n    0x77C912, 0x142604, 0x9B4612, 0xC459C4, 0x44C5C8, 0x91B24D, 0xF31700, 0xAD43D4, 0xE54929,\n    0x10D5FD, 0xFCBE00, 0xCC941E, 0xEECE70, 0xF53E13, 0x80F1EC, 0xC3E7B3, 0x28F8C7, 0x940593,\n    0x3E71C1, 0xB3092E, 0xF3450B, 0x9C1288, 0x7B20AB, 0x9FB52E, 0xC29247, 0x2F327B, 0x6D550C,\n    0x90A772, 0x1FE76B, 0x96CB31, 0x4A1679, 0xE27941, 0x89DFF4, 0x9794E8, 0x84E6E2, 0x973199,\n    0x6BED88, 0x365F5F, 0x0EFDBB, 0xB49A48, 0x6CA467, 0x427271, 0x325D8D, 0xB8159F, 0x09E5BC,\n    0x25318D, 0x3974F7, 0x1C0530, 0x010C0D, 0x68084B, 0x58EE2C, 0x90AA47, 0x02E774, 0x24D6BD,\n    0xA67DF7, 0x72486E, 0xEF169F, 0xA6948E, 0xF691B4, 0x5153D1, 0xF20ACF, 0x339820, 0x7E4BF5,\n    0x6863B2, 0x5F3EDD, 0x035D40, 0x7F8985, 0x295255, 0xC06437, 0x10D86D, 0x324832, 0x754C5B,\n    0xD4714E, 0x6E5445, 0xC1090B, 0x69F52A, 0xD56614, 0x9D0727, 0x50045D, 0xDB3BB4, 0xC576EA,\n    0x17F987, 0x7D6B49, 0xBA271D, 0x296996, 0xACCCC6, 0x5414AD, 0x6AE290, 0x89D988, 0x50722C,\n    0xBEA404, 0x940777, 0x7030F3, 0x27FC00, 0xA871EA, 0x49C266, 0x3DE064, 0x83DD97, 0x973FA3,\n    0xFD9443, 0x8C860D, 0xDE4131, 0x9D3992, 0x8C70DD, 0xE7B717, 0x3BDF08, 0x2B3715, 0xA0805C,\n    0x93805A, 0x921110, 0xD8E80F, 0xAF806C, 0x4BFFDB, 0x0F9038, 0x761859, 0x15A562, 0xBBCB61,\n    0xB989C7, 0xBD4010, 0x04F2D2, 0x277549, 0xF6B6EB, 0xBB22DB, 0xAA140A, 0x2F2689, 0x768364,\n    0x333B09, 0x1A940E, 0xAA3A51, 0xC2A31D, 0xAEEDAF, 0x12265C, 0x4DC26D, 0x9C7A2D, 0x9756C0,\n    0x833F03, 0xF6F009, 0x8C402B, 0x99316D, 0x07B439, 0x15200C, 0x5BC3D8, 0xC492F5, 0x4BADC6,\n    0xA5CA4E, 0xCD37A7, 0x36A9E6, 0x9492AB, 0x6842DD, 0xDE6319, 0xEF8C76, 0x528B68, 0x37DBFC,\n    0xABA1AE, 0x3115DF, 0xA1AE00, 0xDAFB0C, 0x664D64, 0xB705ED, 0x306529, 0xBF5657, 0x3AFF47,\n    0xB9F96A, 0xF3BE75, 0xDF9328, 0x3080AB, 0xF68C66, 0x15CB04, 0x0622FA, 0x1DE4D9, 0xA4B33D,\n    0x8F1B57, 0x09CD36, 0xE9424E, 0xA4BE13, 0xB52333, 0x1AAAF0, 0xA8654F, 0xA5C1D2, 0x0F3F0B,\n    0xCD785B, 0x76F923, 0x048B7B, 0x721789, 0x53A6C6, 0xE26E6F, 0x00EBEF, 0x584A9B, 0xB7DAC4,\n    0xBA66AA, 0xCFCF76, 0x1D02D1, 0x2DF1B1, 0xC1998C, 0x77ADC3, 0xDA4886, 0xA05DF7, 0xF480C6,\n    0x2FF0AC, 0x9AECDD, 0xBC5C3F, 0x6DDED0, 0x1FC790, 0xB6DB2A, 0x3A25A3, 0x9AAF00, 0x9353AD,\n    0x0457B6, 0xB42D29, 0x7E804B, 0xA707DA, 0x0EAA76, 0xA1597B, 0x2A1216, 0x2DB7DC, 0xFDE5FA,\n    0xFEDB89, 0xFDBE89, 0x6C76E4, 0xFCA906, 0x70803E, 0x156E85, 0xFF87FD, 0x073E28, 0x336761,\n    0x86182A, 0xEABD4D, 0xAFE7B3, 0x6E6D8F, 0x396795, 0x5BBF31, 0x48D784, 0x16DF30, 0x432DC7,\n    0x356125, 0xCE70C9, 0xB8CB30, 0xFD6CBF, 0xA200A4, 0xE46C05, 0xA0DD5A, 0x476F21, 0xD21262,\n    0x845CB9, 0x496170, 0xE0566B, 0x015299, 0x375550, 0xB7D51E, 0xC4F133, 0x5F6E13, 0xE4305D,\n    0xA92E85, 0xC3B21D, 0x3632A1, 0xA4B708, 0xD4B1EA, 0x21F716, 0xE4698F, 0x77FF27, 0x80030C,\n    0x2D408D, 0xA0CD4F, 0x99A520, 0xD3A2B3, 0x0A5D2F, 0x42F9B4, 0xCBDA11, 0xD0BE7D, 0xC1DB9B,\n    0xBD17AB, 0x81A2CA, 0x5C6A08, 0x17552E, 0x550027, 0xF0147F, 0x8607E1, 0x640B14, 0x8D4196,\n    0xDEBE87, 0x2AFDDA, 0xB6256B, 0x34897B, 0xFEF305, 0x9EBFB9, 0x4F6A68, 0xA82A4A, 0x5AC44F,\n    0xBCF82D, 0x985AD7, 0x95C7F4, 0x8D4D0D, 0xA63A20, 0x5F57A4, 0xB13F14, 0x953880, 0x0120CC,\n    0x86DD71, 0xB6DEC9, 0xF560BF, 0x11654D, 0x6B0701, 0xACB08C, 0xD0C0B2, 0x485551, 0x0EFB1E,\n    0xC37295, 0x3B06A3, 0x3540C0, 0x7BDC06, 0xCC45E0, 0xFA294E, 0xC8CAD6, 0x41F3E8, 0xDE647C,\n    0xD8649B, 0x31BED9, 0xC397A4, 0xD45877, 0xC5E369, 0x13DAF0, 0x3C3ABA, 0x461846, 0x5F7555,\n    0xF5BDD2, 0xC6926E, 0x5D2EAC, 0xED440E, 0x423E1C, 0x87C461, 0xE9FD29, 0xF3D6E7, 0xCA7C22,\n    0x35916F, 0xC5E008, 0x8DD7FF, 0xE26A6E, 0xC6FDB0, 0xC10893, 0x745D7C, 0xB2AD6B, 0x9D6ECD,\n    0x7B723E, 0x6A11C6, 0xA9CFF7, 0xDF7329, 0xBAC9B5, 0x5100B7, 0x0DB2E2, 0x24BA74, 0x607DE5,\n    0x8AD874, 0x2C150D, 0x0C1881, 0x94667E, 0x162901, 0x767A9F, 0xBEFDFD, 0xEF4556, 0x367ED9,\n    0x13D9EC, 0xB9BA8B, 0xFC97C4, 0x27A831, 0xC36EF1, 0x36C594, 0x56A8D8, 0xB5A8B4, 0x0ECCCF,\n    0x2D8912, 0x34576F, 0x89562C, 0xE3CE99, 0xB920D6, 0xAA5E6B, 0x9C2A3E, 0xCC5F11, 0x4A0BFD,\n    0xFBF4E1, 0x6D3B8E, 0x2C86E2, 0x84D4E9, 0xA9B4FC, 0xD1EEEF, 0xC9352E, 0x61392F, 0x442138,\n    0xC8D91B, 0x0AFC81, 0x6A4AFB, 0xD81C2F, 0x84B453, 0x8C994E, 0xCC2254, 0xDC552A, 0xD6C6C0,\n    0x96190B, 0xB8701A, 0x649569, 0x605A26, 0xEE523F, 0x0F117F, 0x11B5F4, 0xF5CBFC, 0x2DBC34,\n    0xEEBC34, 0xCC5DE8, 0x605EDD, 0x9B8E67, 0xEF3392, 0xB817C9, 0x9B5861, 0xBC57E1, 0xC68351,\n    0x103ED8, 0x4871DD, 0xDD1C2D, 0xA118AF, 0x462C21, 0xD7F359, 0x987AD9, 0xC0549E, 0xFA864F,\n    0xFC0656, 0xAE79E5, 0x362289, 0x22AD38, 0xDC9367, 0xAAE855, 0x382682, 0x9BE7CA, 0xA40D51,\n    0xB13399, 0x0ED7A9, 0x480569, 0xF0B265, 0xA7887F, 0x974C88, 0x36D1F9, 0xB39221, 0x4A827B,\n    0x21CF98, 0xDC9F40, 0x5547DC, 0x3A74E1, 0x42EB67, 0xDF9DFE, 0x5FD45E, 0xA4677B, 0x7AACBA,\n    0xA2F655, 0x23882B, 0x55BA41, 0x086E59, 0x862A21, 0x834739, 0xE6E389, 0xD49EE5, 0x40FB49,\n    0xE956FF, 0xCA0F1C, 0x8A59C5, 0x2BFA94, 0xC5C1D3, 0xCFC50F, 0xAE5ADB, 0x86C547, 0x624385,\n    0x3B8621, 0x94792C, 0x876110, 0x7B4C2A, 0x1A2C80, 0x12BF43, 0x902688, 0x893C78, 0xE4C4A8,\n    0x7BDBE5, 0xC23AC4, 0xEAF426, 0x8A67F7, 0xBF920D, 0x2BA365, 0xB1933D, 0x0B7CBD, 0xDC51A4,\n    0x63DD27, 0xDDE169, 0x19949A, 0x9529A8, 0x28CE68, 0xB4ED09, 0x209F44, 0xCA984E, 0x638270,\n    0x237C7E, 0x32B90F, 0x8EF5A7, 0xE75614, 0x08F121, 0x2A9DB5, 0x4D7E6F, 0x5119A5, 0xABF9B5,\n    0xD6DF82, 0x61DD96, 0x023616, 0x9F3AC4, 0xA1A283, 0x6DED72, 0x7A8D39, 0xA9B882, 0x5C326B,\n    0x5B2746, 0xED3400, 0x7700D2, 0x55F4FC, 0x4D5901, 0x8071E0,\n];\n\nconst PIO2: [f64; 8] = [\n    1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */\n    7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */\n    5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */\n    3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */\n    1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */\n    1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */\n    2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */\n    2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */\n];\n\n// fn rem_pio2_large(x : &[f64], y : &mut [f64], e0 : i32, prec : usize) -> i32\n//\n// Input parameters:\n//      x[]     The input value (must be positive) is broken into nx\n//              pieces of 24-bit integers in double precision format.\n//              x[i] will be the i-th 24 bit of x. The scaled exponent\n//              of x[0] is given in input parameter e0 (i.e., x[0]*2^e0\n//              match x's up to 24 bits.\n//\n//              Example of breaking a double positive z into x[0]+x[1]+x[2]:\n//                      e0 = ilogb(z)-23\n//                      z  = scalbn(z,-e0)\n//              for i = 0,1,2\n//                      x[i] = floor(z)\n//                      z    = (z-x[i])*2**24\n//\n//      y[]     ouput result in an array of double precision numbers.\n//              The dimension of y[] is:\n//                      24-bit  precision       1\n//                      53-bit  precision       2\n//                      64-bit  precision       2\n//                      113-bit precision       3\n//              The actual value is the sum of them. Thus for 113-bit\n//              precison, one may have to do something like:\n//\n//              long double t,w,r_head, r_tail;\n//              t = (long double)y[2] + (long double)y[1];\n//              w = (long double)y[0];\n//              r_head = t+w;\n//              r_tail = w - (r_head - t);\n//\n//      e0      The exponent of x[0]. Must be <= 16360 or you need to\n//              expand the ipio2 table.\n//\n//      prec    an integer indicating the precision:\n//                      0       24  bits (single)\n//                      1       53  bits (double)\n//                      2       64  bits (extended)\n//                      3       113 bits (quad)\n//\n// Here is the description of some local variables:\n//\n//      jk      jk+1 is the initial number of terms of ipio2[] needed\n//              in the computation. The minimum and recommended value\n//              for jk is 3,4,4,6 for single, double, extended, and quad.\n//              jk+1 must be 2 larger than you might expect so that our\n//              recomputation test works. (Up to 24 bits in the integer\n//              part (the 24 bits of it that we compute) and 23 bits in\n//              the fraction part may be lost to cancelation before we\n//              recompute.)\n//\n//      jz      local integer variable indicating the number of\n//              terms of ipio2[] used.\n//\n//      jx      nx - 1\n//\n//      jv      index for pointing to the suitable ipio2[] for the\n//              computation. In general, we want\n//                      ( 2^e0*x[0] * ipio2[jv-1]*2^(-24jv) )/8\n//              is an integer. Thus\n//                      e0-3-24*jv >= 0 or (e0-3)/24 >= jv\n//              Hence jv = max(0,(e0-3)/24).\n//\n//      jp      jp+1 is the number of terms in PIo2[] needed, jp = jk.\n//\n//      q[]     double array with integral value, representing the\n//              24-bits chunk of the product of x and 2/pi.\n//\n//      q0      the corresponding exponent of q[0]. Note that the\n//              exponent for q[i] would be q0-24*i.\n//\n//      PIo2[]  double precision array, obtained by cutting pi/2\n//              into 24 bits chunks.\n//\n//      f[]     ipio2[] in floating point\n//\n//      iq[]    integer array by breaking up q[] in 24-bits chunk.\n//\n//      fq[]    final product of x*(2/pi) in fq[0],..,fq[jk]\n//\n//      ih      integer. If >0 it indicates q[] is >= 0.5, hence\n//              it also indicates the *sign* of the result.\n\n/// Return the last three digits of N with y = x - N*pi/2\n/// so that |y| < pi/2.\n///\n/// The method is to compute the integer (mod 8) and fraction parts of\n/// (2/pi)*x without doing the full multiplication. In general we\n/// skip the part of the product that are known to be a huge integer (\n/// more accurately, = 0 mod 8 ). Thus the number of operations are\n/// independent of the exponent of the input.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn rem_pio2_large(x: &[f64], y: &mut [f64], e0: i32, prec: usize) -> i32 {\n    let x1p24 = f64::from_bits(0x4170000000000000); // 0x1p24 === 2 ^ 24\n    let x1p_24 = f64::from_bits(0x3e70000000000000); // 0x1p_24 === 2 ^ (-24)\n\n    if cfg!(target_pointer_width = \"64\") {\n        debug_assert!(e0 <= 16360);\n    }\n\n    let nx = x.len();\n\n    let mut fw: f64;\n    let mut n: i32;\n    let mut ih: i32;\n    let mut z: f64;\n    let mut f: [f64; 20] = [0.; 20];\n    let mut fq: [f64; 20] = [0.; 20];\n    let mut q: [f64; 20] = [0.; 20];\n    let mut iq: [i32; 20] = [0; 20];\n\n    /* initialize jk*/\n    let jk = i!(INIT_JK, prec);\n    let jp = jk;\n\n    /* determine jx,jv,q0, note that 3>q0 */\n    let jx = nx - 1;\n    let mut jv = div!(e0 - 3, 24);\n    if jv < 0 {\n        jv = 0;\n    }\n    let mut q0 = e0 - 24 * (jv + 1);\n    let jv = jv as usize;\n\n    /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */\n    let mut j = (jv as i32) - (jx as i32);\n    let m = jx + jk;\n    for i in 0..=m {\n        i!(f, i, =, if j < 0 {\n            0.\n        } else {\n            i!(IPIO2, j as usize) as f64\n        });\n        j += 1;\n    }\n\n    /* compute q[0],q[1],...q[jk] */\n    for i in 0..=jk {\n        fw = 0f64;\n        for j in 0..=jx {\n            fw += i!(x, j) * i!(f, jx + i - j);\n        }\n        i!(q, i, =, fw);\n    }\n\n    let mut jz = jk;\n\n    'recompute: loop {\n        /* distill q[] into iq[] reversingly */\n        let mut i = 0i32;\n        z = i!(q, jz);\n        for j in (1..=jz).rev() {\n            fw = (x1p_24 * z) as i32 as f64;\n            i!(iq, i as usize, =, (z - x1p24 * fw) as i32);\n            z = i!(q, j - 1) + fw;\n            i += 1;\n        }\n\n        /* compute n */\n        z = scalbn(z, q0); /* actual value of z */\n        z -= 8.0 * floor(z * 0.125); /* trim off integer >= 8 */\n        n = z as i32;\n        z -= n as f64;\n        ih = 0;\n        if q0 > 0 {\n            /* need iq[jz-1] to determine n */\n            i = i!(iq, jz - 1) >> (24 - q0);\n            n += i;\n            i!(iq, jz - 1, -=, i << (24 - q0));\n            ih = i!(iq, jz - 1) >> (23 - q0);\n        } else if q0 == 0 {\n            ih = i!(iq, jz - 1) >> 23;\n        } else if z >= 0.5 {\n            ih = 2;\n        }\n\n        if ih > 0 {\n            /* q > 0.5 */\n            n += 1;\n            let mut carry = 0i32;\n            for i in 0..jz {\n                /* compute 1-q */\n                let j = i!(iq, i);\n                if carry == 0 {\n                    if j != 0 {\n                        carry = 1;\n                        i!(iq, i, =, 0x1000000 - j);\n                    }\n                } else {\n                    i!(iq, i, =, 0xffffff - j);\n                }\n            }\n            if q0 > 0 {\n                /* rare case: chance is 1 in 12 */\n                match q0 {\n                    1 => {\n                        i!(iq, jz - 1, &=, 0x7fffff);\n                    }\n                    2 => {\n                        i!(iq, jz - 1, &=, 0x3fffff);\n                    }\n                    _ => {}\n                }\n            }\n            if ih == 2 {\n                z = 1. - z;\n                if carry != 0 {\n                    z -= scalbn(1., q0);\n                }\n            }\n        }\n\n        /* check if recomputation is needed */\n        if z == 0. {\n            let mut j = 0;\n            for i in (jk..=jz - 1).rev() {\n                j |= i!(iq, i);\n            }\n            if j == 0 {\n                /* need recomputation */\n                let mut k = 1;\n                while i!(iq, jk - k, ==, 0) {\n                    k += 1; /* k = no. of terms needed */\n                }\n\n                for i in (jz + 1)..=(jz + k) {\n                    /* add q[jz+1] to q[jz+k] */\n                    i!(f, jx + i, =, i!(IPIO2, jv + i) as f64);\n                    fw = 0f64;\n                    for j in 0..=jx {\n                        fw += i!(x, j) * i!(f, jx + i - j);\n                    }\n                    i!(q, i, =, fw);\n                }\n                jz += k;\n                continue 'recompute;\n            }\n        }\n\n        break;\n    }\n\n    /* chop off zero terms */\n    if z == 0. {\n        jz -= 1;\n        q0 -= 24;\n        while i!(iq, jz) == 0 {\n            jz -= 1;\n            q0 -= 24;\n        }\n    } else {\n        /* break z into 24-bit if necessary */\n        z = scalbn(z, -q0);\n        if z >= x1p24 {\n            fw = (x1p_24 * z) as i32 as f64;\n            i!(iq, jz, =, (z - x1p24 * fw) as i32);\n            jz += 1;\n            q0 += 24;\n            i!(iq, jz, =, fw as i32);\n        } else {\n            i!(iq, jz, =, z as i32);\n        }\n    }\n\n    /* convert integer \"bit\" chunk to floating-point value */\n    fw = scalbn(1., q0);\n    for i in (0..=jz).rev() {\n        i!(q, i, =, fw * (i!(iq, i) as f64));\n        fw *= x1p_24;\n    }\n\n    /* compute PIo2[0,...,jp]*q[jz,...,0] */\n    for i in (0..=jz).rev() {\n        fw = 0f64;\n        let mut k = 0;\n        while (k <= jp) && (k <= jz - i) {\n            fw += i!(PIO2, k) * i!(q, i + k);\n            k += 1;\n        }\n        i!(fq, jz - i, =, fw);\n    }\n\n    /* compress fq[] into y[] */\n    match prec {\n        0 => {\n            fw = 0f64;\n            for i in (0..=jz).rev() {\n                fw += i!(fq, i);\n            }\n            i!(y, 0, =, if ih == 0 { fw } else { -fw });\n        }\n        1 | 2 => {\n            fw = 0f64;\n            for i in (0..=jz).rev() {\n                fw += i!(fq, i);\n            }\n            i!(y, 0, =, if ih == 0 { fw } else { -fw });\n            fw = i!(fq, 0) - fw;\n            for i in 1..=jz {\n                fw += i!(fq, i);\n            }\n            i!(y, 1, =, if ih == 0 { fw } else { -fw });\n        }\n        3 => {\n            /* painful */\n            for i in (1..=jz).rev() {\n                fw = i!(fq, i - 1) + i!(fq, i);\n                i!(fq, i, +=, i!(fq, i - 1) - fw);\n                i!(fq, i - 1, =, fw);\n            }\n            for i in (2..=jz).rev() {\n                fw = i!(fq, i - 1) + i!(fq, i);\n                i!(fq, i, +=, i!(fq, i - 1) - fw);\n                i!(fq, i - 1, =, fw);\n            }\n            fw = 0f64;\n            for i in (2..=jz).rev() {\n                fw += i!(fq, i);\n            }\n            if ih == 0 {\n                i!(y, 0, =, i!(fq, 0));\n                i!(y, 1, =, i!(fq, 1));\n                i!(y, 2, =, fw);\n            } else {\n                i!(y, 0, =, -i!(fq, 0));\n                i!(y, 1, =, -i!(fq, 1));\n                i!(y, 2, =, -fw);\n            }\n        }\n        #[cfg(debug_assertions)]\n        _ => unreachable!(),\n        #[cfg(not(debug_assertions))]\n        _ => {}\n    }\n    n & 7\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/rem_pio2f.rs",
    "sha256": "0e0296845955aef7c32dbd27946f0a30eb57835fd7ea73729a4cdb9b5fbe8237",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/e_rem_pio2f.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n * Debugged and optimized by Bruce D. Evans.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse core::f64;\n\nuse super::rem_pio2_large;\n\nconst TOINT: f64 = 1.5 / f64::EPSILON;\n\n/// 53 bits of 2/pi\nconst INV_PIO2: f64 = 6.36619772367581382433e-01; /* 0x3FE45F30, 0x6DC9C883 */\n/// first 25 bits of pi/2\nconst PIO2_1: f64 = 1.57079631090164184570e+00; /* 0x3FF921FB, 0x50000000 */\n/// pi/2 - pio2_1\nconst PIO2_1T: f64 = 1.58932547735281966916e-08; /* 0x3E5110b4, 0x611A6263 */\n\n/// Return the remainder of x rem pi/2 in *y\n///\n/// use double precision for everything except passing x\n/// use __rem_pio2_large() for large x\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub(crate) fn rem_pio2f(x: f32) -> (i32, f64) {\n    let x64 = x as f64;\n\n    let mut tx: [f64; 1] = [0.];\n    let mut ty: [f64; 1] = [0.];\n\n    let ix = x.to_bits() & 0x7fffffff;\n    /* 25+53 bit pi is good enough for medium size */\n    if ix < 0x4dc90fdb {\n        /* |x| ~< 2^28*(pi/2), medium size */\n        /* Use a specialized rint() to get fn.  Assume round-to-nearest. */\n        let tmp = x64 * INV_PIO2 + TOINT;\n        // force rounding of tmp to it's storage format on x87 to avoid\n        // excess precision issues.\n        #[cfg(all(target_arch = \"x86\", not(target_feature = \"sse2\")))]\n        let tmp = force_eval!(tmp);\n        let f_n = tmp - TOINT;\n        return (f_n as i32, x64 - f_n * PIO2_1 - f_n * PIO2_1T);\n    }\n    if ix >= 0x7f800000 {\n        /* x is inf or NaN */\n        return (0, x64 - x64);\n    }\n    /* scale x into [2^23, 2^24-1] */\n    let sign = (x.to_bits() >> 31) != 0;\n    let e0 = ((ix >> 23) - (0x7f + 23)) as i32; /* e0 = ilogb(|x|)-23, positive */\n    tx[0] = f32::from_bits(ix - (e0 << 23) as u32) as f64;\n    let n = rem_pio2_large(&tx, &mut ty, e0, 0);\n    if sign {\n        return (-n, -ty[0]);\n    }\n    (n, ty[0])\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/sin.rs",
    "sha256": "ca7ba2f29fd8507c5fe1066eedda6cc1443c9db3f57820f94c2e29d49dd7236c",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */\n//\n// ====================================================\n// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n//\n// Developed at SunPro, a Sun Microsystems, Inc. business.\n// Permission to use, copy, modify, and distribute this\n// software is freely granted, provided that this notice\n// is preserved.\n// ====================================================\n\nuse super::{k_cos, k_sin, rem_pio2};\n\n// sin(x)\n// Return sine function of x.\n//\n// kernel function:\n//      k_sin            ... sine function on [-pi/4,pi/4]\n//      k_cos            ... cose function on [-pi/4,pi/4]\n//      rem_pio2         ... argument reduction routine\n//\n// Method.\n//      Let S,C and T denote the sin, cos and tan respectively on\n//      [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2\n//      in [-pi/4 , +pi/4], and let n = k mod 4.\n//      We have\n//\n//          n        sin(x)      cos(x)        tan(x)\n//     ----------------------------------------------------------\n//          0          S           C             T\n//          1          C          -S            -1/T\n//          2         -S          -C             T\n//          3         -C           S            -1/T\n//     ----------------------------------------------------------\n//\n// Special cases:\n//      Let trig be any of sin, cos, or tan.\n//      trig(+-INF)  is NaN, with signals;\n//      trig(NaN)    is that NaN;\n//\n// Accuracy:\n//      TRIG(x) returns trig(x) nearly rounded\n\n/// The sine of `x` (f64).\n///\n/// `x` is specified in radians.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn sin(x: f64) -> f64 {\n    let x1p120 = f64::from_bits(0x4770000000000000); // 0x1p120f === 2 ^ 120\n\n    /* High word of x. */\n    let ix = (f64::to_bits(x) >> 32) as u32 & 0x7fffffff;\n\n    /* |x| ~< pi/4 */\n    if ix <= 0x3fe921fb {\n        if ix < 0x3e500000 {\n            /* |x| < 2**-26 */\n            /* raise inexact if x != 0 and underflow if subnormal*/\n            if ix < 0x00100000 {\n                force_eval!(x / x1p120);\n            } else {\n                force_eval!(x + x1p120);\n            }\n            return x;\n        }\n        return k_sin(x, 0.0, 0);\n    }\n\n    /* sin(Inf or NaN) is NaN */\n    if ix >= 0x7ff00000 {\n        return x - x;\n    }\n\n    /* argument reduction needed */\n    let (n, y0, y1) = rem_pio2(x);\n    match n & 3 {\n        0 => k_sin(y0, y1, 1),\n        1 => k_cos(y0, y1),\n        2 => -k_sin(y0, y1, 1),\n        _ => -k_cos(y0, y1),\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    #[cfg_attr(x86_no_sse, ignore = \"FIXME(i586): possible incorrect rounding\")]\n    fn test_near_pi() {\n        let x = f64::from_bits(0x400921fb000FD5DD); // 3.141592026217707\n        let sx = f64::from_bits(0x3ea50d15ced1a4a2); // 6.273720864039205e-7\n        assert_eq!(sin(x), sx);\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/sincos.rs",
    "sha256": "691f64aba0e8ce50b3f5588108c818904e7895031fae663332eb23bbd5037eb0",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{get_high_word, k_cos, k_sin, rem_pio2};\n\n/// Both the sine and cosine of `x` (f64).\n///\n/// `x` is specified in radians and the return value is (sin(x), cos(x)).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn sincos(x: f64) -> (f64, f64) {\n    let s: f64;\n    let c: f64;\n    let mut ix: u32;\n\n    ix = get_high_word(x);\n    ix &= 0x7fffffff;\n\n    /* |x| ~< pi/4 */\n    if ix <= 0x3fe921fb {\n        /* if |x| < 2**-27 * sqrt(2) */\n        if ix < 0x3e46a09e {\n            /* raise inexact if x!=0 and underflow if subnormal */\n            let x1p120 = f64::from_bits(0x4770000000000000); // 0x1p120 == 2^120\n            if ix < 0x00100000 {\n                force_eval!(x / x1p120);\n            } else {\n                force_eval!(x + x1p120);\n            }\n            return (x, 1.0);\n        }\n        return (k_sin(x, 0.0, 0), k_cos(x, 0.0));\n    }\n\n    /* sincos(Inf or NaN) is NaN */\n    if ix >= 0x7ff00000 {\n        let rv = x - x;\n        return (rv, rv);\n    }\n\n    /* argument reduction needed */\n    let (n, y0, y1) = rem_pio2(x);\n    s = k_sin(y0, y1, 1);\n    c = k_cos(y0, y1);\n    match n & 3 {\n        0 => (s, c),\n        1 => (c, -s),\n        2 => (-s, -c),\n        3 => (-c, s),\n        #[cfg(debug_assertions)]\n        _ => unreachable!(),\n        #[cfg(not(debug_assertions))]\n        _ => (0.0, 1.0),\n    }\n}\n\n// These tests are based on those from sincosf.rs\n#[cfg(test)]\nmod tests {\n    use super::sincos;\n\n    const TOLERANCE: f64 = 1e-6;\n\n    #[test]\n    fn with_pi() {\n        let (s, c) = sincos(core::f64::consts::PI);\n        assert!(\n            (s - 0.0).abs() < TOLERANCE,\n            \"|{} - {}| = {} >= {}\",\n            s,\n            0.0,\n            (s - 0.0).abs(),\n            TOLERANCE\n        );\n        assert!(\n            (c + 1.0).abs() < TOLERANCE,\n            \"|{} + {}| = {} >= {}\",\n            c,\n            1.0,\n            (s + 1.0).abs(),\n            TOLERANCE\n        );\n    }\n\n    #[test]\n    fn rotational_symmetry() {\n        use core::f64::consts::PI;\n        const N: usize = 24;\n        for n in 0..N {\n            let theta = 2. * PI * (n as f64) / (N as f64);\n            let (s, c) = sincos(theta);\n            let (s_plus, c_plus) = sincos(theta + 2. * PI);\n            let (s_minus, c_minus) = sincos(theta - 2. * PI);\n\n            assert!(\n                (s - s_plus).abs() < TOLERANCE,\n                \"|{} - {}| = {} >= {}\",\n                s,\n                s_plus,\n                (s - s_plus).abs(),\n                TOLERANCE\n            );\n            assert!(\n                (s - s_minus).abs() < TOLERANCE,\n                \"|{} - {}| = {} >= {}\",\n                s,\n                s_minus,\n                (s - s_minus).abs(),\n                TOLERANCE\n            );\n            assert!(\n                (c - c_plus).abs() < TOLERANCE,\n                \"|{} - {}| = {} >= {}\",\n                c,\n                c_plus,\n                (c - c_plus).abs(),\n                TOLERANCE\n            );\n            assert!(\n                (c - c_minus).abs() < TOLERANCE,\n                \"|{} - {}| = {} >= {}\",\n                c,\n                c_minus,\n                (c - c_minus).abs(),\n                TOLERANCE\n            );\n        }\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/sincosf.rs",
    "sha256": "fd437602389f147244e488d73503fe7b69498b59f751ccb11938bc70f06fb917",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_sinf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n * Optimized by Bruce D. Evans.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse super::{k_cosf, k_sinf, rem_pio2f};\n\n/* Small multiples of pi/2 rounded to double precision. */\nconst PI_2: f64 = 0.5 * 3.1415926535897931160E+00;\nconst S1PIO2: f64 = 1.0 * PI_2; /* 0x3FF921FB, 0x54442D18 */\nconst S2PIO2: f64 = 2.0 * PI_2; /* 0x400921FB, 0x54442D18 */\nconst S3PIO2: f64 = 3.0 * PI_2; /* 0x4012D97C, 0x7F3321D2 */\nconst S4PIO2: f64 = 4.0 * PI_2; /* 0x401921FB, 0x54442D18 */\n\n/// Both the sine and cosine of `x` (f32).\n///\n/// `x` is specified in radians and the return value is (sin(x), cos(x)).\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn sincosf(x: f32) -> (f32, f32) {\n    let s: f32;\n    let c: f32;\n    let mut ix: u32;\n    let sign: bool;\n\n    ix = x.to_bits();\n    sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n\n    /* |x| ~<= pi/4 */\n    if ix <= 0x3f490fda {\n        /* |x| < 2**-12 */\n        if ix < 0x39800000 {\n            /* raise inexact if x!=0 and underflow if subnormal */\n\n            let x1p120 = f32::from_bits(0x7b800000); // 0x1p120 == 2^120\n            if ix < 0x00100000 {\n                force_eval!(x / x1p120);\n            } else {\n                force_eval!(x + x1p120);\n            }\n            return (x, 1.0);\n        }\n        return (k_sinf(x as f64), k_cosf(x as f64));\n    }\n\n    /* |x| ~<= 5*pi/4 */\n    if ix <= 0x407b53d1 {\n        if ix <= 0x4016cbe3 {\n            /* |x| ~<= 3pi/4 */\n            if sign {\n                s = -k_cosf(x as f64 + S1PIO2);\n                c = k_sinf(x as f64 + S1PIO2);\n            } else {\n                s = k_cosf(S1PIO2 - x as f64);\n                c = k_sinf(S1PIO2 - x as f64);\n            }\n        }\n        /* -sin(x+c) is not correct if x+c could be 0: -0 vs +0 */\n        else if sign {\n            s = -k_sinf(x as f64 + S2PIO2);\n            c = -k_cosf(x as f64 + S2PIO2);\n        } else {\n            s = -k_sinf(x as f64 - S2PIO2);\n            c = -k_cosf(x as f64 - S2PIO2);\n        }\n\n        return (s, c);\n    }\n\n    /* |x| ~<= 9*pi/4 */\n    if ix <= 0x40e231d5 {\n        if ix <= 0x40afeddf {\n            /* |x| ~<= 7*pi/4 */\n            if sign {\n                s = k_cosf(x as f64 + S3PIO2);\n                c = -k_sinf(x as f64 + S3PIO2);\n            } else {\n                s = -k_cosf(x as f64 - S3PIO2);\n                c = k_sinf(x as f64 - S3PIO2);\n            }\n        } else if sign {\n            s = k_sinf(x as f64 + S4PIO2);\n            c = k_cosf(x as f64 + S4PIO2);\n        } else {\n            s = k_sinf(x as f64 - S4PIO2);\n            c = k_cosf(x as f64 - S4PIO2);\n        }\n\n        return (s, c);\n    }\n\n    /* sin(Inf or NaN) is NaN */\n    if ix >= 0x7f800000 {\n        let rv = x - x;\n        return (rv, rv);\n    }\n\n    /* general argument reduction needed */\n    let (n, y) = rem_pio2f(x);\n    s = k_sinf(y);\n    c = k_cosf(y);\n    match n & 3 {\n        0 => (s, c),\n        1 => (c, -s),\n        2 => (-s, -c),\n        3 => (-c, s),\n        #[cfg(debug_assertions)]\n        _ => unreachable!(),\n        #[cfg(not(debug_assertions))]\n        _ => (0.0, 1.0),\n    }\n}\n\n// PowerPC tests are failing on LLVM 13: https://github.com/rust-lang/rust/issues/88520\n#[cfg(not(target_arch = \"powerpc64\"))]\n#[cfg(test)]\nmod tests {\n    use super::sincosf;\n\n    #[test]\n    fn rotational_symmetry() {\n        use core::f32::consts::PI;\n        const N: usize = 24;\n        for n in 0..N {\n            let theta = 2. * PI * (n as f32) / (N as f32);\n            let (s, c) = sincosf(theta);\n            let (s_plus, c_plus) = sincosf(theta + 2. * PI);\n            let (s_minus, c_minus) = sincosf(theta - 2. * PI);\n\n            const TOLERANCE: f32 = 1e-6;\n            assert!(\n                (s - s_plus).abs() < TOLERANCE,\n                \"|{} - {}| = {} >= {}\",\n                s,\n                s_plus,\n                (s - s_plus).abs(),\n                TOLERANCE\n            );\n            assert!(\n                (s - s_minus).abs() < TOLERANCE,\n                \"|{} - {}| = {} >= {}\",\n                s,\n                s_minus,\n                (s - s_minus).abs(),\n                TOLERANCE\n            );\n            assert!(\n                (c - c_plus).abs() < TOLERANCE,\n                \"|{} - {}| = {} >= {}\",\n                c,\n                c_plus,\n                (c - c_plus).abs(),\n                TOLERANCE\n            );\n            assert!(\n                (c - c_minus).abs() < TOLERANCE,\n                \"|{} - {}| = {} >= {}\",\n                c,\n                c_minus,\n                (c - c_minus).abs(),\n                TOLERANCE\n            );\n        }\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/sinf.rs",
    "sha256": "acdd93d95e19012edfe71a13f85126bc360e32d2ad13b53b010ef9316b6fffd7",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_sinf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n * Optimized by Bruce D. Evans.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse core::f64::consts::FRAC_PI_2;\n\nuse super::{k_cosf, k_sinf, rem_pio2f};\n\n/* Small multiples of pi/2 rounded to double precision. */\nconst S1_PIO2: f64 = 1. * FRAC_PI_2; /* 0x3FF921FB, 0x54442D18 */\nconst S2_PIO2: f64 = 2. * FRAC_PI_2; /* 0x400921FB, 0x54442D18 */\nconst S3_PIO2: f64 = 3. * FRAC_PI_2; /* 0x4012D97C, 0x7F3321D2 */\nconst S4_PIO2: f64 = 4. * FRAC_PI_2; /* 0x401921FB, 0x54442D18 */\n\n/// The sine of `x` (f32).\n///\n/// `x` is specified in radians.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn sinf(x: f32) -> f32 {\n    let x64 = x as f64;\n\n    let x1p120 = f32::from_bits(0x7b800000); // 0x1p120f === 2 ^ 120\n\n    let mut ix = x.to_bits();\n    let sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n\n    if ix <= 0x3f490fda {\n        /* |x| ~<= pi/4 */\n        if ix < 0x39800000 {\n            /* |x| < 2**-12 */\n            /* raise inexact if x!=0 and underflow if subnormal */\n            force_eval!(if ix < 0x00800000 {\n                x / x1p120\n            } else {\n                x + x1p120\n            });\n            return x;\n        }\n        return k_sinf(x64);\n    }\n    if ix <= 0x407b53d1 {\n        /* |x| ~<= 5*pi/4 */\n        if ix <= 0x4016cbe3 {\n            /* |x| ~<= 3pi/4 */\n            if sign {\n                return -k_cosf(x64 + S1_PIO2);\n            } else {\n                return k_cosf(x64 - S1_PIO2);\n            }\n        }\n        return k_sinf(if sign {\n            -(x64 + S2_PIO2)\n        } else {\n            -(x64 - S2_PIO2)\n        });\n    }\n    if ix <= 0x40e231d5 {\n        /* |x| ~<= 9*pi/4 */\n        if ix <= 0x40afeddf {\n            /* |x| ~<= 7*pi/4 */\n            if sign {\n                return k_cosf(x64 + S3_PIO2);\n            } else {\n                return -k_cosf(x64 - S3_PIO2);\n            }\n        }\n        return k_sinf(if sign { x64 + S4_PIO2 } else { x64 - S4_PIO2 });\n    }\n\n    /* sin(Inf or NaN) is NaN */\n    if ix >= 0x7f800000 {\n        return x - x;\n    }\n\n    /* general argument reduction needed */\n    let (n, y) = rem_pio2f(x);\n    match n & 3 {\n        0 => k_sinf(y),\n        1 => k_cosf(y),\n        2 => k_sinf(-y),\n        _ => -k_cosf(y),\n    }\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/tan.rs",
    "sha256": "3596d07a52728f17ba84aa3861ff7b4a9428814b86c654de63b95770d6c4ad77",
    "text": "// origin: FreeBSD /usr/src/lib/msun/src/s_tan.c */\n//\n// ====================================================\n// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n//\n// Developed at SunPro, a Sun Microsystems, Inc. business.\n// Permission to use, copy, modify, and distribute this\n// software is freely granted, provided that this notice\n// is preserved.\n// ====================================================\n\nuse super::{k_tan, rem_pio2};\n\n// tan(x)\n// Return tangent function of x.\n//\n// kernel function:\n//      k_tan           ... tangent function on [-pi/4,pi/4]\n//      rem_pio2        ... argument reduction routine\n//\n// Method.\n//      Let S,C and T denote the sin, cos and tan respectively on\n//      [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2\n//      in [-pi/4 , +pi/4], and let n = k mod 4.\n//      We have\n//\n//          n        sin(x)      cos(x)        tan(x)\n//     ----------------------------------------------------------\n//          0          S           C             T\n//          1          C          -S            -1/T\n//          2         -S          -C             T\n//          3         -C           S            -1/T\n//     ----------------------------------------------------------\n//\n// Special cases:\n//      Let trig be any of sin, cos, or tan.\n//      trig(+-INF)  is NaN, with signals;\n//      trig(NaN)    is that NaN;\n//\n// Accuracy:\n//      TRIG(x) returns trig(x) nearly rounded\n\n/// The tangent of `x` (f64).\n///\n/// `x` is specified in radians.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn tan(x: f64) -> f64 {\n    let x1p120 = f32::from_bits(0x7b800000); // 0x1p120f === 2 ^ 120\n\n    let ix = (f64::to_bits(x) >> 32) as u32 & 0x7fffffff;\n    /* |x| ~< pi/4 */\n    if ix <= 0x3fe921fb {\n        if ix < 0x3e400000 {\n            /* |x| < 2**-27 */\n            /* raise inexact if x!=0 and underflow if subnormal */\n            force_eval!(if ix < 0x00100000 {\n                x / x1p120 as f64\n            } else {\n                x + x1p120 as f64\n            });\n            return x;\n        }\n        return k_tan(x, 0.0, 0);\n    }\n\n    /* tan(Inf or NaN) is NaN */\n    if ix >= 0x7ff00000 {\n        return x - x;\n    }\n\n    /* argument reduction */\n    let (n, y0, y1) = rem_pio2(x);\n    k_tan(y0, y1, n & 1)\n}\n"
  },
  {
    "sourcePath": "src/math/libm_math/tanf.rs",
    "sha256": "2911d20a2f28ff16181ef91a66d2178f3eae4efab5063848f5482e5bfd79b601",
    "text": "/* origin: FreeBSD /usr/src/lib/msun/src/s_tanf.c */\n/*\n * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.\n * Optimized by Bruce D. Evans.\n */\n/*\n * ====================================================\n * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\n *\n * Developed at SunPro, a Sun Microsystems, Inc. business.\n * Permission to use, copy, modify, and distribute this\n * software is freely granted, provided that this notice\n * is preserved.\n * ====================================================\n */\n\nuse core::f64::consts::FRAC_PI_2;\n\nuse super::{k_tanf, rem_pio2f};\n\n/* Small multiples of pi/2 rounded to double precision. */\nconst T1_PIO2: f64 = 1. * FRAC_PI_2; /* 0x3FF921FB, 0x54442D18 */\nconst T2_PIO2: f64 = 2. * FRAC_PI_2; /* 0x400921FB, 0x54442D18 */\nconst T3_PIO2: f64 = 3. * FRAC_PI_2; /* 0x4012D97C, 0x7F3321D2 */\nconst T4_PIO2: f64 = 4. * FRAC_PI_2; /* 0x401921FB, 0x54442D18 */\n\n/// The tangent of `x` (f32).\n///\n/// `x` is specified in radians.\n#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]\npub fn tanf(x: f32) -> f32 {\n    let x64 = x as f64;\n\n    let x1p120 = f32::from_bits(0x7b800000); // 0x1p120f === 2 ^ 120\n\n    let mut ix = x.to_bits();\n    let sign = (ix >> 31) != 0;\n    ix &= 0x7fffffff;\n\n    if ix <= 0x3f490fda {\n        /* |x| ~<= pi/4 */\n        if ix < 0x39800000 {\n            /* |x| < 2**-12 */\n            /* raise inexact if x!=0 and underflow if subnormal */\n            force_eval!(if ix < 0x00800000 {\n                x / x1p120\n            } else {\n                x + x1p120\n            });\n            return x;\n        }\n        return k_tanf(x64, false);\n    }\n    if ix <= 0x407b53d1 {\n        /* |x| ~<= 5*pi/4 */\n        if ix <= 0x4016cbe3 {\n            /* |x| ~<= 3pi/4 */\n            return k_tanf(if sign { x64 + T1_PIO2 } else { x64 - T1_PIO2 }, true);\n        } else {\n            return k_tanf(if sign { x64 + T2_PIO2 } else { x64 - T2_PIO2 }, false);\n        }\n    }\n    if ix <= 0x40e231d5 {\n        /* |x| ~<= 9*pi/4 */\n        if ix <= 0x40afeddf {\n            /* |x| ~<= 7*pi/4 */\n            return k_tanf(if sign { x64 + T3_PIO2 } else { x64 - T3_PIO2 }, true);\n        } else {\n            return k_tanf(if sign { x64 + T4_PIO2 } else { x64 - T4_PIO2 }, false);\n        }\n    }\n\n    /* tan(Inf or NaN) is NaN */\n    if ix >= 0x7f800000 {\n        return x - x;\n    }\n\n    /* argument reduction */\n    let (n, y) = rem_pio2f(x);\n    k_tanf(y, n & 1 != 0)\n}\n"
  },
  {
    "sourcePath": "src/probestack.rs",
    "sha256": "e90e2f5548e7cfe7dd56a5ff3ddfbe8626dc58232b260cc87b1376eb49e553bd",
    "text": "// Copyright 2017 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n// option. This file may not be copied, modified, or distributed\n// except according to those terms.\n\n//! This module defines the `__rust_probestack` intrinsic which is used in the\n//! implementation of \"stack probes\" on certain platforms.\n//!\n//! The purpose of a stack probe is to provide a static guarantee that if a\n//! thread has a guard page then a stack overflow is guaranteed to hit that\n//! guard page. If a function did not have a stack probe then there's a risk of\n//! having a stack frame *larger* than the guard page, so a function call could\n//! skip over the guard page entirely and then later hit maybe the heap or\n//! another thread, possibly leading to security vulnerabilities such as [The\n//! Stack Clash], for example.\n//!\n//! [The Stack Clash]: https://blog.qualys.com/securitylabs/2017/06/19/the-stack-clash\n//!\n//! The `__rust_probestack` is called in the prologue of functions whose stack\n//! size is larger than the guard page, for example larger than 4096 bytes on\n//! x86. This function is then responsible for \"touching\" all pages relevant to\n//! the stack to ensure that that if any of them are the guard page we'll hit\n//! them guaranteed.\n//!\n//! The precise ABI for how this function operates is defined by LLVM. There's\n//! no real documentation as to what this is, so you'd basically need to read\n//! the LLVM source code for reference. Often though the test cases can be\n//! illuminating as to the ABI that's generated, or just looking at the output\n//! of `llc`.\n//!\n//! Note that `#[naked]` is typically used here for the stack probe because the\n//! ABI corresponds to no actual ABI.\n//!\n//! Finally it's worth noting that at the time of this writing LLVM only has\n//! support for stack probes on x86 and x86_64. There's no support for stack\n//! probes on any other architecture like ARM or PowerPC64. LLVM I'm sure would\n//! be more than welcome to accept such a change!\n\n#![cfg(not(feature = \"mangled-names\"))]\n// Windows and Cygwin already has builtins to do this.\n#![cfg(not(any(windows, target_os = \"cygwin\")))]\n// All these builtins require assembly\n#![cfg(not(feature = \"no-asm\"))]\n// We only define stack probing for these architectures today.\n#![cfg(any(target_arch = \"x86_64\", target_arch = \"x86\"))]\n\nextern \"C\" {\n    pub fn __rust_probestack();\n}\n\n// A wrapper for our implementation of __rust_probestack, which allows us to\n// keep the assembly inline while controlling all CFI directives in the assembly\n// emitted for the function.\n//\n// This is the ELF version.\n#[cfg(not(any(target_vendor = \"apple\", target_os = \"uefi\")))]\nmacro_rules! define_rust_probestack {\n    ($body: expr) => {\n        concat!(\n            \"\n            .pushsection .text.__rust_probestack\n            .globl __rust_probestack\n            .type  __rust_probestack, @function\n            .hidden __rust_probestack\n        __rust_probestack:\n            \",\n            $body,\n            \"\n            .size __rust_probestack, . - __rust_probestack\n            .popsection\n            \"\n        )\n    };\n}\n\n#[cfg(all(target_os = \"uefi\", target_arch = \"x86_64\"))]\nmacro_rules! define_rust_probestack {\n    ($body: expr) => {\n        concat!(\n            \"\n            .globl __rust_probestack\n        __rust_probestack:\n            \",\n            $body\n        )\n    };\n}\n\n// Same as above, but for Mach-O. Note that the triple underscore\n// is deliberate\n#[cfg(target_vendor = \"apple\")]\nmacro_rules! define_rust_probestack {\n    ($body: expr) => {\n        concat!(\n            \"\n            .globl ___rust_probestack\n        ___rust_probestack:\n            \",\n            $body\n        )\n    };\n}\n\n// In UEFI x86 arch, triple underscore is deliberate.\n#[cfg(all(target_os = \"uefi\", target_arch = \"x86\"))]\nmacro_rules! define_rust_probestack {\n    ($body: expr) => {\n        concat!(\n            \"\n            .globl ___rust_probestack\n        ___rust_probestack:\n            \",\n            $body\n        )\n    };\n}\n\n// Our goal here is to touch each page between %rsp+8 and %rsp+8-%rax,\n// ensuring that if any pages are unmapped we'll make a page fault.\n//\n// The ABI here is that the stack frame size is located in `%rax`. Upon\n// return we're not supposed to modify `%rsp` or `%rax`.\n//\n// Any changes to this function should be replicated to the SGX version below.\n#[cfg(all(\n    target_arch = \"x86_64\",\n    not(all(target_env = \"sgx\", target_vendor = \"fortanix\"))\n))]\ncore::arch::global_asm!(\n    define_rust_probestack!(\n        \"\n    .cfi_startproc\n    pushq  %rbp\n    .cfi_adjust_cfa_offset 8\n    .cfi_offset %rbp, -16\n    movq   %rsp, %rbp\n    .cfi_def_cfa_register %rbp\n\n    mov    %rax,%r11        // duplicate %rax as we're clobbering %r11\n\n    // Main loop, taken in one page increments. We're decrementing rsp by\n    // a page each time until there's less than a page remaining. We're\n    // guaranteed that this function isn't called unless there's more than a\n    // page needed.\n    //\n    // Note that we're also testing against `8(%rsp)` to account for the 8\n    // bytes pushed on the stack orginally with our return address. Using\n    // `8(%rsp)` simulates us testing the stack pointer in the caller's\n    // context.\n\n    // It's usually called when %rax >= 0x1000, but that's not always true.\n    // Dynamic stack allocation, which is needed to implement unsized\n    // rvalues, triggers stackprobe even if %rax < 0x1000.\n    // Thus we have to check %r11 first to avoid segfault.\n    cmp    $0x1000,%r11\n    jna    3f\n2:\n    sub    $0x1000,%rsp\n    test   %rsp,8(%rsp)\n    sub    $0x1000,%r11\n    cmp    $0x1000,%r11\n    ja     2b\n\n3:\n    // Finish up the last remaining stack space requested, getting the last\n    // bits out of r11\n    sub    %r11,%rsp\n    test   %rsp,8(%rsp)\n\n    // Restore the stack pointer to what it previously was when entering\n    // this function. The caller will readjust the stack pointer after we\n    // return.\n    add    %rax,%rsp\n\n    leave\n    .cfi_def_cfa_register %rsp\n    .cfi_adjust_cfa_offset -8\n    ret\n    .cfi_endproc\n    \"\n    ),\n    options(att_syntax)\n);\n\n// This function is the same as above, except that some instructions are\n// [manually patched for LVI].\n//\n// [manually patched for LVI]: https://software.intel.com/security-software-guidance/insights/deep-dive-load-value-injection#specialinstructions\n#[cfg(all(\n    target_arch = \"x86_64\",\n    all(target_env = \"sgx\", target_vendor = \"fortanix\")\n))]\ncore::arch::global_asm!(\n    define_rust_probestack!(\n        \"\n    .cfi_startproc\n    pushq  %rbp\n    .cfi_adjust_cfa_offset 8\n    .cfi_offset %rbp, -16\n    movq   %rsp, %rbp\n    .cfi_def_cfa_register %rbp\n\n    mov    %rax,%r11        // duplicate %rax as we're clobbering %r11\n\n    // Main loop, taken in one page increments. We're decrementing rsp by\n    // a page each time until there's less than a page remaining. We're\n    // guaranteed that this function isn't called unless there's more than a\n    // page needed.\n    //\n    // Note that we're also testing against `8(%rsp)` to account for the 8\n    // bytes pushed on the stack orginally with our return address. Using\n    // `8(%rsp)` simulates us testing the stack pointer in the caller's\n    // context.\n\n    // It's usually called when %rax >= 0x1000, but that's not always true.\n    // Dynamic stack allocation, which is needed to implement unsized\n    // rvalues, triggers stackprobe even if %rax < 0x1000.\n    // Thus we have to check %r11 first to avoid segfault.\n    cmp    $0x1000,%r11\n    jna    3f\n2:\n    sub    $0x1000,%rsp\n    test   %rsp,8(%rsp)\n    sub    $0x1000,%r11\n    cmp    $0x1000,%r11\n    ja     2b\n\n3:\n    // Finish up the last remaining stack space requested, getting the last\n    // bits out of r11\n    sub    %r11,%rsp\n    test   %rsp,8(%rsp)\n\n    // Restore the stack pointer to what it previously was when entering\n    // this function. The caller will readjust the stack pointer after we\n    // return.\n    add    %rax,%rsp\n\n    leave\n    .cfi_def_cfa_register %rsp\n    .cfi_adjust_cfa_offset -8\n    pop %r11\n    lfence\n    jmp *%r11\n    .cfi_endproc\n    \"\n    ),\n    options(att_syntax)\n);\n\n#[cfg(all(target_arch = \"x86\", not(target_os = \"uefi\")))]\n// This is the same as x86_64 above, only translated for 32-bit sizes. Note\n// that on Unix we're expected to restore everything as it was, this\n// function basically can't tamper with anything.\n//\n// The ABI here is the same as x86_64, except everything is 32-bits large.\ncore::arch::global_asm!(\n    define_rust_probestack!(\n        \"\n    .cfi_startproc\n    push   %ebp\n    .cfi_adjust_cfa_offset 4\n    .cfi_offset %ebp, -8\n    mov    %esp, %ebp\n    .cfi_def_cfa_register %ebp\n    push   %ecx\n    mov    %eax,%ecx\n\n    cmp    $0x1000,%ecx\n    jna    3f\n2:\n    sub    $0x1000,%esp\n    test   %esp,8(%esp)\n    sub    $0x1000,%ecx\n    cmp    $0x1000,%ecx\n    ja     2b\n\n3:\n    sub    %ecx,%esp\n    test   %esp,8(%esp)\n\n    add    %eax,%esp\n    pop    %ecx\n    leave\n    .cfi_def_cfa_register %esp\n    .cfi_adjust_cfa_offset -4\n    ret\n    .cfi_endproc\n    \"\n    ),\n    options(att_syntax)\n);\n\n#[cfg(all(target_arch = \"x86\", target_os = \"uefi\"))]\n// UEFI target is windows like target. LLVM will do _chkstk things like windows.\n// probestack function will also do things like _chkstk in MSVC.\n// So we need to sub %ax %sp in probestack when arch is x86.\n//\n// REF: Rust commit(74e80468347)\n// rust\\src\\llvm-project\\llvm\\lib\\Target\\X86\\X86FrameLowering.cpp: 805\n// Comments in LLVM:\n//   MSVC x32's _chkstk and cygwin/mingw's _alloca adjust %esp themselves.\n//   MSVC x64's __chkstk and cygwin/mingw's ___chkstk_ms do not adjust %rsp\n//   themselves.\ncore::arch::global_asm!(\n    define_rust_probestack!(\n        \"\n    .cfi_startproc\n    push   %ebp\n    .cfi_adjust_cfa_offset 4\n    .cfi_offset %ebp, -8\n    mov    %esp, %ebp\n    .cfi_def_cfa_register %ebp\n    push   %ecx\n    push   %edx\n    mov    %eax,%ecx\n\n    cmp    $0x1000,%ecx\n    jna    3f\n2:\n    sub    $0x1000,%esp\n    test   %esp,8(%esp)\n    sub    $0x1000,%ecx\n    cmp    $0x1000,%ecx\n    ja     2b\n\n3:\n    sub    %ecx,%esp\n    test   %esp,8(%esp)\n    mov    4(%ebp),%edx\n    mov    %edx, 12(%esp)\n    add    %eax,%esp\n    pop    %edx\n    pop    %ecx\n    leave\n\n    sub   %eax, %esp\n    .cfi_def_cfa_register %esp\n    .cfi_adjust_cfa_offset -4\n    ret\n    .cfi_endproc\n    \"\n    ),\n    options(att_syntax)\n);\n"
  }
]
