Commit Graph

7 Commits

Author SHA1 Message Date
Ralf Jung
0cd0f7ceef move f16/f128 const fn under f16/f128 feature gate 2024-10-05 10:13:18 +02:00
bors
14f303bc14 Auto merge of #130157 - eduardosm:stabilize-const_float_classify, r=RalfJung
Stabilize `const_float_classify`

Tracking issue: https://github.com/rust-lang/rust/issues/72505

Also reverts https://github.com/rust-lang/rust/pull/114486

Closes https://github.com/rust-lang/rust/issues/72505

Stabilized const API:

```rust
impl f32 {
    pub const fn is_nan(self) -> bool;
    pub const fn is_infinite(self) -> bool;
    pub const fn is_finite(self) -> bool;
    pub const fn is_subnormal(self) -> bool;
    pub const fn is_normal(self) -> bool;
    pub const fn classify(self) -> FpCategory;
    pub const fn is_sign_positive(self) -> bool;
    pub const fn is_sign_negative(self) -> bool;
}

impl f64 {
    pub const fn is_nan(self) -> bool;
    pub const fn is_infinite(self) -> bool;
    pub const fn is_finite(self) -> bool;
    pub const fn is_subnormal(self) -> bool;
    pub const fn is_normal(self) -> bool;
    pub const fn classify(self) -> FpCategory;
    pub const fn is_sign_positive(self) -> bool;
    pub const fn is_sign_negative(self) -> bool;
}
```

cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
2024-10-04 18:03:16 +00:00
Eduardo Sánchez Muñoz
c39ae569d6 Revert "Avoid invalid NaN lint machine-applicable suggestion in const context"
Reverts PR https://github.com/rust-lang/rust/pull/114486 (commit 1305a43d0a)
2024-09-25 18:54:33 +02:00
Ralf Jung
b72b42d36f move a test to a better location 2024-09-12 08:08:38 +02:00
Ralf Jung
7f7c73bd9c simplify float::classify logic 2024-09-12 08:08:38 +02:00
Ralf Jung
3daa9518d5 enable and extend float-classify test 2024-09-10 16:47:01 -07:00
Jubilee Young
c40ee79b84 move float tests into their own dir 2024-09-10 16:05:37 -07:00