Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 650 651 652 653 654 655 656 657 658 659 660 .. 18013
1,801,219 events total
2021-06-25 17:09:55 <davean> *at least the range*
2021-06-25 17:10:12 <davean> Thats the smallest it is allowed to be
2021-06-25 17:10:33 <qrpnxz> ah thanks
2021-06-25 17:10:37 <qrpnxz> make sense then
2021-06-25 17:12:04 <qrpnxz> Las[m], well, if you do maxBound for CInt it comes out to like 32-bit
2021-06-25 17:12:25 <davean> Right so CInt matches the platform
2021-06-25 17:12:34 <qrpnxz> i'm on 64-bit
2021-06-25 17:12:35 <davean> you must be on an ILP32 or LP64 platform
2021-06-25 17:12:43 <qrpnxz> ah yeah
2021-06-25 17:13:28 <davean> https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models
2021-06-25 17:13:37 <davean> "Most Unix and Unix-like systems, e.g., Solaris, Linux, BSD, macOS. Windows when using Cygwin; z/OS"
2021-06-25 17:13:38 <Las[m]> yes and that makes sense, but I don't get why fromIntegral has this odd behavior
2021-06-25 17:13:48 <Las[m]> where it defaults to -1 if it's out of bounds...
2021-06-25 17:13:55 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-06-25 17:13:56 <Las[m]> doesn't it make much more sense just to clamp to the bounds?
2021-06-25 17:14:03 <Las[m]> so that it should evaluate to maxBound if over the max
2021-06-25 17:14:09 <Cale> It does neither of those
2021-06-25 17:14:12 <davean> Las[m]: No, understand what a machine Int is
2021-06-25 17:14:15 <davean> its twos compliment
2021-06-25 17:14:33 <davean> what you are getting is the 32 bit portion of the max bound 64 bit number
2021-06-25 17:15:01 <davean> this is how every binary computers you're at all familiar with works basicly.
2021-06-25 17:15:10 <davean> Its not the only way, but its the only way actually used :)
2021-06-25 17:15:12 Morrow joins (~MorrowM_@147.161.13.193)
2021-06-25 17:15:19 <davean> and for good numerical reasons
2021-06-25 17:15:34 <Cale> fromInteger is generally going to have the property that fromInteger (x + y) = fromInteger x + fromInteger y
2021-06-25 17:16:09 <Las[m]> ah, yeah, so if you just take the lower bits, it becomes -1, makes sense in that way
2021-06-25 17:16:16 <qrpnxz> ah it's masking, makes sense
2021-06-25 17:16:24 <qrpnxz> in a way lol
2021-06-25 17:16:31 <Las[m]> though it's still very rarely the behavior you want I assume
2021-06-25 17:16:39 <davean> But this is a Haskell channel, you're asking CPU questions ;)
2021-06-25 17:16:52 <qrpnxz> if it were a word it would make more sense
2021-06-25 17:16:53 <Cale> If it helps, you can also just think of it as the ring homomorphism from the integers
2021-06-25 17:16:56 <qrpnxz> for int doesn't make much sense
2021-06-25 17:16:57 <qrpnxz> tbh
2021-06-25 17:17:18 kayprish joins (~kayprish@46.240.143.86)
2021-06-25 17:17:22 <Cale> which is going to be uniquely determined, generally
2021-06-25 17:17:37 × mason0 quits (~bc817c21@199.204.85.195) (Quit: CGI:IRC (Session timeout))
2021-06-25 17:18:26 <davean> qrpnxz: the other options end up being worse in general basicly.
2021-06-25 17:18:41 <Cale> The wrapping around comes from the fact that CInt is going to be the integers modulo 2^32 or whatever, so that's just what happens when you take 2^64 - 1 and take the remainder after division by 2^32
2021-06-25 17:18:42 <davean> qrpnxz: But theres *no* option you want when you take an out of range value to a smaller set, in general
2021-06-25 17:19:03 <davean> qrpnxz: this ends up being the mathematically least shitty
2021-06-25 17:19:08 <qrpnxz> indeed
2021-06-25 17:19:14 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-06-25 17:19:21 hnOsmium0001 joins (uid453710@id-453710.stonehaven.irccloud.com)
2021-06-25 17:19:24 <qrpnxz> ok, i'm wrapping gang. Moral of the story is, if big nums can happen, use Integer
2021-06-25 17:19:25 <qrpnxz> xD
2021-06-25 17:20:43 <davean> qrpnxz: Hey so! Theres actually better conversion functions also! You don't have to take it unconditionally.
2021-06-25 17:20:53 <Las[m]> yes, and that is extremely inconvenient
2021-06-25 17:21:17 × howdy quits (~user@2001:8003:2432:d501:7c9a:6d35:e5a2:fb9c) (Ping timeout: 252 seconds)
2021-06-25 17:21:31 × pbrisbin quits (~patrick@pool-173-49-147-28.phlapa.fios.verizon.net) (Quit: WeeChat 3.1)
2021-06-25 17:21:45 pbrisbin joins (~patrick@pool-173-49-147-28.phlapa.fios.verizon.net)
2021-06-25 17:22:55 <davean> You have things like https://hackage.haskell.org/package/int-cast-0.2.0.0/docs/Data-IntCast.html
2021-06-25 17:23:37 notzmv joins (~zmv@user/notzmv)
2021-06-25 17:23:41 <Las[m]> Cale: thanks, makes sense then
2021-06-25 17:24:38 minoru_shiraeesh joins (~shiraeesh@109.166.57.198)
2021-06-25 17:25:37 tbd joins (~user@p200300d9df0f1f00e670b8fffeaa0fa5.dip0.t-ipconnect.de)
2021-06-25 17:29:40 × argento quits (~argent0@168-227-97-29.ptr.westnet.com.ar) (Ping timeout: 272 seconds)
2021-06-25 17:31:34 × tbd quits (~user@p200300d9df0f1f00e670b8fffeaa0fa5.dip0.t-ipconnect.de) (Ping timeout: 272 seconds)
2021-06-25 17:33:42 Lycurgus joins (~juan@cpe-45-46-140-49.buffalo.res.rr.com)
2021-06-25 17:38:57 chronon joins (~chronon@user/chronon)
2021-06-25 17:39:25 Erutuon joins (~Erutuon@user/erutuon)
2021-06-25 17:45:15 × kayprish quits (~kayprish@46.240.143.86) (Remote host closed the connection)
2021-06-25 17:46:29 <ephemient> > let x = 2 ^ 64 in (x, fromIntegral x) :: (Integer, Int) -- just to give an example; it doesn't "default to -1"
2021-06-25 17:46:31 <lambdabot> (18446744073709551616,0)
2021-06-25 17:47:15 × flounders quits (~flounders@173.246.200.33) (Quit: Leaving)
2021-06-25 17:49:19 lavaman joins (~lavaman@98.38.249.169)
2021-06-25 17:51:08 warnz joins (~warnz@2600:1700:77c0:5610:350e:4738:7a75:35e)
2021-06-25 17:52:02 argento joins (~argent0@168-227-97-29.ptr.westnet.com.ar)
2021-06-25 17:55:05 × warnz quits (~warnz@2600:1700:77c0:5610:350e:4738:7a75:35e) (Remote host closed the connection)
2021-06-25 17:55:06 zmt00 joins (~zmt00@user/zmt00)
2021-06-25 17:57:48 × dajoer quits (~david@user/gvx) (Quit: leaving)
2021-06-25 17:58:03 <gentauro> > let x = 2 ^ 64 in (x, fromIntegral x) :: (Integer, Int)
2021-06-25 17:58:05 <lambdabot> (18446744073709551616,0)
2021-06-25 17:58:12 <gentauro> > let x = 2 ^ 63 in (x, fromIntegral x) :: (Integer, Int)
2021-06-25 17:58:13 <lambdabot> (9223372036854775808,-9223372036854775808)
2021-06-25 17:58:22 <gentauro> > let x = (2 ^ 63) - 1 in (x, fromIntegral x) :: (Integer, Int)
2021-06-25 17:58:24 <lambdabot> (9223372036854775807,9223372036854775807)
2021-06-25 17:58:29 <gentauro> hmmm
2021-06-25 17:59:27 warnz joins (~warnz@2600:1700:77c0:5610:350e:4738:7a75:35e)
2021-06-25 17:59:48 × MQ-17J quits (~MQ-17J@8.21.10.15) (Ping timeout: 252 seconds)
2021-06-25 18:00:00 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-06-25 18:01:51 × cfricke quits (~cfricke@user/cfricke) (Quit: WeeChat 3.2)
2021-06-25 18:02:02 × minoru_shiraeesh quits (~shiraeesh@109.166.57.198) (Read error: Connection reset by peer)
2021-06-25 18:03:06 × justsomeguy quits (~justsomeg@user/justsomeguy) (Ping timeout: 252 seconds)
2021-06-25 18:03:28 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:c4e3:f231:bc2a:37da) (Remote host closed the connection)
2021-06-25 18:06:08 econo joins (uid147250@user/econo)
2021-06-25 18:06:55 × dunkeln quits (~dunkeln@188.71.193.140) (Ping timeout: 244 seconds)
2021-06-25 18:07:14 × Lycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt)
2021-06-25 18:08:47 × MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Quit: Quit)
2021-06-25 18:09:01 MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com)
2021-06-25 18:09:36 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-06-25 18:09:49 × derelict quits (~derelict@user/derelict) (Ping timeout: 272 seconds)
2021-06-25 18:13:06 tromp joins (~textual@dhcp-077-249-230-040.chello.nl)
2021-06-25 18:13:24 <dmj`> > do { x <- [1..10]; fail "oh no"; pure x; }
2021-06-25 18:13:25 <lambdabot> []
2021-06-25 18:15:15 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:c4e3:f231:bc2a:37da)
2021-06-25 18:15:18 × Guest33 quits (~textual@c-107-4-204-12.hsd1.mn.comcast.net) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-06-25 18:15:22 × lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection)
2021-06-25 18:17:48 <dmwit> > -9223372036854775808 - 1 :: Int
2021-06-25 18:17:50 <lambdabot> 9223372036854775807

All times are in UTC.