-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Listed in
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-floating-pointArea: Floating point numbers and arithmeticArea: Floating point numbers and arithmeticC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-langRelevant to the language teamRelevant to the language team
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
hellow554 commentedon Jul 3, 2020
Funny enough, the people are aware of this problem:
I think there's a valid reason for this, but let's see
Mark-Simulacrum commentedon Jul 3, 2020
Integer casts are essentially no-ops since the bit pattern is the same, but casting to a float would be less obvious/straightforward, IMO.
I guess you expect 1.0 as the result, same as casting through an integer gets you?
leonardo-m commentedon Jul 4, 2020
I expect f64::from(bool) to have about the same semantics of f64::from(u32::from(bool)), yes.
workingjubilee commentedon Apr 29, 2021
Which zero to return?
leonardo-m commentedon Apr 29, 2021
The same as f32::from(0_u8), that should be a +0.0.
Kixunil commentedon Mar 9, 2023
Doc says it's implemented, so this should be closed?
But what the actual hell?!
bool
and a number are conceptually different, why allow any of those conversions? IMO the only sensible conversion isif x { 1 } else { 0 }
(with compiler optimization). This is converting apples into eggs... Anyway, the ship has sailed.est31 commentedon Mar 9, 2023
This should be closed now, yes. Implementation PR was #100390.