Help, our train home is making 9 quintillion stops.

Поділитися
Вставка
  • Опубліковано 28 лис 2019
  • Thanks as always to Jane Street! Here is that blog post about 63-bit numbers.
    blog.janestreet.com/what-is-g...
    My book is out in North America on the 21 January 2020. Pre-order now!
    bit.ly/humblepi
    Here are the numbers:
    9,223,372,036,854,775,798 stops
    2^63 = 9,223,372,036,854,775,808
    7FFFFFFFFFFFFFF6
    111111111111111111111111111111111111111111111111111111111110110
    Here are the tweets:
    Neil Codling @neilcodling
    👀 Help, our train home is making 9 quintillion stops.
    EIZrPtbW4AA3UL2.jpeg
    / 1190757074164170758
    Daniel @drawRect
    Replying to @neilcodling
    Thanks for the tweet. What version of the app are you using? I thought we fixed this bug AGES ago.
    / 1191033767760158720
    Lia Buddle @LiaBuddle
    Replying to @neilcodling
    Had the same thing in 2017...
    EIc4CNJXsAATexO.jpeg
    / 1190982241914101760
    Matt Parker @standupmaths
    Thanks everyone who sent me this amazing tweet! So, as always it’s probably a binary overflow problem and sure enough 2^63 = 9,223,372,036,854,775,808 which is close!
    / 1190940255974760448
    We have a free Think Maths magic trick activity that teachers can use to introduce their students to binary.
    think-maths.co.uk/standupmaths...
    CORRECTIONS
    - None yet, let me know if you spot any mistakes!
    Thanks again, as always, for Jane Street being my principal sponsor.
    www.janestreet.com/
    Thanks to my Patreon supporters who help make these videos possible. Here is a random subset:
    Icaro Fonseca
    Timothy Lombard
    Andy B
    Nokui
    Peter
    Tracy Parry
    Brandon
    Lindsay Miller
    Support my channel and I can make more maths videos:
    / standupmaths
    Filming and editing by Alex Genn-Bash
    Music by Howard Carter
    Design by Simon Wright
    MATT PARKER: Stand-up Mathematician
    Website: standupmaths.com/
    Maths book: wwwh.umble-pi.com
    Nerdy maths toys: mathsgear.co.uk/
  • Розваги

КОМЕНТАРІ • 2,3 тис.

  • @Gasmanic
    @Gasmanic 4 роки тому +10540

    Train passenger: That's strange, my phone says that my train is making 9 quintillion stops.
    Computer programmers: You're right, that *is* strange. I'd expect it to say 18 quintillion.

    • @bbaovanc
      @bbaovanc 4 роки тому +423

      shingebis it’s probably because 9 quintillion are negative and 9 quintillion positive.

    • @SuperFranzs
      @SuperFranzs 4 роки тому +392

      @@bbaovanc Why would the amount of stops be a signed integer?

    • @meowthecat422
      @meowthecat422 4 роки тому +673

      @@SuperFranzs because most programmers are lazy and just use int, but what i suspect is that whatever language they were using handles integers this way

    • @nblack2867
      @nblack2867 4 роки тому +315

      @@SuperFranzs Because it's easier to use a signed integer a lot of times. If you're not thinking about it, the programmers easily could have used a signed one by habit, especially if they weren't expecting someone to make so many stops that they would need all 63 bits. They would think it doesn't really matter, so just use a signed one instead, because it is often easier.

    • @calebkirschbaum8158
      @calebkirschbaum8158 4 роки тому +117

      Honestly, I can't think of all the times I have seen an error, and was like, that shouldn't happen, the error should be doing this, or even be expecting an error and get really confused when I don't see one.

  • @ChromeBirb
    @ChromeBirb 3 роки тому +3848

    My favourite 32 bit error appears in paper mario where baking a cake for 4.5 years gives you a perfectly baked cake

    • @wolfrig2000
      @wolfrig2000 3 роки тому +220

      It's always nice to see a Stryder fan

    • @knickohr01
      @knickohr01 3 роки тому +308

      And hitting a block for 416 years crashes the game

    • @realbignoob1886
      @realbignoob1886 3 роки тому +8

      @@knickohr01 ikr

    • @FandangoJepZ
      @FandangoJepZ 3 роки тому +21

      And bonking for a few minutes wins the game

    • @squibble311
      @squibble311 3 роки тому +10

      stryder7x gang

  • @No-uc6fg
    @No-uc6fg 3 роки тому +4943

    9 quintillion stops in 2 hours and 26 minutes? That's incredible.

    • @The_Bird_Bird_Harder
      @The_Bird_Bird_Harder 3 роки тому +186

      The definition of a speed considered "stopped", and the size of a "stop" are quite variable don't you know?

    • @No-uc6fg
      @No-uc6fg 3 роки тому +54

      @@The_Bird_Bird_Harder I was making a pun man... It sais 9 quintillion stops until destination and it reaches said destination in 2 hours. Was making a pun.

    • @altokia2724
      @altokia2724 3 роки тому +227

      @@No-uc6fg i dont think that's a pun lmao

    • @jakubrossa7794
      @jakubrossa7794 3 роки тому +62

      basically means you can jump of the train at any point in the journey

    • @corinnepowers9646
      @corinnepowers9646 3 роки тому +8

      Guys I'm losing my mind in my comment thread somewhere else in the comments exploring this idea... just... might be hilarious to watch me descend into madness, if you're interested xD
      I'm just an amateur so it's all over the place you know, but hey, maybe someone will do whatever it is I'm trying to do real quick and save me from doom hahaha

  • @Bananasforthesoul
    @Bananasforthesoul 4 роки тому +484

    I can’t even imagine the notifications on a 255 person WhatsApp group.

    • @tlh1337
      @tlh1337 4 роки тому +63

      I'm in a group with 215 participants and... 0 messages in the last 4 days

    • @Bananasforthesoul
      @Bananasforthesoul 4 роки тому +30

      ok lmao well must not be a bunch of friends. Any WhatsApp group I’ve been in with just 5-6 people I get 100+ notifs a day.

    • @tlh1337
      @tlh1337 4 роки тому +1

      @@Bananasforthesoul that's true.

    • @qtulhoo
      @qtulhoo 4 роки тому +3

      Nicholas Stormbreath
      Oh god that's scary.

    • @Oberon4278
      @Oberon4278 3 роки тому +5

      The very first notification I'd see would be from me leaving the group.

  • @leefisher6366
    @leefisher6366 4 роки тому +5111

    Occam's razor, Matt. Perhaps the train really is making that many stops.

    • @davidmurray3542
      @davidmurray3542 4 роки тому +440

      I would argue that the existence of 9 quintillion stops is not the simplest explanation...

    • @jamespolland958
      @jamespolland958 4 роки тому +346

      @@davidmurray3542 and I would argue that it is

    • @herbert164
      @herbert164 4 роки тому +27

      @@jamespolland958 so where would they fit?

    • @jamespolland958
      @jamespolland958 4 роки тому +414

      @@herbert164 you'd have to ask a train expert about that one man. Sory

    • @herbert164
      @herbert164 4 роки тому +37

      @@jamespolland958 So your argument is fundamentally flawed? You are not an expert. Therefore, your argument that it is the simplest explanation cannot be taken seriously. Also, if it was simple shouldn't it be simple enough for a non expert to understand?

  • @kylecobb9982
    @kylecobb9982 4 роки тому +3144

    A stop every 10 femtometres or something like that

    • @InTheBeginningTheUniverseWas
      @InTheBeginningTheUniverseWas 4 роки тому +270

      over a quadrillion stops per second

    • @Lovuschka
      @Lovuschka 4 роки тому +155

      Which means it's over 9000.

    • @pyral514
      @pyral514 4 роки тому +37

      @@Lovuschka Which mean it's over 1.

    • @Symphony_
      @Symphony_ 4 роки тому +5

      @@Lovuschka actually that was 8000 not 9 , XD

    • @Lovuschka
      @Lovuschka 4 роки тому +44

      @@Symphony_ The fan translation which became the meme was over 9000, however.

  • @thenoone
    @thenoone 3 роки тому +1153

    2:26 "You can't build a wall up to 256 blocks high"
    **laughs in 21w06a**

  • @NFSHeld
    @NFSHeld 3 роки тому +1214

    1) Have a 64 bit signed integer using 2 complement (i. e. value range is from -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807).
    2) Initialize a frontend record with the minimum value = -9,223,372,036,854,775,808 as "sentinel value" to indicate "has not been loaded yet"
    3) Asynchronously query the total number of stops from the /generalLineInfo microservice
    4) Asynchronously query the number of completed stops from the /currentTrain microservice
    5) Have an improper error handling when the /generalLineInfo query fails.
    6) Calculate that you have " - 10" stops left.
    7) Have an integer underflow and land on 9,223,372,036,854,775,798 remaining stops.

    • @willphillips2522
      @willphillips2522 2 роки тому +46

      Dang you got it all figured out

    • @throwaway-og7qs
      @throwaway-og7qs 2 роки тому +63

      this makes a whole lot more sense, when he was talking about it being a signed integer underflowing I was just like "so... how did it get to -2⁶³ + 1 exactly?"

    • @ifroad33
      @ifroad33 Рік тому +21

      @@throwaway-og7qs I'm not sure, but I think it might be possible to reach "-2^63" and not just "-2^63 + 1". The negative numbers start counting from -1, while the positives start at 0. I could be wrong, but it was a thought that popped up in my head when I read your comment! :)

    • @dominicpancella3012
      @dominicpancella3012 8 місяців тому +9

      This is why things like sleep timers and waitUntilLoaded functions tend to be built into modern query handlers (or multiprocessing tools, because either could be responsible for this error).

    • @marcasrealaccount
      @marcasrealaccount 8 місяців тому +6

      ​@@ifroad33More like it starts at 0 and goes up to 2^(n-1)-1 then it rolls over to -2^(n-1) and goes up to -1, so for a 4 bit signed integer it would start at 0 (0000) go up to 7 (0111) roll over to -8 (1000) and go up to -1 (1111).

  • @hadz8671
    @hadz8671 4 роки тому +1716

    "Humble Pi" appear at 3:14 - nice touch!

    • @Lattamonsteri
      @Lattamonsteri 4 роки тому +26

      Duuuuuude :D awesome!

    • @anasorabi123
      @anasorabi123 4 роки тому +30

      Wonder if it was on purpose

    • @sebastianjost
      @sebastianjost 4 роки тому +121

      @@anasorabi123 I think it is... Matt is the kind of guy who would insist on such details

    • @RFC3514
      @RFC3514 4 роки тому +95

      Technically should appear at 3:08.4 (i.e., 3.14 minutes). I guess seconds should be renamed "Parker decimals"...?

    • @GFmanaic
      @GFmanaic 4 роки тому +25

      Should be named Humble half Tau

  • @AalbertTorsius
    @AalbertTorsius 4 роки тому +3907

    I feel we're missing a piece of the puzzle. How many stops _are_ there between those stations?

    • @Henrix1998
      @Henrix1998 4 роки тому +508

      Probably 10 or 11

    • @JesperDramsch
      @JesperDramsch 4 роки тому +391

      Birmingham New Street to London Euston in the West Midlands Trains is calling at 22 stops.
      Waterloo to Keynsham in South Western Railway calls at 12 stops.
      10110 and 1100 respectively.

    • @martinda7446
      @martinda7446 4 роки тому +125

      @@Henrix1998 Is that 2 or 3?

    • @m1lkweed
      @m1lkweed 4 роки тому +439

      ~9 quintillion

    • @OlafDoschke
      @OlafDoschke 4 роки тому +62

      It's either 12 or 20, depending on what route you take from Rugby:
      www.londonnorthwesternrailway.co.uk/sites/default/files/assets/download_ct/20190226/9bE805nbW3CCoJJzY6oDU37oKbc3f2dJE2Bp6nVG2rg/lnr_map.pdf

  • @tinybabybread
    @tinybabybread 3 роки тому +841

    I'm not sure if someone's already mentioned this, but I love how Matt looks up at the number 0:39 (repeatedly throughout the entire number, actually) as if he were actually reading the text added in post lol
    He does it so naturally it's easy to forget the number isn't actually there

    • @jdubya7139
      @jdubya7139 2 роки тому +110

      My head canon is that Matt walks around with literal numbers floating over his head all day.

    • @Imrooniel
      @Imrooniel 8 місяців тому +38

      I wonder if he wrote the number on paper taped to ceiling and looked up at it both as clever gag with visual graphics and as a way to reduce the amount of takes by fumbling remembering the huge number

    • @TheAkashicTraveller
      @TheAkashicTraveller 8 місяців тому

      @@jdubya7139 No doubt many people visualise numbers when thinking about them.

  • @Interesting_Failure
    @Interesting_Failure 2 роки тому +335

    Attempting to resolve Zeno's paradox by quantizing space, West Midlands Trains successfully redefines motion as a series of stationary states linked together by the smallest physically possible distance. Unfortunately, this leads to the train "stopping" at every single state which produces some interesting scheduling results.

    • @cara-setun
      @cara-setun 2 роки тому +16

      You deserve all the likes

    • @handuo6301
      @handuo6301 8 місяців тому +6

      A train quantum wave packet!

    • @denelson83
      @denelson83 7 місяців тому +1

      As in sub-Planck length?

    • @Alolyn
      @Alolyn 7 місяців тому +2

      This is why you dont use trains in quantum problems
      Leave those for special relatively

  • @AnssiArpiainen
    @AnssiArpiainen 4 роки тому +1362

    Just yesterday we had breaking news in finland about a person whose bank account was in debt for 2^63 euros

    • @Awkwerp
      @Awkwerp 4 роки тому +305

      I would definitely assume overflow since its negative. Who knew being too rich could happen lol

    • @kilvesx7924
      @kilvesx7924 4 роки тому +12

      Haven't heard of this, can you link it?

    • @AnssiArpiainen
      @AnssiArpiainen 4 роки тому +41

      www.iltalehti.fi/kotimaa/a/e514a9e9-2080-4ce8-8e69-2171be52d024

    • @davidmurray3542
      @davidmurray3542 4 роки тому +166

      I would have to guess that there was some bad type conversion involved, because if it *was* signed integer overflow, that would imply they've got over 9 quintillion in the bank.

    • @miriamkorver1443
      @miriamkorver1443 4 роки тому +13

      Wasn't that a Belgian person: www.metronieuws.nl/in-het-nieuws/2019/11/belg-heeft-schaamrood-op-de-kaken-na-banksaldo-van-100-miljard

  • @hikaruyoroi
    @hikaruyoroi 4 роки тому +1093

    That's just a bit shorter than a CVS receipt

    • @YingwuUsagiri
      @YingwuUsagiri 4 роки тому +16

      I really see this ripping on CVS a lot and let me start with yes it looks ridiculous but it's actually a much better alternative for the planet than what the other companies do. Option 1 is what CVS does, thermal paper and a thermal printer which uses paper and power and that's it, option 2 is being part of those coupon packages which uses paper, ink, plastic, a lot of transport infrastructure with vehicles running on gas, etc etc.

    • @CalculatedRiskAK
      @CalculatedRiskAK 4 роки тому +32

      @@YingwuUsagiri Option 3: Coupons delivered via email and scannable from a phone screen. The scanners they use at checkouts can scan a bar code on a screen. The scanners don't look for where light is, they look for where light isn't so they're able to immediately grab the bar code or QR code.

    • @YingwuUsagiri
      @YingwuUsagiri 4 роки тому +5

      @@CalculatedRiskAK When the time comes that such a thing gets implemented en masse yes, but for now the VAST majority of coupons in both the Americas and Europe are physical either on paper or in distribution packages.

    • @R3lay0
      @R3lay0 4 роки тому +6

      @@YingwuUsagiri Thermal paper isn't just "paper" tho.

    • @nurmr
      @nurmr 4 роки тому +1

      @@CalculatedRiskAK Then they would need to collect email addresses and they're PII (personally identifying information) and so a whole bunch more nonsense kicks in. Ignoring the fact they that they've probably just scanned your CVS extracare membership card and charged your credit card for your purchase.

  • @swaree
    @swaree 4 роки тому +415

    "I'm not an hex-pert"
    Why Matt, why

    • @martinrocket1436
      @martinrocket1436 4 роки тому +15

      Sware, because he doesn't have 16 fingers.

    • @KuraIthys
      @KuraIthys 4 роки тому +7

      Yes. 16 is a tricky one.
      If you count the segments on 4 fingers you get 12.
      Include the thumb in that you get 14
      Both hands together is thus 24 or 28
      However, a while ago I was introduced to a counting method from... Korea I think it was?
      You put your hands just above a table, then put your fingers on the table as if counting in binary.
      Using this method you can count to 32 on one hand. (and 1024 on two hands)
      Alternatively, you count how many fingers are touching the table, and then use the second hand as the '5's creating a base 5 system, letting you count to 5 on one and hand 25 using both...
      ... The fact that it's possible to use your fingers to count in binary is interesting though, isn't it?

    • @DerplingKing
      @DerplingKing 4 роки тому

      @@KuraIthys personally I was always fond of the base 12 system with the second hand counting twelves which gets you up to 144 which is usually sufficient for counting without paper or a calculator.

    • @alexandermcclure6185
      @alexandermcclure6185 Місяць тому

      @@DerplingKing Currently making an entire number system in base 12. You can count up to 20735 in one symbol because I doubled it up (count to 11 on right hand, one more rolls it over to 1 on left hand, 0 on right hand, if you had 11 on left hand before that it would roll over to the right hand of the person in front of you, etc.)

  • @jack_corvinus
    @jack_corvinus 3 роки тому +37

    Man, times have changed.
    I think this is the first time I've seen something discussing why 256 is a common limit without mentioning Pac-Man.

    • @ferociousfeind8538
      @ferociousfeind8538 2 роки тому +2

      Even better, you could mention the Legend of Zelda, your rupees are stored as an 8-bit integer, ranging from 0 to 255.
      Pretty much every game on, like, the NES, worked with numbers no larger than 8 bits, and often worked with smaller numbers, occasionally even just single bits for simply turning states on and off, and only coded eight of those states together as an 8-bit number to store it next to other 8 bit numbers in memory nice and neatly

    • @SkigBiggler
      @SkigBiggler 2 роки тому +7

      @@ferociousfeind8538 NES was an 8bit machine, if they wanted to do larger integers they’d have to have done some wizardry storing larger numbers across multiple registers and doing slower non-native numerical operations on them.

  • @Green0Photon
    @Green0Photon 4 роки тому +1840

    Note: when you write out hexadecimal, don't write out commas every three digits. Instead, put a space every 2 or 4 digits. That way, each block is either a byte or word (2 bytes aka 16 bits). That's much more standard in writing out hex.
    Also, I love how enthusiastic this video is. It just makes me feel a bit happier. :)

    • @thedocta_certified
      @thedocta_certified 4 роки тому +15

      A word is 4 bytes no?

    • @Squossifrage
      @Squossifrage 4 роки тому +70

      @@thedocta_certified In the Intel world, a word is 16 bits, a dword is 32, a qword is 64.

    • @Idran
      @Idran 4 роки тому +41

      @@thedocta_certified How many bytes in a word varies by system; it's however much your processor can manipulate in a single op, there's no one definition for it

    • @Qbe_Root
      @Qbe_Root 4 роки тому +26

      @@thedocta_certified Whether you call it a word of a halfword, 2 bytes is more intuitive than 1.5

    • @f_f_f_8142
      @f_f_f_8142 4 роки тому +7

      @@thedocta_certified the length of a word depends on the architecture, in a 32-Bit processor a word has 32 bits and in a 64 bit architecture a word has 64 bits.

  • @Real28
    @Real28 4 роки тому +475

    "thought we fixed it ages ago"
    LOL oh, how many times have you thought you squashed a bug and it comes back.

    • @dwavenminer
      @dwavenminer 4 роки тому +12

      Real actually in this case it might be a bit flip caused by a cosmic ray...if so, there's little a programmer could do...even if you have a sanity check, the cosmic ray could hit after the sanity check...
      About the only realist thing you can do is not run the severs so hot, as increasing the temperature of the computing hardware decreases the required energy of a cosmic ray in order to flip a bit...

    • @rogerkearns8094
      @rogerkearns8094 4 роки тому +9

      @@dwavenminer
      I wondered about that, too, but I think it's too rare an event to apply here. After all, there's an implication given in the video that the anomaly was a known bug. Moreover, I was employed maintaining, writing and testing computer programs for thirty years and I never had need to suspect it.
      Still, perhaps.
      Cheers

    • @eaglegosuperskarmor
      @eaglegosuperskarmor 4 роки тому +3

      @@dwavenminer depends on where the error is occurring, and if the system has ECC memory, since that can correct for bit flips

    • @eaglegosuperskarmor
      @eaglegosuperskarmor 4 роки тому +4

      @@rogerkearns8094 I remember hearing about someone tweeting about a supercomputer, and they detected something like 200 bit flips per second? That's partially just due to the scale that they're dealing with. On the other hand, they also had Error Correcting Memory that protects them from the effects of bit flips. ECC memory is becoming even more common now but has been in use since before the 90s, more so in scientific or financial situations. As programmers we normally don't have to worry about them, and even in the situation where it's happened, a reboot is enough to fix it. Good old turn it off and on again...

    • @pauldavis2108
      @pauldavis2108 4 роки тому +13

      @@rogerkearns8094 Bit flips really aren't as uncommon as you think the vast majority of times you won't even notice them though. The flip might be in unused memory, might be part of a masked off number, might be part of a comparison which still ends up as the same result. Even if it actually produces a functional change it might just manifest as something missaligned, a button that doesn't release, etc. I'm sure the average PC experiences 1-2 per year. I design hardware/software that operates in radiation enviroments so bitflips are far more common. I had one system that'd get a bitflip every few seconds before we hardened it. Even then it'd often run for over 20 minutes before we'd actually get a functional failure.

  • @shearnotspear
    @shearnotspear 4 роки тому +631

    My favourite appearance of 256:
    In Civilisation 1 when Gandhi’s aggression score of 1 reduces by two and the game can’t handle it so it goes to 255.

    • @tommasomorandini1982
      @tommasomorandini1982 4 роки тому +140

      And then he starts to nuke you. Hilarious bug I think 😂

    • @elietheprof5678
      @elietheprof5678 4 роки тому +111

      That's what happens when people keep their emotions bottled up inside 😂

    • @its_w4yne
      @its_w4yne 3 роки тому +139

      Best part: The developers didn't fix the bug but made it a feature. Now 'Nuking Gandhi' is a thing in all the sequels.

    • @TheAkashicTraveller
      @TheAkashicTraveller 3 роки тому +49

      Turns out that's actually a myth. It's not true. Because Gandhi's aggression was so low he focused on other things like increasing his tech level and so he would develop nukes before everyone else.

    • @its_w4yne
      @its_w4yne 3 роки тому +57

      I can tell you from experience that Gandhi is a nuking maniac even if he has the worst tech level of all players.

  • @thenickstrikebetter
    @thenickstrikebetter 3 роки тому +56

    I immediately had my theory when he showed that 9.2 quintillion was the compliment of 10 because i thought of how the number of stops was 10 off 2^63. I guessed that there were 10 stops, and then the app somehow showed the compliment of thag instead (which would be the 9.2 quintillion number).

  • @tncorgi92
    @tncorgi92 4 роки тому +629

    Challenge: All the Stations, Geoff and Vicki.

    • @adigyran
      @adigyran 4 роки тому +37

      I see, you are man of trains as well

    • @casperes0912
      @casperes0912 4 роки тому +36

      That's be quite awesome ;). And Jay Foreman should do a song about 'em all

    • @snowfloofcathug
      @snowfloofcathug 4 роки тому +16

      Casper S� Sung one syllable off of course

    • @KevFrost
      @KevFrost 4 роки тому +4

      Drinking game?

    • @petermikhaylov
      @petermikhaylov 4 роки тому

      YES OMG YES

  • @IceMetalPunk
    @IceMetalPunk 4 роки тому +701

    My guess: A signed int was incorrectly cast to an unsigned int during a calculation somewhere. Signed ints will sometimes use two's complement for the integer portion of their encoding, depending on the system. If someone tried to do a quick cast to unsigned by chopping off the first bit (which is a common trick) and didn't realize the system was using the complement, that could cause exactly what we see.

    • @nibs_fpv
      @nibs_fpv 4 роки тому +45

      I agree with this. Which is why it was 2 to the power of 63 -> First bit of 64 missing

    • @kaitlyn__L
      @kaitlyn__L 4 роки тому +23

      Also in support of your theory, the direct train journey which displayed the same bug did have the maximum value. So it would seem the viral tweet really had 10 stops. (Or maybe 9?)

    • @alexcat3121
      @alexcat3121 4 роки тому +28

      A quick guess-- the stop number calculation is done using a formula like this-- Math.abs(stop1_id - stop2_id) and somehow the sign bit of the subtraction was zeroed before the call to the absolute value function.

    • @PhilBagels
      @PhilBagels 4 роки тому +4

      Maybe there was a parity bit - used to catch errors, but obviously not this particular kind of error.

    • @Eugenethemooer1Wolffe
      @Eugenethemooer1Wolffe 4 роки тому +3

      I thought this might be the case, but why would they have been storing a negative number of stops in the first place?

  • @burk3
    @burk3 3 роки тому +45

    Two's complement is how all modern CPUs represent negative integers. I suspect you would find it super interesting. While it's slightly more complicated in representation than using one bit for a sign, it makes all of the actual calculation the CPU does much simpler by removing the need for any special casing for negatives.

    • @bettercalldelta
      @bettercalldelta 2 роки тому +4

      I think that the reason we use two's complement and not a sign bit, is because 10000000 would be -0 which is a number that simply doesn't exist, so we wasted a potential combination. This does happen in IEEE 754 though, where the first bit is the sign. Apart from that if you used a sign bit you couldn't just easily add or subtract these numbers

  • @MTG_Music
    @MTG_Music 3 роки тому +24

    2:27 minecraft 1.17: *laughs in 384 total blocks*

    • @paulstelian97
      @paulstelian97 3 роки тому

      I wonder what the updated chunk format is like and how the conversion from old worlds will go...

    • @Zethneralith
      @Zethneralith 3 роки тому +3

      ​@@paulstelian97 World height used to be 128 before they introduced the Anvil format. So hopefully it'll be at least as smooth as that transition. If I recall correctly, worlds didn't need to be rebuilt because of the height change, but more world generation changes came shortly thereafter.

  • @Xatzimi
    @Xatzimi 4 роки тому +449

    You missed the other obvious solution: Zeno was driving the train and was trying to make infinite stops

    • @nurmr
      @nurmr 4 роки тому +3

      but then why the -10?

    • @jsbrads1
      @jsbrads1 8 місяців тому

      Well… Zeno wasn’t even close! 😡😂

  • @rikwisselink-bijker
    @rikwisselink-bijker 4 роки тому +108

    RE: the joke at 5:15:
    there are 16 kinds of people, those who can count in hexadecimal and F the rest

    • @tomasstana5423
      @tomasstana5423 3 роки тому +4

      So, you're saying there's 7 kinds of people who can count in hexadecimal, aye??

    • @rikwisselink-bijker
      @rikwisselink-bijker 3 роки тому +2

      @@tomasstana5423 Determining the difference between those 7 kinds of people is left as an exercise to the reader.

    • @tomasstana5423
      @tomasstana5423 3 роки тому +2

      @@rikwisselink-bijker Yeah, yeah, no problem, just wanted to be sure its not a typo ;)

    • @rikwisselink-bijker
      @rikwisselink-bijker 3 роки тому +3

      @@tomasstana5423 To write a more serious reply: the joke gets a bit. Odd. If you write 10 kinds of people instead. It requires a higher level of familiarity with hexadecimal. So if you're in a group of people that regularly come in contact with hexadecimal notation you could say 10, but for a lay audience I would go for 16, as that further primes people to think of hexadecimal and contains an implied hint

    • @tomasstana5423
      @tomasstana5423 3 роки тому +5

      @@rikwisselink-bijker I though we had a thing and you ruined it :(.
      But on also a more serious note - I am fully aware of your point, but I think that joke is anyway meant for those who can understand it (same as "10 types of people, those who can count in binary ..." joke).
      Because I think vast majority of people either understand it and would get the 10 instead of 16, or they would not understand it and the number 16 wont save that.
      Not a statistician, it is just my opinion, but you're the author and I must say, it is a nice one nonetheless :)

  • @ed-vi
    @ed-vi 3 роки тому +87

    Note: the Minecraft thing is a) about to be false (worlds are getting taller in 1.17) and b) chosen for performance reasons - Minecraft positions are Java "int"s of 32 bits, but the game processes entire "infinitely tall" "chunks", so capping block height limits how much stuff you can cram in a "chunk" to (theoretically) mitigate slowdowns.

    • @holysecret2
      @holysecret2 3 роки тому +4

      Does that mean you can build 64 blocks below bedrock into the void?

    • @mooosje
      @mooosje 3 роки тому +11

      @@holysecret2 as of 1.16 and below, the world went from 0 - 256. Below is void, and upwards is sky. Unable to build outside those numbers. In 1.17 however, this will be changed to -64 - 328.

    • @banggugyangu
      @banggugyangu 3 роки тому +4

      @@mooosje this is a server setting specified in a file written to a 32 bit integer. You can theoretically extend the build height to 2.14 trillion blocks, though that will throw an exception when you launch the server. I've played on servers with 1024 build height, however, which runs fine.

    • @holysecret2
      @holysecret2 3 роки тому +2

      @@mooosje that sounds epic, so now you can build structures below the world

    • @jamesmichael7528
      @jamesmichael7528 3 роки тому +10

      @@holysecret2 -64 won't be below the world but instead be the new bedrock layer. They changed it so that they had more space for the new cave generation

  • @biancatherescuemouse3305
    @biancatherescuemouse3305 2 роки тому +11

    Fun fact:
    Many systems use signed integers
    For example: Bejeweled 2's Score is stored in a 32 bit system, but because it's signed(the lead bit determines of the value is positive or negative), it only goes up to just over 2.147 Billion. If it tries to go over that value, the addition will flip the leading bit, causing the value to roll over to just under -2.147 Billion. You can then get back to 0 by scoring enough points (or hitting the hint button since it tries to make sure your score is at least 0), at which point it will count up with positive integers like normal.
    This happens in Bejeweled Twist as well, but Bejeweled 3 has some extra code that caps the score at 2^31-1, displaying "MAX SCORE" in its place.

  • @Bobstew68
    @Bobstew68 4 роки тому +408

    Usually when you use 64 bits for storage (for example, a "long" in java), the minimum value is -2^63 and the maximum is 2^63-1 (encoded with two's complement). For almost all purposes, this is more desirable than having it range from 0 to 2^64. So it'd be stranger if the value was just below 2^64.
    The number that ends in 798 is what you get if you subtract 10 from Long.MIN_VALUE (or equivalent in another language), because many languages don't check for under- or overflows, they leave that to the programmer. So the algorithm might've set a variable to Long.MIN_VALUE at some point, perhaps to ensure that the instance doesn't get picked in a max comparison. And then the variable is modified by subtracting 10 (oops), and we end up with a huge number which does win the max comparison.
    OR, they set a variable to Long.MAX_VALUE to ensure it doesn't get picked in a min comparison, but a small number is added to this variable before the min comparison, the value overflows to become near Long.MIN_VALUE, wins the min comparison, and then a slightly bigger value is subtracted from the variable, and it underflows back near Long.MAX_VALUE.

    • @johnm2012
      @johnm2012 3 роки тому +24

      "For almost all purposes" ... except for this one. An unsigned integer type is perfect for representing the number of stops on a journey, since it is totally impossible to have a negative number of them.

    • @galgirion3036
      @galgirion3036 3 роки тому +14

      It's depressing to hear that those bugs still exist. They could be super easily eliminated by using proper types like std::optional/Option instead of initializing to a max value. Moreover, those algorithms shouldn't be implemented from scratch every time. We have zero cost iterators that implement ::max_by_key, ::find, etc. while being generic, expressive, verified and optimized.
      Sad to see that decades of research in programming languages is simply ignored. Static verification of those errors is easily achieved with Rust and cheap, not to say that it has an overwhelmingly positive ROI.

    • @deanmoncaster
      @deanmoncaster 3 роки тому +2

      I was going to post this

    • @Jiffy_Park
      @Jiffy_Park 3 роки тому +4

      @@chyza2012 where can I read about these laws?

    • @sgbench
      @sgbench 3 роки тому +14

      @@johnm2012 Yes, the number of stops in a journey is semantically a positive integer, and the devs are probably well aware of that, but there are still valid reasons why they might have used a signed data type. Most likely, it was due to convention or habit. Or perhaps the implementation language doesn't provide unsigned numbers.

  • @robertzmirich9550
    @robertzmirich9550 4 роки тому +193

    "This is the Sorcerer's Stone to the Philosophers Stone" lolol

    • @stephenbenner4353
      @stephenbenner4353 4 роки тому +8

      Robert Zmirich Not quite as bad as that. That was quite an annoying alteration. On the other hand I find maths to math a much more pleasing alteration.

    • @jimporter
      @jimporter 4 роки тому +16

      Stephen Benner oh yes the good old study of mathematic.

    • @CrystaTiBoha
      @CrystaTiBoha 4 роки тому +4

      Or, you could say, a Parker Title. lolol

    • @Tfin
      @Tfin 4 роки тому +8

      @@jimporter You can only say "math" is short for "mathematic" if you claim "mathematics" is plural. If it is, you need a singular, and "mathematic" becomes correct.

    • @macronencer
      @macronencer 4 роки тому +8

      @@Tfin Do Americans shorten "statistics" to "stat"? I'm just curious...

  • @ultlifeform
    @ultlifeform 3 роки тому +54

    In Pokémon, the maximum amount of Effort Values your critter can gain in a single stat used to be 255. However, this value was then divided by 4 and then floored, meaning anything beyond 252 was a waste of points that could be applied elsewhere. So in later games, the max was simply changed to 252. Also, the highest base stat in the series is Blissey's HP, at 255.

    • @ryanjensen1945
      @ryanjensen1945 8 місяців тому +8

      Tagging onto this two years later, the fact that that is hp is important. Eternatus-eternamax, a boss battle pokemon intended to be impossible for the player to obtain, has base 250 defense and special defense. With carefully allocated ev's and the relevant stat-boosting nature, it was possible to reach a defense or special defense stat that underflowed the attack damage computation, making eternatus functionally immune to either physical or special attacks. This absolutely destroyed the pure hackmons tier on showdown for a generation.

    • @ultlifeform
      @ultlifeform 8 місяців тому +2

      @@ryanjensen1945 That's interesting, because that's not much higher than Shuckle's Defense and Special Defense, at 230 each. I guess that extra 20 base points makes quite a difference.

    • @ryanjensen1945
      @ryanjensen1945 8 місяців тому

      @@ultlifeform yeah it's funny, I think the magic number was like 244 or 246.

  • @DancingRain
    @DancingRain 4 роки тому +5

    The subroutine that formats the number might be ignoring sign, because they never expected a negative value.

  • @custard131
    @custard131 4 роки тому +28

    thats the version of the app that shows how many times the train will randomly stop for no obvious reason rather than the number of stations

  • @telotawa
    @telotawa 4 роки тому +49

    you typically use a thing called two's complement (this is one's complement), where you flip it and add one BEFORE even doing any adding. it gives you the same result, because you add the one before addition instead of after it, but it's nicer because once it's stored, you don't have to keep track of if it's a negative number or not, you add it the same way
    oh and also it doesn't have a negative zero lol

    • @johnopalko5223
      @johnopalko5223 4 роки тому +1

      As opposed to one's complement, which *does* have a negative zero. That one always left me scratching my head.

    • @howardbaxter2514
      @howardbaxter2514 4 роки тому

      Or, the way I think of it, flip until you reach the last value of 1.

    • @Logarithm906
      @Logarithm906 4 роки тому +1

      @@johnopalko5223 well i imagine a negative 0 in one's comp would look like 11111111 while a positive 0 would look lik 00000000

    • @johnopalko5223
      @johnopalko5223 4 роки тому +1

      @@Logarithm906 Yep, that's it exactly. Still leaves you wondering why we need two flavors of zero.

    • @Logarithm906
      @Logarithm906 4 роки тому

      @@johnopalko5223 Well that's why you use two's comp instead :). That way you only get one zero, plus it makes some binary calculations easier if i remember correctly (tbf the video may go into it, i can't remember).
      Edit: turns out the comment above goes into it, i love responding to comments in this little window...

  • @gferrol118
    @gferrol118 3 роки тому +70

    "In minecraft you can't build a wall more than 256 blocks high"
    1.17: I'm about to end this man's whole career

    • @vibaj16
      @vibaj16 3 роки тому +1

      gferrol118 I was looking for this comment

    • @gferrol118
      @gferrol118 3 роки тому +4

      @El Xabi de Siempre no its from -64, to +320. So 384 blocks total

    • @gferrol118
      @gferrol118 3 роки тому +3

      @El Xabi de Siempre the bottom of the world is now -64 instead of 0

    • @gferrol118
      @gferrol118 3 роки тому +3

      @El Xabi de Siempre no, the bedrock has been lowered to -64. The layer at 0 is completely gone. I suggest just looking up a video from the most recent snapshot :P

    • @darealpoopster
      @darealpoopster 3 роки тому

      @El Xabi de Siempre yes

  • @hugovangalen
    @hugovangalen 4 роки тому +4

    Gotta love powers of two. HP recently warned users to upgrade their SSDs before these crash after using them for 32.768 hours...

  • @moopidoo
    @moopidoo 4 роки тому +169

    When you float an idea and double down.

    • @danielb270
      @danielb270 4 роки тому +27

      and then it takes too long
      seriously though, it is (Long.MAX_VALUE - 10)

    • @marklonergan3898
      @marklonergan3898 4 роки тому +5

      Taking it a bit too far!

    • @aditya95sriram
      @aditya95sriram 4 роки тому +9

      But whose idea was it to use a long to store the number of stops, wouldn't a short int have done the job ?

    • @BertGrink
      @BertGrink 4 роки тому +5

      nice pun there mate. :)

    • @ZuppaD.Cipolle
      @ZuppaD.Cipolle 4 роки тому +2

      @@aditya95sriram short and standard int nowadays are almost always equal ( it is up to the compiler but usually that's how it goes) the real question is why they decided to use a signed number lol

  • @Cr42yguy
    @Cr42yguy 4 роки тому +28

    I was genuinely expecting a calculation of the required speed in multiples of c (not accounting for relativistic effects) to travel that many stops in 2.5 hours...so I did it myself:
    With a train station length of (just) 100 m and stations stacked end to end you would either need 3*10^12 seconds while traveling at c or 3.5*10^8 c to finish your journey in those 2.5 h. Impressive for a train!

    • @EwanMarshall
      @EwanMarshall 4 роки тому +1

      An CS student immediately saw the number and said, signed integer underflow of 64bit somehow. Possibly bad conversion from unsigned with 2's complement.

    • @zockertwins
      @zockertwins 4 роки тому +1

      That speed would approximately be c^2. Not bad for a train!

  • @thorndust5329
    @thorndust5329 3 роки тому +6

    Minecraft now has a building limit over 256. Extended by 64 both directions in the y axis

  • @HickoryJ
    @HickoryJ 4 роки тому +12

    I’m a software engineer, and this was immediately my suspicion hahahah

  • @VAXHeadroom
    @VAXHeadroom 4 роки тому +10

    The discrepancy is between the internal representation coming from the system creating the numbers and the display software on the phone. Internally it's probably using a 63/64 bit signed integer but the display system is using a 64 bit unsigned integer. The internal system generates a count-down to your stop (-10) and generates the very large hexadecimal/binary number, and then the phone just displays that with out sign correcting it. Seen this before :)

    • @klafbang
      @klafbang 4 роки тому

      That's not the whole explanation. Negative numbers in two's complement are > 2^63. -10 in two's complement would be 2^64-10 = 18.447 trillion. Something is also stripping the leading 1.

    • @VAXHeadroom
      @VAXHeadroom 4 роки тому

      @@klafbang Probably. It's dang close to that :) Doing 63 bit hex math in my head on the weekend will never turn out well though :D

    • @Ethrel1024
      @Ethrel1024 4 роки тому +1

      @@klafbang Probably something in the networking protocol, some clever programmer stripping off bits here and there to cut down on data usage and make every bit count.
      "Oh, there's a signed int here that, because of the nature of the real-world problem, is going to ALWAYS be positive? We don't need to send that sign bit, we can assume it on the client side!"

  • @Raykkie
    @Raykkie 4 роки тому +116

    Everybody's gangsta until the long scale says that there's only 9 trillions stops

    • @benjaminnewlon7865
      @benjaminnewlon7865 4 роки тому +3

      _only_

    • @nadadada3938
      @nadadada3938 4 роки тому

      is... is this a pun... this... is... I love it

    • @Tobberz
      @Tobberz 4 роки тому

      @@epsi Old boi Britons used long scale too :D

    • @WaterShowsProd
      @WaterShowsProd 3 роки тому +2

      Long live long scale!

    • @RH-ro3sg
      @RH-ro3sg 3 роки тому

      @@epsi not just francophones. Most European countries and their former colonies still do, and even the British only moved over to the short scale in 1974.

  • @Hazearil
    @Hazearil 3 роки тому +38

    "In Minecraft you cannot built a block over 256 blocks high."
    Minecraft 1.17 begs to differ.

    • @Fyngys
      @Fyngys 3 роки тому +4

      This videos over a year old mate

    • @nagitokomaeda3237
      @nagitokomaeda3237 3 роки тому

      Dude, nobody plays 1.9+

    • @Livestreamlurker
      @Livestreamlurker 3 роки тому +1

      @@xX1infinityedge1Xx How dare they.

    • @22tfortnitevevo
      @22tfortnitevevo 3 роки тому +1

      @@nagitokomaeda3237 i'd say that 1.16 is better than 1.8

  • @deanmoncaster
    @deanmoncaster 3 роки тому +4

    On southern rail this is quite feasible due to the sheer number of breakdowns you need to expect.

  • @bunnygirl8
    @bunnygirl8 4 роки тому +194

    When the F pun happened, I wasn't surprised, just disappointed.
    Disappointed at myself more than you, since I laughed for a solid 10 seconds.

    • @BobStein
      @BobStein 4 роки тому +1

      Where is the F pun? I missed it.

    • @the_furf_of_july4652
      @the_furf_of_july4652 4 роки тому +2

      Bob Stein The great thing about seeing this number in decimal is that it shows that this number is thoroughly effed.

    • @BobStein
      @BobStein 4 роки тому

      @@the_furf_of_july4652 Got it! Like the Parker Square, in hexadecimal the number is **almost** thoroughly effed.

    • @subnormality5854
      @subnormality5854 4 роки тому +6

      @@BobStein 5:13, can we get an f in the chat

    • @BobStein
      @BobStein 4 роки тому +2

      @@subnormality5854 thank you. Classic Matt Parker understated humor.

  • @JxH
    @JxH 4 роки тому +21

    Re book: Although Canada is within North America, most Canadians would want the English version of the book.

    • @michaelsommers2356
      @michaelsommers2356 4 роки тому +4

      @Memento Mori You mean the "English spelled correctly" version.

    • @lunasophia9002
      @lunasophia9002 4 роки тому +7

      I think some of your countrymen would prefer the French version.

    • @Brooklyn-Manhattan
      @Brooklyn-Manhattan 4 роки тому

      @SuperShadowChaos7
      Wait, what dafuk. I'm American and I spell Defence as Defence.

    • @Brooklyn-Manhattan
      @Brooklyn-Manhattan 4 роки тому

      @SuperShadowChaos7
      * thinking noises *

  • @LiamE69
    @LiamE69 4 роки тому +49

    64 bit signed integer. To a computer nerd that stood straight out.

    • @rosuav
      @rosuav 4 роки тому

      Except that that would give a value roughly twice as high. Misinterpreting a signed integer as unsigned gives a value near the unsigned maximum, not the signed maximum. Unless you have some other explanation for why the stop count was somewhere near the signed max?

    • @LiamE69
      @LiamE69 4 роки тому +1

      @@rosuav No, the size of an unsigned 64 bit integer is c. twice that. That number is 9 off the maximum for s signed 64bit integer.

    • @rosuav
      @rosuav 4 роки тому +1

      @@LiamE69 Yes. And if you were using a signed 64-bit integer, -10 would be represented as 0xfffffffffffffff6, identical to an unsigned integer very close to the top of the range. That's how signed integers work. So why would you be working with numbers close to the maximum for a signed integer? What's the justification for that?

  • @GUIHTD
    @GUIHTD 4 роки тому +26

    So when is "Humble Parker - When Matt Goes Wrong in the Real World" coming out?

  • @MsNosis
    @MsNosis 4 роки тому +70

    very short stops though, since the trip still only takes a couple of hours.

    • @pixymisa8087
      @pixymisa8087 4 роки тому +9

      Welcome to Zeno Railways!

    • @MsNosis
      @MsNosis 4 роки тому +3

      ps. if I estimated correctly, even if every stop only lasts for a single millisecond, it will still take about 4 billion years to reach the end station...

    • @RevCode
      @RevCode 4 роки тому +2

      @@Peter_1986 Could you calculate the acceleration forces you would feel, since the train would have to essentially stop and speed up immediately? I Imagine quite a lot of headbanging and concussions going on there

    • @RevCode
      @RevCode 4 роки тому

      @@Peter_1986 Thank you very much. I wish I could remember my physics lessions from school better, but since i only create some boring office software i practically had to never look back into it and now i dont even know how to start :/

    • @jeremydavis3631
      @jeremydavis3631 4 роки тому +3

      @@Peter_1986 I don't think there would be any headbanging, since the train would be speeding up and slowing down so quickly. Kind of like (although this probably isn't the best analogy) if a light flickers quickly enough, it seems not to flicker at all. The train may undergo 8 quadrillion G, but the squishy humans inside, who aren't even attached to their seats, will continue to travel at the train's average velocity, perhaps feeling a slight vibration but nothing more.
      All that said, I would like to know what material this train is made of and how much fuel it needs. :)

  • @coryman125
    @coryman125 4 роки тому +19

    I'm now regretting not picking up the British copy of the book when I was at one of your shows. I didn't realise it would be a rare collector's item out here in Canada :P
    Also, I must say, the line "What are the chances of that? Quite high" really got me. It's the perfect blend of your subtle humour and your mathematical geekiness, all in a short throwaway line

  • @jtn2002
    @jtn2002 4 роки тому +25

    The american book it probably missing a few "u"'s as well....

    • @ElectroDFW
      @ElectroDFW 3 роки тому +1

      They do it to hmor s. 😁

  • @mallorystrom7511
    @mallorystrom7511 3 роки тому +16

    i learned “check if the weird big number is a power of two” from humble pi

  • @Aviertje
    @Aviertje 4 роки тому +32

    You made the 7/F thing sound a lot more complicated than it needs to be. Hexadecimal notation represents every 'nibble' (which is four bits) with a character. 7=0111, F=1111. In order words, the sign bit was not set, and that is why you got a 7 in that position.

    • @SreenikethanI
      @SreenikethanI 8 місяців тому +2

      same thought, but he did mention he's probably not quite immersed into bits and hex digits and all those (even considering how he grouped hex digits every 3 places instead of every 2 or 4 places) etc

    • @dubl33_27
      @dubl33_27 6 місяців тому

      I mean i kinda had an idea of what he was saying there but this comment made it much clearer, thanks

  • @yashrawat9409
    @yashrawat9409 2 роки тому +4

    0:17
    A valid cause for concern
    *Of course*

  • @memofromessex
    @memofromessex 3 роки тому +2

    Thanks for cheering me up, I've just come back from another disappointing date 😢

  • @elishmuel1976
    @elishmuel1976 2 роки тому

    Dude, I just love your videos. Can't wait to see you hit 1 million subs. Have a great 2022!

  • @cloverberry721
    @cloverberry721 3 роки тому +53

    Matt: You can’t build a wall more than 256 blocks tall in Minecraft
    Snapshot 21w06a: *Are you sure about that?*

    • @HNaledi123
      @HNaledi123 3 роки тому +8

      Did not expect this comment to pop up here this quickly... wow

    • @theblinkingbrownie4654
      @theblinkingbrownie4654 3 роки тому +2

      @@HNaledi123 yep crazy how fast stuff spreads over the internet

    • @HNaledi123
      @HNaledi123 3 роки тому

      @@theblinkingbrownie4654 Yup, guess so.

    • @cloverberry721
      @cloverberry721 3 роки тому +3

      @@HNaledi123 Minecrafters be like: We...are...speed

    • @bene5431
      @bene5431 3 роки тому

      Cubic chunks: boooring

  • @sethbushnell5051
    @sethbushnell5051 4 роки тому +5

    Ten is the difference between 2^63 and the number we are looking at. The compliment of this number is ten, and the compliment of ten is the number we are taking if ten was encoded using zeroes to fill the "space" before it, obviously maxing out at 63/64 bits. If the system had to subtract ten stops because it had already made those stops to find the remaining stops, it is possible that the code didn't say to subtract from the total, so instead this was subtracted from the max available number. The other option is something that Matt mentioned with the rollover.

    • @chessthecat
      @chessthecat 4 місяці тому

      Except it's not the compliment. It's the complement. 10 isn't paying compliments to 2^63 because she's a pretty number.

  • @PixelBytesPixelArtist
    @PixelBytesPixelArtist 2 роки тому +2

    Just an fyi, the minecraft build limit is not caused by binary. Powers of 2 appear a lot in Minecraft but its only thematic, to make it feel like its run on an older system. Minecraft Can handle numbers up to 65536 most of the time cause java usually (or used to) default their integers to under two bytes

  • @devlinw4735
    @devlinw4735 Рік тому +1

    6:12 that makes so much sense because the original number of stops was 10 off the 2 to power 63 number

  • @mebamme
    @mebamme 4 роки тому +161

    This comment contains a "Parker train" joke to save you the hassle of making your own.

    • @GvinahGui
      @GvinahGui 4 роки тому +18

      Thanks, I wanted to make a Parker Train joke but I was too lazy for it. You saved me the hassle, thank you again.

    • @IceMetalPunk
      @IceMetalPunk 4 роки тому +9

      @@GvinahGui Is that a Parker Train Parker Joke?

    • @donkosaurus
      @donkosaurus 4 роки тому +6

      @@IceMetalPunk more of a parker parker train joke joke

    • @jaspermay5813
      @jaspermay5813 4 роки тому +5

      @@donkosaurus It's a Parker 'Parker train' joke.

    • @BobStein
      @BobStein 4 роки тому +1

      @@jaspermay5813 So, a Parker Train Joke ... *squared?*

  • @MrCheeze
    @MrCheeze 4 роки тому +62

    My baseless theory: the software has some "sentinel values" that it uses to encode special situations and errors. To avoid being confused with legitimate quantities, they're defined as MAX_INT - 1, MAX_INT - 2, etc. That's why the value is slightly less than a power of 63, instead of the far more common slightly less than a power of 64.

    • @YourMJK
      @YourMJK 4 роки тому +8

      MrCheeze I remember now when I once implemented Dijkstra's algorithm, I used MAX_INT to initialize the current shortest distance between two nodes.
      Maybe this error stems from their shortest-path-algorithm. But then again it wouldn't make sense that it's MAX_INT - 10…

    • @ChrisHarringtonMinneapolis
      @ChrisHarringtonMinneapolis 4 роки тому +1

      What's the maximum native integer size on a 6502 anyway?

    • @gormster
      @gormster 4 роки тому +3

      Alternate theory: there is a negative number that at some point is being “bounds checked” in the simplest possible way `num & INT_MAX`.

    • @IconOfCyn
      @IconOfCyn 4 роки тому +1

      @@ChrisHarringtonMinneapolis 6502s have an 8 bit data bus with a 16 bit memory bus. The processor can natively compute with a number up to 255 with hardware, but there are ways to use software to implement larger values using multiple addresses.

    • @SimonClarkstone
      @SimonClarkstone 4 роки тому +1

      @@YourMJK How about MIN_INT - 11?

  • @DaxSudo
    @DaxSudo 8 місяців тому

    Love that this is popping up in my feed now

  • @ibramgaunt885
    @ibramgaunt885 3 роки тому +106

    About hitting 0 unexpectedly, that’s the reason on how the nuke happy gandhi in sid meiers civilisation started, in the first game he had an aggression level of 1, and he always goes for democracy which detracts 2 of the ai’s aggression level. Which would put him at -1 but it jumped him up to 255...
    Edit: I have been informed, it was intentional from the developer, not a bug.

    • @niccy266
      @niccy266 3 роки тому +10

      myth

    • @ibramgaunt885
      @ibramgaunt885 3 роки тому +1

      @@niccy266 you can look it up, it's how a hilarious running gag started.

    • @ultlifeform
      @ultlifeform 3 роки тому +39

      @@ibramgaunt885 Actually, if you look it up, it really is just a myth. The code of the games doesn't support it, and it's been deconfirmed by multiple creators. It started with a baseless claim on TV Tropes 21 years after the game released, and spread like wildfire on the net. On the bright side, while it's not actually a good example of binary underflow, it IS a good example of the Mandela Effect. It was eventually included in Civilization 5 and 6 as a nod to the meme though.

    • @ibramgaunt885
      @ibramgaunt885 3 роки тому +7

      May Mabie oh, looked it up again. Thanks for correcting the false information I had, i will edit the comment for people just scrolling through.

    • @ultlifeform
      @ultlifeform 3 роки тому +2

      @@ibramgaunt885 No problem. I actually didn't know either, until just now. Saw a couple claims of it being myth in these comments, and figured it was time to investigate again. lol

  • @poisonpotato1
    @poisonpotato1 4 роки тому +4

    3:25 it’s a Parker Theory

  • @sethberry9185
    @sethberry9185 3 роки тому +6

    “I’m gonna be a little late to work. How late? Well my train has to make a few stops before mine...”

  • @dtkedtyjrtyj
    @dtkedtyjrtyj 3 роки тому +1

    My guess is a typo.
    Many languages use "||" to mean or; and it in high level languages has some interesting properties that make it useful for fallback.
    So you'd write "number_of_stops || 10 " to show number of stops normally, and 10 if we don't know number of stops for some reason.
    "|" on the other hand is the bitwise or operator; and does something entierly different.
    So, a simple typo, a code path that isn't very common and, BOOM, nine quintillion.
    PS For anyone wondering why you would use a 64-bit signed integer to store the number of train stops: well why wouldn't you?
    The actual number of train stops, and most other things you want to store will certainly fit into that space. Using 64-bit integers for _everything_ prevents overflow bugs, save the time it would take to decide what "kind of integer" it should be and is just generally the thing you do. Integers are just so pitifully small that there just is no reason to think about anything else today, except in very specific applications.

  • @ferretyluv
    @ferretyluv 3 роки тому +1

    Every time you talk about powers of 2, I think of your praise of the game 2068.

  • @MrTyler918273
    @MrTyler918273 4 роки тому +4

    Other possibility:
    If this is calculating the best route (least stops or something) they could be calculating all of the routes into a list and then taking the minimum value of that list. Doing that can cause errors if the list is unexpectedly empty, so its common to throw the maximum possible value into the list (or use it as the initial accumulator in a fold/reduce).
    In Python that could look like:
    routes = getAllPossibleRoutes()
    routes.append(sys.maxsize)
    stopsLeft = min(routes) - stopsAlreadyPassed()
    or in Haskell:
    stopsLeft = foldl min maxBound getAllPossibleRoutes - stopsAlreadyPassed
    Which, if getAllPossibleRoutes fails for some reason and returns an empty list and stopsAlreadyPassed returns 9, gives you the number we see here.

  • @_jb_3441
    @_jb_3441 3 роки тому +3

    "we can see that this number is really F-ed"
    That broke me :D

  • @retep8891
    @retep8891 4 роки тому

    I am glad the book is coming out in America, but I couldn't wait. Bought one of your autographed copies from your store earlier this year

  • @mariojoia1337
    @mariojoia1337 4 роки тому +2

    14 Fs in the same number, so much respect.

  • @grshorwich
    @grshorwich 3 роки тому +24

    "We changed a few words to make it easier for Americans to read" - You have no idea how hilarious that sounds to us Brits!

    • @wkehrman
      @wkehrman 3 роки тому +4

      As an American....no, that tracks. Thanks, Matt.

    • @anyonewanttoplay7922
      @anyonewanttoplay7922 3 роки тому

      perhaps its because we have separate slang

    • @EvanPederson
      @EvanPederson 3 роки тому

      I know what he meant, but it did sound a bit condescending. 😂

  • @sorio99
    @sorio99 4 роки тому +36

    So, I’m thinking they were actually 10 stops away. Right?

    • @JNCressey
      @JNCressey 4 роки тому +10

      Or maybe 10 steps into their journey but it started keeping track counting from 0 instead of the real number.

  • @cobaltbluesky2276
    @cobaltbluesky2276 6 місяців тому +1

    as a massive minecraft nerd i can't help but comment when he mentions minecraft. since the height limit has increased and is now able to be changed, it's not an example of an 8 bit binary number being used anymore. a good one though, would be that you can't set an enchantment level higher than 255. It used to be that if you did, lots of things related to the enchantment would break, but now it's just not allowed, and attempting to set it higher than 255 just makes it level 255.

  • @LimitedWard
    @LimitedWard 3 роки тому +2

    I suspect what happened was a combination of two things:
    1. They subtracted in the wrong order. If the stops are numbered (e.g. stop A = 10 and stop B = 14) then they accidentally did A - B instead of B - A.
    2. The calculation for the number of stops uses a 64-bit *signed* integer while the code used to display the number of stops in the UI expected a 64-bit *unsigned* integer.
    The first mistake produces a small negative number representing the number of stops away. The second mistake displays that small negative number as it's 64-bit 2s complement.

    • @paulstelian97
      @paulstelian97 3 роки тому

      A new comment that doesn't argue about Minecraft? *HOW*

    • @paulstelian97
      @paulstelian97 3 роки тому

      Also small negative presented as positive would be around 2^64, not 2^63 as in this case.

  • @Wordsnwood
    @Wordsnwood 4 роки тому +5

    Well I'm sure glad I ordered the British edition then, as we don't want none of them Zee's up here in Canada!

  • @SojournerDidimus
    @SojournerDidimus 4 роки тому +23

    I quickly scanned over the article. So they say that they use the lowest bit to flag that the other 63 bits are an integer. The tricky thing then is that you'd normally use the highest bit to check for the sign. But when you shift all bits down by one, you must copy the previous highest bit into the new highest bit, or it will indeed be close to 2 pow 63. This process is called sign extension, and their bug probably was forgetting to do this. Processors have separate instructions to do shifting, but sometimes also for shift with sign extension, so they might have missed those up as well.

    • @SojournerDidimus
      @SojournerDidimus 4 роки тому

      @@vigor_grego Yes, I know. Yet when designing such exotic types that use the lowest bit as an indicator for the other 63 bits being integer, the abstraction in between might have had some oversight, some weird corner case that is not handled as it should be.

  • @XanTheDragon
    @XanTheDragon 3 роки тому

    I saw the thumbnail and I IMMEDIATELY knew what went wrong. That number is one I will pick out any day.

  • @aeugh4200
    @aeugh4200 5 місяців тому +1

    what i think (the first second without having watched the video)
    - number = 2^63 -10
    - number saved in a 64 byte package (binary)
    - 1 byte for identification
    => 1 byte off that is 2^63 combinations (incl. 0)
    => max = 2^63 -1
    - -1 is computed as that
    - 9 Stops have been passed, each subtracting one
    => results in number

  • @TheOfficialCzex
    @TheOfficialCzex 4 роки тому +7

    1:54 Matt briefly channels his inner Chewbacca.

    • @ebanavorio
      @ebanavorio 4 роки тому

      And I just was thinking about Star Wars, given the colour of the onscreen text. Star Wars light blue.

  • @Zeturic
    @Zeturic 4 роки тому +12

    First thought is that it sounds like some kind of signedness weirdness.

  • @mo2cubing
    @mo2cubing 8 місяців тому +1

    Oh the days...
    2:33 now the build height for a wall is 384 blocks, BUT it's important to note that it's not altogether different since it's 3 * 2^7. The only difference now is 64 blocks upwards and 64 blocks downwards via negative y values.

  • @bigiron9393
    @bigiron9393 4 роки тому +1

    So, 9,223,372,036,854,775,798 is super close to 2^63 (9,223,372,036,854,775,808)
    Their difference is 10, so my guess is, during their travel, the app may have seen 0 stops between initially, but the train made 11 stops, causing the roll over. The reason it would be 11 extra stops would be counting for the roll over.

  • @Josh-ui7nq
    @Josh-ui7nq 4 роки тому +3

    My question is who decided 63 bits was needed to show the stops? Surely 16 would be far more than enough.

  • @YuvrajHanspal
    @YuvrajHanspal 4 роки тому +7

    That shade at the end about the crappy American English 🤣🤣🤣

  • @BBall0027
    @BBall0027 5 місяців тому

    4:33 That explains the negative bolts glitch in the second Ratchet & Clank game (Going Commando in the US, Locked and Loaded in Europe). The game's bolt counter is a 31-bit number so when you surpassed 2,147,483,647 bolts, it would loop down to -2,147,483,647, something that happened to a lot of people, because due to the game's two crystal collecting side missions and the addition to a bolt multiplier if you don't take damage in Challenge Mode, it became a lot easier to earn billions of bolts, where the original took multiple Challenge Mode playthroughs just to earn 1 million.

  • @nialltracey2599
    @nialltracey2599 4 роки тому

    Wow. All the things you could have checked and looked up, but didn't bother to. What an informative video.

  • @brycemw
    @brycemw 4 роки тому +3

    I love my copy of Humble Pi. I got the first version even though I’m in Canada. I even got a signed one! I just finished it a few days ago, it’s a great book that I would definitely recommend to anyone who finds maths interesting

    • @vibaj16
      @vibaj16 3 роки тому +1

      Bryce Why’d you get it signed? Pi is always positive!

  • @samtherat6
    @samtherat6 3 роки тому +5

    0:41
    Man, Matt is amazing. I was halfway through him reading the number above his head, before realizing he wasn’t actually reading the number above his head.

  • @michaelphelps2350
    @michaelphelps2350 3 роки тому +1

    Paused at 4:03. Theory: It's a 64 bit SIGNED integer so the leftmost bit is used for the sign. There was underflow that made it wrap around to negative 9 trillion, but something in the program is ensuring the number remains positive.

  • @Quancheese
    @Quancheese 8 місяців тому

    I loved reading Humble Pi! It’s one of those page turners that you can read in a couple of sittings. 💛

  • @gaellafond6367
    @gaellafond6367 4 роки тому +6

    8:45 The way you say it, it really sounds like the book needed to be "dummyfied" for Americans...

    • @inkyscrolls5193
      @inkyscrolls5193 4 роки тому +2

      It does.

    • @vibaj16
      @vibaj16 3 роки тому

      Inky Scrolls No, more of a dialect change

    • @CTGReviews
      @CTGReviews 7 місяців тому +2

      @@inkyscrolls5193it didn’t dude wth

  • @patavinity1262
    @patavinity1262 4 роки тому +3

    And I was expecting a video about what a 9-quintillion-stop train line would be like.

  • @jon9103
    @jon9103 3 роки тому +1

    5:35 modern computers (i.e. since c1980s) use "two's complement" to represent negative numbers since that doesn't require the messy step of having to add one because that's handled as part of the negation operation. The "two's complement" algorithm is flip all the bits and then add one, note this works because the bit representation of the negative number when interpreted as an unsigned integer is congruent with the negative number modulo 2^64, in other words this works because computers implicitly use modulo arithmetic.

  • @-Osiris-
    @-Osiris- 4 роки тому

    Thanks Matt, this was super interesting

  • @GrizonII
    @GrizonII 4 роки тому +3

    “Using creative _bits_ of mathematics” seems quite relevant to this video’s topic.

  • @Nejvyn
    @Nejvyn 4 роки тому +7

    "So there you are! What are the chances? ... Quite high." ¯\_(ツ)_/¯
    I lol'd

  • @kingacrisius
    @kingacrisius 3 роки тому +2

    2:30 Outdated info, height limit is now 320. Total height is 384 (coordinates go down to -64)

  • @k1llyah
    @k1llyah 3 роки тому

    love that moment of self reflection 7:38 "quite high"