How to handle large numbers in the C Programming language? Meet the GMP library!

Sdílet
Vložit
  • čas přidán 27. 10. 2022
  • If it comes to really large numbers in #programming you are usually limited to numbers as large as 18,446,744,073,709,551,614. And if a number that massive does not match your needs you will quickly come to the #GMP library: the GNU Multiple Precision Arithmetic Library. So when you have to deal with numbers like the number of sand grains on the world's beaches, the amount of stars in the galaxy, or average level of stupidity of drivers on the highway in front of my wife's car (as she says), the standard library in C often gets us nowhere. In this video you will learn the basics how to open the world of numbers with the GMP library where size really matters!
    If you have further questions, useful feedback, or an idea for a #C-related topic to talk through please leave a comment. From time to time I will come back on your issues in upcoming episodes.
    And if you liked this episode please give it a thumbs up, if you want to see more video like this, subscribe to this channel and don't forget to hit the bell if you want to stay informed, when new episodes are released.
    Sources & Links:
    gmplib.org/manual/index
    gmplib.org/manual/Nomenclatur...
    gmplib.org/manual/Integer-Fun...
    github.com/jagottsicher/myCTa...
    github.com/jagottsicher/myCTa...
    P.S.: If you're interested to learn programming basics in #Google's #programming #language #Go feel free to have a look at my course on #Udemy; www.udemy.com/course/learn-pr...

Komentáře • 11

  • @fabricelealch
    @fabricelealch Před 10 měsíci +5

    Shouldn't the example at 6:54 be while(++i); if we want to count up without output? as it is the i++ increments i but evaluates to 0 so the while body is never executed.

  • @GammaAerospace
    @GammaAerospace Před rokem +2

    How do you not have more subscribers, those content is amazing! Additionally, your thumbnails stand out from most cs tutorials. Keep up the great work!

  • @Code_Name_0
    @Code_Name_0 Před rokem +3

    "this is not a tiktok video for which you need the attention span of a house fly"

  • @bismajoyosumarto1237
    @bismajoyosumarto1237 Před rokem +1

    Thank you very much for the video! The pace might be a little too slow for myself personally (maybe for some other people too), but I suppose this slow pace would be just right for an online Zoom class instead of a CZcams video. Either way, your simple explanations are very helpful!
    Correction,
    at 3:33
    Nothing gets displayed with this code because, after setting i=0, you used while(i++) instead of while(++i). It's not even a compiler optimization; conceptually the code does not even enter the while loop because it reads while(0), skips the while loop, and only then it increments i (that's how i++ works, as opposed to ++i).
    at 6:09
    "This is not outputing anything, but it is clearly going through all the numbers and counting, _naja_, one after another up."
    Well it clearly isn't, due to how i++ works as opposed to ++i. Ah, the second-hand embarrassment...
    I'm glad you eventually found a way around it though. Besides, those are mistakes in the introduction, not about the GMP library.
    (I admit, I was surprised to see that doing mpz_init(x); a second time didn't crash the program, and even automatically sets the value to zero. Earlier I thought it was analogous to declaring a variable twice. I was even more surprised that no addresses nor pointers were needed, maybe it's all under the hood of the mpz_t structure.)
    Keep up the good work!

    • @nunotg
      @nunotg Před 3 měsíci +1

      Yeah I was like "Am I missing something or is this some kind of programmers joke?" With ++i instead the loop runs.

  • @bluekernel2448
    @bluekernel2448 Před 8 měsíci +5

    that's some heavy german accent (me a german may say this)

  • @VandalIO
    @VandalIO Před 2 měsíci

    Can it deal with massive floating point numbers ?

  • @holyshit922
    @holyshit922 Před 7 měsíci

    25:28 In my GMP b is truncated to 32bit unsigned integer

  • @kritosyt6225
    @kritosyt6225 Před 2 měsíci +2

    while(++i) not i++ , while(0) --> false never started.

  • @jittertn
    @jittertn Před 10 měsíci +1

    The unsigned long long number is eighteen quintillion four hundred forty-six quadrillion seven hundred forty-four trillion seventy-three billion seven hundred nine million five hundred fifty-one thousand six hundred fourteen
    just putting it out there 😂😂