Logs: liberachat/#haskell
| 2025-09-17 08:21:33 | <tomsmeding> | ah and that is because: |
| 2025-09-17 08:21:45 | <tomsmeding> | > (realToFrac (1200001.2 :: Float) :: Double, realToFrac (1200001.3 :: Float) :: Double) |
| 2025-09-17 08:21:46 | <lambdabot> | (1200001.25,1200001.25) |
| 2025-09-17 08:22:14 | <tomsmeding> | it rounds to that as a binary fraction, which gets rendered as .3 because that's the shortest representation to which the closest actual Float value is the actual value, .25 |
| 2025-09-17 08:23:03 | <yin> | > 0.1 + 0.2 :: Float |
| 2025-09-17 08:23:04 | <lambdabot> | 0.3 |
| 2025-09-17 08:23:08 | <yin> | > 0.1 + 0.2 :: Double |
| 2025-09-17 08:23:09 | <lambdabot> | 0.30000000000000004 |
| 2025-09-17 08:24:12 | × | xax__ quits (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Ping timeout: 256 seconds) |
| 2025-09-17 08:24:44 | <__monty__> | Multiplication simply multiplies the error seems like quite a dangerous assumption with floats. |
| 2025-09-17 08:25:07 | <tomsmeding> | I'm fairly sure it's accurate though |
| 2025-09-17 08:25:26 | × | merijn quits (~merijn@77.242.116.146) (*.net *.split) |
| 2025-09-17 08:25:26 | × | caconym7478 quits (~caconym@user/caconym) (*.net *.split) |
| 2025-09-17 08:25:26 | × | haveo quits (~weechat@pacamara.iuwt.fr) (*.net *.split) |
| 2025-09-17 08:25:26 | × | drlkf quits (~drlkf@chat-1.drlkf.net) (*.net *.split) |
| 2025-09-17 08:25:26 | caconym74781 | is now known as caconym7478 |
| 2025-09-17 08:28:02 | <tomsmeding> | > [(toRational (d :: Double) - r) * 5*2^55 | (d, r) <- [(0.1,1%10), (0.2,2%10), (0.3,3%10)]] |
| 2025-09-17 08:28:03 | <lambdabot> | [1 % 1,2 % 1,(-2) % 1] |
| 2025-09-17 08:28:10 | <tomsmeding> | > [(toRational (d :: Float) - r) * 5*2^24 | (d, r) <- [(0.1,1%10), (0.2,2%10), (0.3,3%10)]] |
| 2025-09-17 08:28:11 | <lambdabot> | [1 % 8,1 % 4,1 % 1] |
| 2025-09-17 08:28:11 | <__monty__> | I'm pretty sure it can't because the representational error in floats is not a continuous function, it increases in steps. So if your multiplication crosses such a boundary, your error jumps. |
| 2025-09-17 08:28:41 | → | mari-estel joins (~mari-este@user/mari-estel) |
| 2025-09-17 08:28:41 | <tomsmeding> | 0.3 in Float is much less accurate than 0.1 and 0.2, so it makes sense that 0.1 + 0.2 in Float rounds to 0.3 |
| 2025-09-17 08:28:42 | → | drlkf joins (~drlkf@chat-1.drlkf.net) |
| 2025-09-17 08:29:10 | <tomsmeding> | whereas the error of 0.3 in Double is similar in scale to that of 0.1 and 0.2, and furthermore goes in the other direction, so it makes sense that 0.1 + 0.2 in Double rounds to 0.3 + epsilon |
| 2025-09-17 08:29:12 | <tomsmeding> | yin: ^ |
| 2025-09-17 08:29:18 | <tomsmeding> | __monty__: that's fair |
| 2025-09-17 08:29:42 | <tomsmeding> | but multiplication is a one-shot operation, n * x is not x + x + ... + x |
| 2025-09-17 08:30:08 | <tomsmeding> | with n repeated additions, you'd get odd error effects around those boundaries; with a single multiplication, things are more well-behaved, I think |
| 2025-09-17 08:30:34 | <tomsmeding> | you lose precision in the product result, of course, but only after having virtually computed the correct result first |
| 2025-09-17 08:30:46 | <tomsmeding> | the correct result of the rounded inputs, that is |
| 2025-09-17 08:31:20 | → | mari73827 joins (~mari-este@user/mari-estel) |
| 2025-09-17 08:32:20 | <tomsmeding> | yin: the 5*2^55 scales etc. are arbitrary, just to make you not have to compare 1 % 180143985094819840 and 1 % 90071992547409920 |
| 2025-09-17 08:33:09 | × | mari-estel quits (~mari-este@user/mari-estel) (Read error: Connection reset by peer) |
| 2025-09-17 08:33:23 | <yin> | more precision around small numbers, right? |
| 2025-09-17 08:33:42 | <tomsmeding> | yes |
| 2025-09-17 08:33:58 | <tomsmeding> | floats are "always in scientific notation", with a fixed number of digits of precision |
| 2025-09-17 08:34:36 | <tomsmeding> | were they decimal with four digits of precision, you'd be able to represent 1.234e-4 and 1.234e100 both exactly, but not 1.2341e100 |
| 2025-09-17 08:35:01 | <tomsmeding> | this leads to more _absolute_ precision (i.e. smaller error epsilon) around small numbers |
| 2025-09-17 08:35:13 | <tomsmeding> | now they're actually binary, not decimal, but same idea applies |
| 2025-09-17 08:39:09 | → | craunts7 joins (~craunts@152.32.99.194) |
| 2025-09-17 08:39:57 | × | trickard quits (~trickard@cpe-86-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-09-17 08:42:32 | → | trickard_ joins (~trickard@cpe-86-98-47-163.wireline.com.au) |
| 2025-09-17 08:44:29 | → | vanishingideal joins (~vanishing@user/vanishingideal) |
| 2025-09-17 08:44:58 | × | yegor quits (~yegor@user/yegor) (Ping timeout: 260 seconds) |
| 2025-09-17 08:45:45 | → | ljdarj joins (~Thunderbi@user/ljdarj) |
| 2025-09-17 08:47:41 | → | hsw joins (~hsw@112-104-9-97.adsl.dynamic.seed.net.tw) |
| 2025-09-17 08:48:19 | × | ljdarj quits (~Thunderbi@user/ljdarj) (Client Quit) |
| 2025-09-17 08:48:50 | → | ljdarj joins (~Thunderbi@user/ljdarj) |
| 2025-09-17 08:53:24 | × | ljdarj quits (~Thunderbi@user/ljdarj) (Ping timeout: 256 seconds) |
| 2025-09-17 08:53:58 | × | arandombit quits (~arandombi@user/arandombit) (Ping timeout: 256 seconds) |
| 2025-09-17 08:58:54 | × | vanishingideal quits (~vanishing@user/vanishingideal) (Ping timeout: 244 seconds) |
| 2025-09-17 09:05:29 | × | marinelli quits (~weechat@gateway/tor-sasl/marinelli) (Remote host closed the connection) |
| 2025-09-17 09:05:51 | → | marinelli joins (~weechat@gateway/tor-sasl/marinelli) |
| 2025-09-17 09:05:52 | → | arandombit joins (~arandombi@user/arandombit) |
| 2025-09-17 09:06:18 | → | tremon joins (~tremon@83.80.159.219) |
| 2025-09-17 09:09:19 | → | humasect joins (~humasect@dyn-192-249-132-90.nexicom.net) |
| 2025-09-17 09:11:13 | × | arandombit quits (~arandombi@user/arandombit) (Ping timeout: 248 seconds) |
| 2025-09-17 09:13:53 | × | humasect quits (~humasect@dyn-192-249-132-90.nexicom.net) (Ping timeout: 248 seconds) |
| 2025-09-17 09:14:15 | → | CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) |
| 2025-09-17 09:16:50 | × | tromp quits (~textual@2001:1c00:3487:1b00:988d:4246:ce46:c357) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2025-09-17 09:18:11 | × | comerijn quits (~merijn@77.242.116.146) (Ping timeout: 250 seconds) |
| 2025-09-17 09:18:54 | → | acidjnk joins (~acidjnk@p200300d6e717191211482dfc0bb512ca.dip0.t-ipconnect.de) |
| 2025-09-17 09:21:10 | × | trickard_ quits (~trickard@cpe-86-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-09-17 09:21:23 | → | trickard_ joins (~trickard@cpe-86-98-47-163.wireline.com.au) |
| 2025-09-17 09:24:35 | → | arandombit joins (~arandombi@user/arandombit) |
| 2025-09-17 09:27:19 | × | CiaoSen quits (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 244 seconds) |
| 2025-09-17 09:28:53 | → | haritz joins (~hrtz@2a01:4b00:bc2e:7000:d5af:a266:ca31:5ef8) |
| 2025-09-17 09:28:53 | × | haritz quits (~hrtz@2a01:4b00:bc2e:7000:d5af:a266:ca31:5ef8) (Changing host) |
| 2025-09-17 09:28:53 | → | haritz joins (~hrtz@user/haritz) |
| 2025-09-17 09:29:06 | × | arandombit quits (~arandombi@user/arandombit) (Ping timeout: 256 seconds) |
| 2025-09-17 09:29:59 | → | merijn joins (~merijn@77.242.116.146) |
| 2025-09-17 09:31:38 | × | Square quits (~Square4@user/square) (Ping timeout: 248 seconds) |
| 2025-09-17 09:38:04 | → | Vajb joins (~Vajb@n73x58svltwqbfu1g7z-1.v6.elisa-mobile.fi) |
| 2025-09-17 09:42:18 | × | Vajb quits (~Vajb@n73x58svltwqbfu1g7z-1.v6.elisa-mobile.fi) (Ping timeout: 248 seconds) |
| 2025-09-17 09:42:30 | → | Vajb joins (~Vajb@n4y5zw2tyued4xl9193-1.v6.elisa-mobile.fi) |
| 2025-09-17 09:42:45 | → | arandombit joins (~arandombi@user/arandombit) |
| 2025-09-17 09:45:55 | × | trickard_ quits (~trickard@cpe-86-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-09-17 09:46:23 | → | trickard_ joins (~trickard@cpe-86-98-47-163.wireline.com.au) |
| 2025-09-17 09:46:34 | × | Vajb quits (~Vajb@n4y5zw2tyued4xl9193-1.v6.elisa-mobile.fi) (Ping timeout: 248 seconds) |
| 2025-09-17 09:47:23 | → | Vajb joins (~Vajb@n86utdh10wqaniezv84-1.v6.elisa-mobile.fi) |
| 2025-09-17 09:48:12 | × | arandombit quits (~arandombi@user/arandombit) (Ping timeout: 260 seconds) |
| 2025-09-17 09:48:17 | → | inline joins (~inline@ip-005-146-196-014.um05.pools.vodafone-ip.de) |
| 2025-09-17 09:51:31 | → | tromp joins (~textual@2001:1c00:3487:1b00:988d:4246:ce46:c357) |
| 2025-09-17 09:53:22 | × | Googulator quits (~Googulato@2a01-036d-0106-217b-9021-558a-ccea-f5e8.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-09-17 09:53:37 | → | Googulator joins (~Googulato@2a01-036d-0106-217b-9021-558a-ccea-f5e8.pool6.digikabel.hu) |
| 2025-09-17 09:54:49 | → | fp joins (~Thunderbi@wireless-86-50-140-15.open.aalto.fi) |
| 2025-09-17 10:00:11 | → | fp1 joins (~Thunderbi@dhcp-87-72.eduroam.aalto.fi) |
| 2025-09-17 10:00:18 | × | hc_ quits (~hc@mail.hce.li) (Remote host closed the connection) |
| 2025-09-17 10:01:14 | → | arandombit joins (~arandombi@2603:7000:4600:ffbe:e5e7:511:ab1f:5368) |
| 2025-09-17 10:01:14 | × | arandombit quits (~arandombi@2603:7000:4600:ffbe:e5e7:511:ab1f:5368) (Changing host) |
| 2025-09-17 10:01:14 | → | arandombit joins (~arandombi@user/arandombit) |
| 2025-09-17 10:01:24 | × | fp quits (~Thunderbi@wireless-86-50-140-15.open.aalto.fi) (Ping timeout: 256 seconds) |
| 2025-09-17 10:01:24 | fp1 | is now known as fp |
| 2025-09-17 10:02:36 | → | vanishingideal joins (~vanishing@user/vanishingideal) |
| 2025-09-17 10:09:13 | × | trickard_ quits (~trickard@cpe-86-98-47-163.wireline.com.au) (Ping timeout: 255 seconds) |
| 2025-09-17 10:09:37 | → | trickard_ joins (~trickard@cpe-86-98-47-163.wireline.com.au) |
| 2025-09-17 10:09:47 | → | ubert joins (~Thunderbi@178.115.51.39.wireless.dyn.drei.com) |
| 2025-09-17 10:14:32 | trickard_ | is now known as trickard |
| 2025-09-17 10:18:16 | → | CiaoSen joins (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) |
All times are in UTC.