about summary refs log tree commit diff
path: root/library
AgeCommit message (Collapse)AuthorLines
2025-01-07chore: release v0.1.142github-actions[bot]-1/+7
2025-01-07Account for optimization levels other than numbersTrevor Gross-3/+3
The build script currently panics with `opt-level=z` or `opt-level=s`. Account for this here. This is the `compiler-builtins` version of [1]. Fixes: https://github.com/rust-lang/compiler-builtins/issues/742 [1]: https://github.com/rust-lang/libm/pull/417
2025-01-07Update the `libm` submoduleTrevor Gross-0/+0
This includes [1], which fixes a bug parsing non-numeric optimization levels. [1]: https://github.com/rust-lang/libm/pull/417
2025-01-07Account for optimization levels other than numbersTrevor Gross-3/+3
The build script currently panics with `opt-level=z` or `opt-level=s`. Account for this here.
2025-01-07Make extensive tests exhaustive if there are enough iterations availablebeetrees-81/+252
2025-01-07Avoid naming variables `str`Josh Triplett-7/+7
This renames variables named `str` to other names, to make sure `str` always refers to a type. It's confusing to read code where `str` (or another standard type name) is used as an identifier. It also produces misleading syntax highlighting.
2025-01-06Increase the allowed ULP for `tgammaf`Trevor Gross-1/+2
Extensive tests report that the precision isn't actually 0: ---- mp_extensive_tgammaf ---- input: (-0.00063536887,) (0xba268ee2,) expected: -1574.4668 0xc4c4cef0 actual: -1574.4667 0xc4c4ceef Caused by: ulp 1 > 0 Update ULP to reflect this. After this change, `tgammaf` extensive tests pass.
2025-01-06Rollup merge of #135139 - c410-f3r:8-years-rfc, r=jhprattJacob Pratt-8/+8
[generic_assert] Constify methods used by the formatting system cc #44838 Starts the "constification" of all the elements required to allow the execution of the formatting system in constant environments. ```rust const _: () = { panic!("{:?}", 1i32); }; ``` Further stuff is blocked by #133999.
2025-01-06Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubileeJacob Pratt-4/+6
Add support for wasm exception handling to Emscripten target This is a draft because we need some additional setting for the Emscripten target to select between the old exception handling and the new exception handling. I don't know how to add a setting like that, would appreciate advice from Rust folks. We could maybe choose to use the new exception handling if `Ctarget-feature=+exception-handling` is passed? I tried this but I get errors from llvm so I'm not doing it right.
2025-01-07chore: release v0.1.141github-actions[bot]-1/+10
2025-01-06Update the `libm` submoduleTrevor Gross-0/+0
2025-01-06Replace "intrinsic" config with "arch" configTrevor Gross-50/+37
WASM is the only architecture we use `intrinsics::` for. We probably don't want to do this for any other architectures since it is better to use assembly, or work toward getting the functions available in `core`. To more accurately reflect the relationship between arch and intrinsics, make wasm32 an `arch` module and call the intrinsics from there.
2025-01-06Update the `libm` submoduleTrevor Gross-5/+53
2025-01-06More compelling env_clear() examplesKornel-7/+15
2025-01-06Don't use intrinsics abs for `f16` and `f128` on wasm32Trevor Gross-12/+0
This configuration was duplicated from `fabs` and `fabsf`, but wasm is unlikely to have an intrinsic lowering for these float types. So, just always use the generic.
2025-01-06Remove an unused `feature = "force-soft-floats"` gateTrevor Gross-2/+0
2025-01-06Switch from using `unstable-intrinsics` to `intrinsics_enabled`Trevor Gross-6/+4
Unlike `unstable-intrinsics`, `intrinsics_enabled` gets disabled with `force-soft-floats` which is what we want here.
2025-01-06Increase the allowed precision for failing tests on i586Trevor Gross-1/+4
These will need to be fixed, for now just xfail them so this doesn't block better test coverage.
2025-01-06Enable MPFR tests on i586Trevor Gross-3/+4
MPFR does build and run correctly without SSE, but requires `force-cross` be enabled.
2025-01-06ci: Only update the github ref for pull requestsTrevor Gross-0/+1
On master, this fetch fails with: fatal: refusing to fetch into branch 'refs/heads/master' checked out at '/home/runner/work/libm/libm' Just skip the command when this shouldn't be needed.
2025-01-06Rollup merge of #135153 - crystalstall:master, r=workingjubileeMatthias Krüger-3/+3
chore: remove redundant words in comment
2025-01-06Loosen precision on i586 based on new testsTrevor Gross-1/+13
2025-01-06Add an override for failing ceil/floor tests on i586Trevor Gross-0/+10
2025-01-06Add domain and edge case tests to muslTrevor Gross-2/+101
This provides an increase in test coverage on platforms that cannot test against MPFR.
2025-01-06Add support for wasm exception handling to Emscripten targetHood Chatham-4/+6
Gated behind an unstable `-Z emscripten-wasm-eh` flag
2025-01-06Add test infrastructure for `f16` and `f128`Trevor Gross-43/+205
Update test traits to support `f16` and `f128`, as applicable. Add the new routines (`fabs` and `copysign` for `f16` and `f128`) to the list of all operations.
2025-01-06Add `fabsf16`, `fabsf128`, `copysignf16`, and `copysignf128`Trevor Gross-3/+133
Use the generic implementations to provide these simple methods.
2025-01-06Enable `f16` and `f128` when creating the API change listTrevor Gross-3/+6
Additionally, read glob output as absoulte paths. This enables the script to work properly even when invoked from a different directory.
2025-01-06Run extensive tests in CI when relevant files changeTrevor Gross-1/+206
Add a CI job with a dynamically calculated matrix that runs extensive jobs on changed files. This makes use of the new `function-definitions.json` file to determine which changed files require full tests for a routine to run.
2025-01-06Update precision based on failures from extensive testsTrevor Gross-1/+21
2025-01-06Add extensive and exhaustive testsTrevor Gross-8/+450
Add a generator that will test all inputs for input spaces `u32::MAX` or smaller (e.g. single-argument `f32` routines). For anything larger, still run approximately `u32::MAX` tests, but distribute inputs evenly across the function domain. Since we often only want to run one of these tests at a time, this implementation parallelizes within each test using `rayon`. A custom test runner is used so a progress bar is possible. Specific tests must be enabled by setting the `LIBM_EXTENSIVE_TESTS` environment variable, e.g. LIBM_EXTENSIVE_TESTS=all_f16,cos,cosf cargo run ... Testing on a recent machine, most tests take about two minutes or less. The Bessel functions are quite slow and take closer to 10 minutes, and FMA is increased to run for about the same.
2025-01-06chore: remove redundant words in commentcrystalstall-3/+3
Signed-off-by: crystalstall <crystalruby@qq.com>
2025-01-06Add more detailed definition output for `update-api-list.py`Trevor Gross-65/+945
Update the script to produce, in addition to the simple text list, a JSON file listing routine names, the types they work with, and the source files that contain a function with the routine name. This gets consumed by another script and will be used to determine which extensive CI jobs to run.
2025-01-06Rollup merge of #135111 - tgross35:float-doc-aliases, r=NoratriebMatthias Krüger-0/+8
Add doc aliases for `libm` and IEEE names Searching "fma" in the Rust documentation returns results for `intrinsics::fma*`, but does not point to the user-facing `mul_add`. Add aliases for `fma*` and the IEEE operation name `fusedMultiplyAdd`. Add the IEEE name to `sqrt` as well, `squareRoot`.
2025-01-06Add tests against MPFR for `ilogb` and `ilogbf`Trevor Gross-6/+23
2025-01-05Increase the precision for `jn` and `jnf`Trevor Gross-3/+1
New random seeds seem to indicate that this test does have some more failures, this is a recent failure on i586: ---- musl_random_jnf stdout ---- Random Musl jnf arg 1/2: 100 iterations (10000 total) using `LIBM_SEED=nLfzQ3U1OBVvqWaMBcto84UTMsC5FIaC` Random Musl jnf arg 2/2: 100 iterations (10000 total) using `LIBM_SEED=nLfzQ3U1OBVvqWaMBcto84UTMsC5FIaC` thread 'musl_random_jnf' panicked at crates/libm-test/tests/compare_built_musl.rs:43:51: called `Result::unwrap()` on an `Err` value: input: (205, 5497.891) (0x000000cd, 0x45abcf21) expected: 7.3291517e-6 0x36f5ecef actual: 7.331668e-6 0x36f6028c Caused by: ulp 5533 > 4000 It seems unlikely that `jn` would somehow have better precision than `j0`/`j1`, so just use the same precision.
2025-01-05Rename `unstable-test-support` to `unstable-public-internals`Trevor Gross-13/+10
The `support` module that this feature makes public will be useful for implementations in `compiler-builtins`, not only for testing. Give this feature a more accurate name.
2025-01-06Update precision based on new test resultsTrevor Gross-2/+11
2025-01-06Rewrite the random test generatorTrevor Gross-196/+148
Currently, all inputs are generated and then cached. This works reasonably well but it isn't very configurable or extensible (adding `f16` and `f128` is awkward). Replace this with a trait for generating random sequences of tuples. This also removes possible storage limitations of caching all inputs.
2025-01-06Add an iterator that ensures known sizeTrevor Gross-0/+37
Introduce the `KnownSize` iterator wrapper, which allows providing the size at construction time. This provides an `ExactSizeIterator` implemenation so we can check a generator's value count during testing.
2025-01-06Streamline the way that test iteration count is determinedTrevor Gross-57/+208
Currently, tests use a handful of constants to determine how many iterations to perform: `NTESTS`, `AROUND`, and `MAX_CHECK_POINTS`. This configuration is not very straightforward to adjust and needs to be repeated everywhere it is used. Replace this with new functions in the `run_cfg` module that determine iteration counts in a more reusable and documented way. This only updates `edge_cases` and `domain_logspace`, `random` is refactored in a later commit.
2025-01-06Add a way for tests to log to a fileTrevor Gross-0/+73
Occasionally it is useful to see some information from running tests without making everything noisy from `--nocapture`. Add a function to log this kind of output to a file, and print the file as part of CI.
2025-01-05Add tests against MPFR for `scalbn{f}` and `ldexp{f}`Trevor Gross-4/+28
2025-01-05[generic_assert] Constify methods used by the formatting systemCaio-8/+8
2025-01-05Rollup merge of #135121 - okaneco:const_slice_reverse, r=jhprattJacob Pratt-3/+5
Mark `slice::reverse` unstably const Tracking issue #135120 This is unblocked by the stabilization of `const_swap`
2025-01-05Add tests against MPFR for `frexp` and `frexpf`Trevor Gross-4/+19
This implementation comes from `rug::Float::to_f32_exp` [1]. [1]: https://docs.rs/rug/1.26.1/rug/struct.Float.html#method.to_f32_exp
2025-01-05Add tests against MPFR for `modf` and `modff`Trevor Gross-4/+18
Rug provides `trunc_fract_round`, which implements `modf`, use it to add a test.
2025-01-05Mark `slice::reverse` unstably constokaneco-3/+5
2025-01-05Clarified the documentation on core::iter::from_fn and core::iter::successorsranger-ross-0/+3
2025-01-04Clean up integers stored in `MpTy`Trevor Gross-12/+12
There isn't any need to cache the integer since it gets provided as an argument anyway. Simplify this in `jn` and `yn`.