Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Combine the source files for more generic implementations #537

Merged
merged 3 commits into from
Apr 18, 2025

Conversation

tgross35
Copy link
Contributor

Splitting into different source files by float size doesn't have any
benefit when the only content is a small function that forwards to the
generic implementation. Combine the source files for all width versions
of:

  • ceil
  • copysign
  • fabs
  • fdim
  • floor
  • fmaximum
  • fmaximum_num
  • fminimum
  • fminimum_num
  • ldexp
  • scalbn
  • sqrt
  • truc

fmod is excluded to avoid conflicts with an open PR.

As part of this change move unit tests out of the generic module,
instead testing the type-specific functions (e.g. ceilf16 rather than
ceil::<f16>()). This ensures that unit tests are validating whatever
we expose, such as arch-specific implementations via
select_implementation!, which would otherwise be skipped. (They are
still covered by integration tests).

Introduce a constant representing NaN with a negative sign bit for use
with testing. There isn't really any guarantee that `F::NAN` is positive
but in practice it always is, which is good enough for testing purposes.
Splitting into different source files by float size doesn't have any
benefit when the only content is a small function that forwards to the
generic implementation. Combine the source files for all width versions
of:

* ceil
* copysign
* fabs
* fdim
* floor
* fmaximum
* fmaximum_num
* fminimum
* fminimum_num
* ldexp
* scalbn
* sqrt
* truc

fmod is excluded to avoid conflicts with an open PR.

As part of this change move unit tests out of the generic module,
instead testing the type-specific functions (e.g. `ceilf16` rather than
`ceil::<f16>()`). This ensures that unit tests are validating whatever
we expose, such as arch-specific implementations via
`select_implementation!`, which would otherwise be skipped. (They are
still covered by integration tests).
@tgross35 tgross35 enabled auto-merge (rebase) April 18, 2025 01:09
@tgross35 tgross35 merged commit 5c0e7b4 into rust-lang:master Apr 18, 2025
35 checks passed
tgross35 added a commit to tgross35/rust-libm that referenced this pull request Apr 18, 2025
Since `fmod` is generic, there isn't any need to have the small wrappers
in separate files. Most operations was done in [1] but `fmod` was
omitted until now.

[1]: rust-lang#537
@tgross35 tgross35 deleted the combine-generic branch April 18, 2025 07:17
tgross35 added a commit to tgross35/rust-libm that referenced this pull request Apr 18, 2025
Since `fmod` is generic, there isn't any need to have the small wrappers
in separate files. Most operations was done in [1] but `fmod` was
omitted until now.

[1]: rust-lang#537
tgross35 added a commit to tgross35/rust-libm that referenced this pull request Apr 18, 2025
Since `fmod` is generic, there isn't any need to have the small wrappers
in separate files. Most operations was done in [1] but `fmod` was
omitted until now.

[1]: rust-lang#537
tgross35 added a commit to tgross35/rust-libm that referenced this pull request Apr 18, 2025
Since `fmod` is generic, there isn't any need to have the small wrappers
in separate files. Most operations was done in [1] but `fmod` was
omitted until now.

[1]: rust-lang#537
tgross35 added a commit to tgross35/rust-libm that referenced this pull request Apr 18, 2025
Since `fmod` is generic, there isn't any need to have the small wrappers
in separate files. Most operations was done in [1] but `fmod` was
omitted until now.

[1]: rust-lang#537
tgross35 added a commit to tgross35/rust-libm that referenced this pull request Apr 18, 2025
Since `fmod` is generic, there isn't any need to have the small wrappers
in separate files. Most operations was done in [1] but `fmod` was
omitted until now.

[1]: rust-lang#537
tgross35 added a commit that referenced this pull request Apr 18, 2025
Since `fmod` is generic, there isn't any need to have the small wrappers
in separate files. Most operations was done in [1] but `fmod` was
omitted until now.

[1]: #537
tgross35 added a commit that referenced this pull request Apr 18, 2025
Since `fmod` is generic, there isn't any need to have the small wrappers
in separate files. Most operations was done in [1] but `fmod` was
omitted until now.

[1]: #537
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant