FedorKK (Fedor Koshel)
- Login: FedorKK
- Registered on: 05/09/2020
- Last sign in: 05/09/2020
Issues
| open | closed | Total | |
|---|---|---|---|
| Assigned issues | 0 | 0 | 0 |
| Reported issues | 0 | 1 | 1 |
Activity
05/09/2020
-
06:38 PM Ruby Bug #16843: A bug with floating point multiplication
- Ok, let's close it. It's really doesn't make any sense to improve the standard representation. But still:
``` go
func main() {
fmt.Println(0.29 * 100 == 29.0)
}
true
```
``` ruby
irb(main):001:0> 0.29 * 100 == 29.0
=... -
05:45 PM Ruby Bug #16843: A bug with floating point multiplication
- Yes, but for example in Go:
``` go
func main() {
fmt.Printf("%f", 0.29 * 100)
fmt.Println()
fmt.Printf("%f", 0.28 * 100)
fmt.Println()
fmt.Printf("%f", 0.27 * 100)
}
29.000000
28.000000
27.000000
```
-
04:50 PM Ruby Bug #16843: A bug with floating point multiplication
- The behaviour is super unpredictable. I mean, the problem with floats is known, but it usually happens with precision values, or huge numbers. In this case, if you try to get an integer from 0.29*100 you'll get 28. Which is strange.
I... -
03:49 PM Ruby Bug #16843 (Rejected): A bug with floating point multiplication
- I've reproduced it with both currently stable versions: 2.6.6 and 2.7.1.
``` ruby
irb(main):001:0> 0.29 * 100
=> 28.999999999999996
irb(main):002:0> 0.29 * 100.0
=> 28.999999999999996
irb(main):003:0> 0.28 * 100
=> 28.0000000000...