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

Const floating point bitcasts and classification #72449

Merged
merged 4 commits into from
Aug 23, 2020

Conversation

ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented May 22, 2020

Makes the f32 and f64 methods described in #72447 and #72505 unstably const.

r? @RalfJung

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 22, 2020
@RalfJung
Copy link
Member

LGTM, but I'd also like to know what @oli-obk thinks.

@RalfJung
Copy link
Member

Would it make sense to also add abs_private and is_finite to the batch of functions that are being constified here? It's just a trivial wrapper around to_bits/from_bits.

Asking for #72440.

@ecstatic-morse
Copy link
Contributor Author

Would it make sense to also add abs_private and is_finite to the batch of functions that are being constified here?

Sure.

@ecstatic-morse ecstatic-morse changed the title Const floating point bitcasts Const floating point bitcasts and classification May 23, 2020
@rust-highfive

This comment has been minimized.

@oli-obk
Copy link
Contributor

oli-obk commented May 26, 2020

lgtm. Stabilizing these will be blocked on stabilizing floating point types in const fn.

@Elinvynia Elinvynia added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 3, 2020
@ecstatic-morse
Copy link
Contributor Author

Going through old PRs today. Is there still desire for this? I'll close if not.

@RalfJung
Copy link
Member

Sorry, I had no idea this was waiting for my review. @Elinvynia a ping would have helped. :)

@Elinvynia
Copy link
Contributor

Unfortunately, we aren't allowed to ping team members.

@RalfJung
Copy link
Member

@bors r=RalfJung,oli-obk

@bors
Copy link
Contributor

bors commented Jun 12, 2020

📌 Commit 9dadeb3 has been approved by RalfJung,oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 12, 2020
RalfJung added a commit to RalfJung/rust that referenced this pull request Jun 12, 2020
… r=RalfJung,oli-obk

Const floating point bitcasts and classification

Makes the `f32` and `f64` methods described in rust-lang#72447 and rust-lang#72505 unstably const.

r? @RalfJung
@RalfJung
Copy link
Member

RalfJung commented Aug 7, 2020

@ecstatic-morse sorry for the long silence. Could you rebase and address my latest review? Then I think this can land.

@ecstatic-morse
Copy link
Contributor Author

This is ready to go now. I don't see a path to stabilization for these until we resolve the questions around determinism that are blocking floating point operations inside const fn, but I don't see a reason that nightly users shouldn't be allowed to experiment with them.

@RalfJung
Copy link
Member

r=me with the test attributes fixed.

Co-authored-by: Ralf Jung <post@ralfj.de>
@RalfJung
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Aug 23, 2020

📌 Commit 130766c has been approved by RalfJung

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 23, 2020
@bors
Copy link
Contributor

bors commented Aug 23, 2020

⌛ Testing commit 130766c with merge 0ec9459...

@bors
Copy link
Contributor

bors commented Aug 23, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: RalfJung
Pushing 0ec9459 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 23, 2020
@bors bors merged commit 0ec9459 into rust-lang:master Aug 23, 2020
CDirkx added a commit to CDirkx/rust that referenced this pull request Sep 12, 2020
Make the following methods of `Duration` unstable const under `duration_const_2`:
 - `from_secs_f64`
 - `from_secs_f32`
 - `mul_f64`
 - `mul_f32`
 - `div_f64`
 - `div_f32`

This results in all methods of `Duration` being (unstable) const.

Also adds tests for these methods in a const context, moved the test to `library` as part of rust-lang#76268.

Possible because of rust-lang#72449, which made the relevant `f32` and `f64` methods const.

Tracking issue: rust-lang#72440
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 12, 2020
…orse

Make all methods of `Duration` unstably const

Make the following methods of `Duration` unstable const under `duration_const_2`:
 - `from_secs_f64`
 - `from_secs_f32`
 - `mul_f64`
 - `mul_f32`
 - `div_f64`
 - `div_f32`

This results in all methods of `Duration` being (unstable) const.

Moved the tests to `library` as part of rust-lang#76268.

Possible because of rust-lang#72449, which made the relevant `f32` and `f64` methods const.

Tracking issue: rust-lang#72440

r? @ecstatic-morse
RalfJung added a commit to RalfJung/rust that referenced this pull request Sep 13, 2020
…orse

Make all methods of `Duration` unstably const

Make the following methods of `Duration` unstable const under `duration_const_2`:
 - `from_secs_f64`
 - `from_secs_f32`
 - `mul_f64`
 - `mul_f32`
 - `div_f64`
 - `div_f32`

This results in all methods of `Duration` being (unstable) const.

Moved the tests to `library` as part of rust-lang#76268.

Possible because of rust-lang#72449, which made the relevant `f32` and `f64` methods const.

Tracking issue: rust-lang#72440

r? @ecstatic-morse
RalfJung added a commit to RalfJung/rust that referenced this pull request Sep 13, 2020
…orse

Make all methods of `Duration` unstably const

Make the following methods of `Duration` unstable const under `duration_const_2`:
 - `from_secs_f64`
 - `from_secs_f32`
 - `mul_f64`
 - `mul_f32`
 - `div_f64`
 - `div_f32`

This results in all methods of `Duration` being (unstable) const.

Moved the tests to `library` as part of rust-lang#76268.

Possible because of rust-lang#72449, which made the relevant `f32` and `f64` methods const.

Tracking issue: rust-lang#72440

r? @ecstatic-morse
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Sep 16, 2020
…orse

Make all methods of `Duration` unstably const

Make the following methods of `Duration` unstable const under `duration_const_2`:
 - `from_secs_f64`
 - `from_secs_f32`
 - `mul_f64`
 - `mul_f32`
 - `div_f64`
 - `div_f32`

This results in all methods of `Duration` being (unstable) const.

Moved the tests to `library` as part of rust-lang#76268.

Possible because of rust-lang#72449, which made the relevant `f32` and `f64` methods const.

Tracking issue: rust-lang#72440

r? @ecstatic-morse
RalfJung added a commit to RalfJung/rust that referenced this pull request Sep 16, 2020
…orse

Make all methods of `Duration` unstably const

Make the following methods of `Duration` unstable const under `duration_const_2`:
 - `from_secs_f64`
 - `from_secs_f32`
 - `mul_f64`
 - `mul_f32`
 - `div_f64`
 - `div_f32`

This results in all methods of `Duration` being (unstable) const.

Moved the tests to `library` as part of rust-lang#76268.

Possible because of rust-lang#72449, which made the relevant `f32` and `f64` methods const.

Tracking issue: rust-lang#72440

r? @ecstatic-morse
@ecstatic-morse ecstatic-morse deleted the const-float-bitcast branch October 6, 2020 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants