Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Issue for core_float_math #137578

Open
4 tasks
tgross35 opened this issue Feb 25, 2025 · 0 comments
Open
4 tasks

Tracking Issue for core_float_math #137578

tgross35 opened this issue Feb 25, 2025 · 0 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@tgross35
Copy link
Contributor

tgross35 commented Feb 25, 2025

Feature gate: #![feature(core_float_math)]

This is a tracking issue for floating point math operations in core.

Public API

The following API will be made available in core:

impl {f16, f32, f64, f128} {
    pub fn floor(self) -> Self;
    pub fn ceil(self) -> Self;
    pub fn round(self) -> Self;
    pub fn round_ties_even(self) -> Self;
    pub fn trunc(self) -> Self;
    pub fn fract(self) -> Self;
    pub fn mul_add(self, a: Self, b: Self) -> Self;
    pub fn div_euclid(self, rhs: f128) -> Self;
    pub fn rem_euclid(self, rhs: f128) -> Self;
    pub fn powi(self, n: i32) -> Self;
    pub fn sqrt(self) -> Self;
    // Not yet added to f128
    pub fn cbrt(self) -> Self;
    // Deprecated, but there isn't any reason not to move ti
    pub fn abs_sub(self, other: Self) -> Self;
}

More will be added in the future.

For f32 and f64, it isn't easily possible to have the methods unstable in core but stable in std, so standalone functions are used for the feature gate (e.g. core::f32::sqrt). For stabilization these will be changed to inherent and the duplicates in std removed.

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

@tgross35 tgross35 added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Feb 25, 2025
tgross35 added a commit to tgross35/rust that referenced this issue Mar 6, 2025
Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763
tgross35 added a commit to tgross35/rust that referenced this issue Mar 6, 2025
Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763
tgross35 added a commit to tgross35/rust that referenced this issue Mar 6, 2025
Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2025
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763

r? `@ghost`

try-job: aarch64-gnu
try-job: arm-android
tru-job: armhf-gnu
try-job: test-various
try-job: x86_64-apple-1
try-job: aarch64-apple
try-job: i686-msvc-1
try-job: x86_64-msvc-ext2
tgross35 added a commit to tgross35/rust that referenced this issue Mar 6, 2025
Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2025
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763

r? `@ghost`

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: arm-android
tru-job: armhf-gnu
try-job: dist-various-1
try-job: dist-various-2
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-apple-1
try-job: x86_64-msvc-ext2
tgross35 added a commit to tgross35/rust that referenced this issue Mar 6, 2025
Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2025
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1], with the exception of `powi` that has been there longer.

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763

r? `@ghost`

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: arm-android
tru-job: armhf-gnu
try-job: dist-various-1
try-job: dist-various-2
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-apple-1
try-job: x86_64-msvc-ext2
tgross35 added a commit to tgross35/rust that referenced this issue Mar 6, 2025
Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2025
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1], with the exception of `powi` that has been there longer.

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763

r? `@ghost`

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: arm-android
tru-job: armhf-gnu
try-job: dist-various-1
try-job: dist-various-2
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-apple-1
try-job: x86_64-msvc-ext2
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2025
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1], with the exception of `powi` that has been there longer.

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763

r? `@ghost`

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: arm-android
tru-job: armhf-gnu
try-job: dist-various-1
try-job: dist-various-2
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-apple-1
try-job: x86_64-msvc-ext2
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 6, 2025
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1], with the exception of `powi` that has been there longer.

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763

r? `@ghost`

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: arm-android
tru-job: armhf-gnu
try-job: dist-various-1
try-job: dist-various-2
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-apple-1
try-job: x86_64-msvc-ext2
tgross35 added a commit to tgross35/rust that referenced this issue Mar 7, 2025
Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1].

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763
bors added a commit to rust-lang-ci/rust that referenced this issue Mar 7, 2025
Initial implementation of `core_float_math`

Since [1], `compiler-builtins` makes a certain set of math symbols
weakly available on all platforms. This means we can begin exposing some
of the related functions in `core`, so begin this process here.

It is not possible to provide inherent methods in both `core` and `std`
while giving them different stability gates, so standalone functions are
added instead. This provides a way to experiment with the functionality
while unstable; once it is time to stabilize, they can be converted to
inherent.

For `f16` and `f128`, everything is unstable so we can move the inherent
methods.

The following are included to start:

* floor
* ceil
* round
* round_ties_even
* trunc
* fract
* mul_add
* div_euclid
* rem_euclid
* powi
* sqrt
* abs_sub
* cbrt

These mirror the set of functions that we have in `compiler-builtins`
since [1], with the exception of `powi` that has been there longer.

Tracking issue: rust-lang#137578

[1]: rust-lang/compiler-builtins#763

r? `@ghost`

try-job: aarch64-apple
try-job: aarch64-gnu
try-job: arm-android
tru-job: armhf-gnu
try-job: dist-various-1
try-job: dist-various-2
try-job: i686-msvc-1
try-job: test-various
try-job: x86_64-apple-1
try-job: x86_64-msvc-ext2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant