Commit 23b1aad
authored
This fixes a regression from #15814 which unintentionally changed the return type of `Float32#abs` to `Float64`. Previously, it returned `Float32`.
`Math.copysign(self, 1)` falls back to the overload without restrictions which converts both arguments to `Float64` and thus returns `Float64`.
This patch fixes that by explicitly targeting the `Math.copysign(Float32, Float32)` overload for `Float32#abs`.
`Float64#abs` is not broken, but still applies an unnecessary integer-to-float conversion when we should be using a float right away.
I discovered this type mismatch while researching #13389
1 parent 9cf0528 commit 23b1aad
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
231 | | - | |
| 230 | + | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
451 | | - | |
452 | | - | |
| 451 | + | |
| 452 | + | |
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| |||
0 commit comments