Skip to content

Methods of floating point types are not available for #![no_std] #47798

Closed
@upsuper

Description

@upsuper

The following code

#![no_std]

fn main() {
    let a = 1.0f32;
    let _ = a.is_finite();
}

doesn't compile. It reports:

error[E0599]: no method named `is_finite` found for type `f32` in the current scope
 --> src/main.rs:5:15
  |
5 |     let _ = a.is_finite();
  |               ^^^^^^^^^
  |
  = help: items from traits can only be used if the trait is in scope
  = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
          candidate #1: `use core::num::Float;`

but core::num::Float is not yet stable.

The implementations of the methods should probably be moved to core rather than staying in std.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions