2024/05/10

Newest at the top

2024-05-10 23:40:30 +0200 <monochrom> GHC.Num.Integer may be more future proof.
2024-05-10 23:40:05 +0200 <EvanR> snazzy
2024-05-10 23:38:34 +0200 <talismanick> `(\n -> I# (integerLog2# n))`
2024-05-10 23:38:24 +0200 <talismanick> the SO answer fixed it, yeah
2024-05-10 23:38:18 +0200 <monochrom> But GHC.Integer.Logarithms has something.
2024-05-10 23:38:15 +0200mikess(~mikess@user/mikess) (Ping timeout: 256 seconds)
2024-05-10 23:37:28 +0200 <monochrom> Ah damn Data.Bits doesn't have something to count digits. Well, at least you know how to repeatedly divided by 10 or something.
2024-05-10 23:36:05 +0200philopsos(~caecilius@user/philopsos)
2024-05-10 23:35:20 +0200 <talismanick> apparently it is the outermost `fromInteger` which is to blame
2024-05-10 23:34:53 +0200 <talismanick> https://stackoverflow.com/questions/26416323/function-to-calculate-log-of-integer
2024-05-10 23:34:52 +0200 <talismanick> ah, you're right
2024-05-10 23:33:33 +0200 <monochrom> Integer surely enjoys the functions from Data.Bits, one of which can tell you about # of digits, no?
2024-05-10 23:32:58 +0200 <monochrom> Please don't go through Double (which logBase does) when counting digits of numbers that are going to be out of range of Double.
2024-05-10 23:26:59 +0200titibandit(~titibandi@user/titibandit) (Ping timeout: 252 seconds)
2024-05-10 23:26:59 +0200jmdaemon(~jmdaemon@user/jmdaemon) (Ping timeout: 264 seconds)
2024-05-10 23:23:46 +0200 <EvanR> Integer is correct, look for problem elsewhere
2024-05-10 23:23:03 +0200 <talismanick> by the time it exits the call to `naive` (naive FRACTRAN interpreter), it should have shrunk to the correct size
2024-05-10 23:22:40 +0200 <talismanick> I thought that was the call you meant, because that's where it generates large numbers
2024-05-10 23:22:11 +0200 <talismanick> https://0x0.st/X80c.txt
2024-05-10 23:21:49 +0200ystael(~ystael@user/ystael) (Ping timeout: 256 seconds)
2024-05-10 23:21:43 +0200 <talismanick> (see the paste I posted earlier, I thought that was the `fromInteger` call you meant)
2024-05-10 23:21:40 +0200 <davean> talismanick: check that?
2024-05-10 23:21:20 +0200 <talismanick> the outer one just converts it to Float so logBase stops complaining
2024-05-10 23:20:59 +0200 <glguy> o.O
2024-05-10 23:20:57 +0200 <lambdabot> arising from a use of ‘logBase’
2024-05-10 23:20:57 +0200 <lambdabot> • No instance for (Floating Rational)
2024-05-10 23:20:57 +0200 <lambdabot> error:
2024-05-10 23:20:57 +0200 <talismanick> inside `naive`, that is
2024-05-10 23:20:56 +0200 <glguy> > logBase 2.0 1.0 :: Rational
2024-05-10 23:20:54 +0200 <davean> you've checked thats what it ends up as?
2024-05-10 23:20:36 +0200 <talismanick> davean: fromInteger lifts into a Rational (Ratio Integer) with denominator 1
2024-05-10 23:20:07 +0200 <davean> No longer an integer?
2024-05-10 23:19:59 +0200 <davean> fromInteger
2024-05-10 23:19:26 +0200zetef(~quassel@2a02:2f00:5202:1200:df0b:9c52:7feb:3551) (Remote host closed the connection)
2024-05-10 23:19:19 +0200 <talismanick> but `round $ logBase 2.0 $ fromInteger $ naive fibs $ 78*5^(17-1)` returns an ungodly large number spanning several lines instead of 1597
2024-05-10 23:18:58 +0200michalz(~michalz@185.246.207.200) (Quit: ZNC 1.8.2 - https://znc.in)
2024-05-10 23:18:57 +0200 <talismanick> because `round $ logBase 2.0 $ fromInteger $ naive fibs $ 78*5^(16-1)` returns 987 as it should
2024-05-10 23:18:38 +0200 <talismanick> in any case, isn't Integer supposed to be correct for arbitrarily large numbers?
2024-05-10 23:15:33 +0200jmdaemon(~jmdaemon@user/jmdaemon)
2024-05-10 23:12:26 +0200sawilagar(~sawilagar@user/sawilagar)
2024-05-10 23:09:25 +0200peterbecich(~Thunderbi@syn-047-229-123-186.res.spectrum.com) (Ping timeout: 272 seconds)
2024-05-10 23:05:44 +0200 <monochrom> There is even a story in the religious circles about a similar thing. There is an experienced ship captain who has piloted through a certain river all his life. So someone said to him "so you know every place along that river that is not safe for the ship, right?". The captain replied "no, why should I? I need only know one safe route and stick to it."
2024-05-10 23:05:08 +0200 <darkling> It's just where the compiler noticed something odd.
2024-05-10 23:04:49 +0200 <darkling> After that, the next step is to understand that the error might not actually be at that position...
2024-05-10 23:04:06 +0200 <glguy> monochrom: pretty good that they read the error enough to know the line and column, at least. not everyone gets to that level
2024-05-10 23:03:25 +0200 <darkling> Causing specific errors deliberately is hard.
2024-05-10 23:03:17 +0200 <monochrom> I need to start actually rubbing that into those students' faces.
2024-05-10 23:02:49 +0200 <monochrom> OK I'm exaggerating. Students tell you only "it says 'syntax error at line 4 column 3'" and expect you to know how to cause it. The irony being that, since I am the teacher, therefore I was an A+ student, therefore I have never learned how to cause errors, only how to cause correct code.
2024-05-10 23:01:15 +0200 <darkling> That too. :)
2024-05-10 23:00:59 +0200 <monochrom> It is worse. Student even expects experts to be telepathic.