Skip to content

There is arguably no obvious mapping from a Boolean to a float so implementation of From<bool> for f32 and f64 should document its outputs #108939

Closed
@bmoxb

Description

@bmoxb

Location

https://doc.rust-lang.org/stable/std/primitive.f32.html#impl-From%3Cbool%3E-for-f32

Summary

In Rust 1.68.0, From<bool> is implemented on f32 and f64. It is not very clear how a Boolean value could be converted into a float and the documentation offers no explanation - I had to look at the actual implementation to figure out the output value. It seems sensible that the output of this implementation of From be given in the documentation.

Metadata

Metadata

Assignees

Labels

A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-floating-pointArea: Floating point numbers and arithmetic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions