HOW COMPUTERS CAST STRINGS TO NUMBERS

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024

Комментарии • 196

  • @jannegrey593
    @jannegrey593 2 месяца назад +71

    Funnily at 10:10 there might be a mistake - because the number "1 0000 111 0000" after adding "00000 111" lengthens to "1 0000 111 00 111", so it "feels" like there is additional 0 between 2 triples of "1". And it doesn't feel like we needed to expand due to number being too big (256,512 - we are in between). But I didn't have the time to check it.

    • @CoreDumpped
      @CoreDumpped  2 месяца назад +35

      Yeah, somehow that 0 got in between. I didn't noticed this while editing so thanks. I'll pin this comment.

    • @CoreDumpped
      @CoreDumpped  2 месяца назад +52

      Somebody else also noticed that the condition in the C version of the algorithm is wrong.
      `str[i] < '0' && str[i] > '9'` will always return false, since it's checking if str[i] < 48 and str[i] > 57, which is never true. The condition should be `str[i] < '0' || str[i] > '9'`
      My apologies for these mistakes.

    • @zionmelson7936
      @zionmelson7936 2 месяца назад

      your byte format sucks bruv 😐

    • @jannegrey593
      @jannegrey593 2 месяца назад +5

      @@zionmelson7936 I was formatting 1 and 0 separately, so one could see there was additional number there. I didn't go for actual formatting like it should be.

    • @twqzjsidIsndusiakdixisqjeksixi
      @twqzjsidIsndusiakdixisqjeksixi 2 месяца назад +2

      @@CoreDumpped No worries, Core. Programming is hard.

  • @paulosouza449
    @paulosouza449 2 месяца назад +146

    This channel is criminally underrrated. This is top tier content for free

    • @idehenebenezer
      @idehenebenezer Месяц назад +1

      To everyone in this chat, Jesus is calling you today. Come to him, repent from your sins, bear his cross and live the victorious life

    • @CritickalTvRandom
      @CritickalTvRandom Месяц назад

      Toda la maldita razón del mundo, amigo

    • @justsomeordinarykid923
      @justsomeordinarykid923 Месяц назад

      @@idehenebenezerwe got people glazing Jesus before gta 6

  • @dkub3522
    @dkub3522 2 месяца назад +72

    "And on this channel, we hate black boxes."
    *subscribed*

  • @xOWSLA
    @xOWSLA 2 месяца назад +56

    It's funny that right now at my job, I am dealing with serializing ASCII characters and you are making this video. I'm really glad I'm here George. Nicely done.

    • @GoldbergToastyBred
      @GoldbergToastyBred 2 месяца назад

      im learning c and tried to do i kind of failed and after that he makes that video

    • @vladsiaev12
      @vladsiaev12 2 месяца назад

      how did you send a comment 6 hours before the video uploaded?

    • @PennyEvolus
      @PennyEvolus 2 месяца назад

      ​@@vladsiaev12they pay for early access

    • @rebecasally
      @rebecasally Месяц назад

      ​@@vladsiaev12 probably a member of the channel

  • @ava3a13
    @ava3a13 2 месяца назад +35

    While on the topic, I know it's a bit early for the channel to explain it now, but whenever you get to architectures, please don't forget endianness explanation, there are always explanations of how but not of why. Great video as always!!

    • @CoreDumpped
      @CoreDumpped  2 месяца назад +23

      Yeah, there is a video about endianness already on the list.

    • @marcuswilliams3455
      @marcuswilliams3455 2 месяца назад +1

      Ah, that Little Endian vs Big Endian discussion. ;)

    • @jack4x3
      @jack4x3 2 месяца назад

      There is simply no why, computing machines should exist in one of the ways. Either one is a choice

  • @oglothenerd
    @oglothenerd 2 месяца назад +17

    A video on how computers represent negative and floating numbers. That would be amazing!

    • @idehenebenezer
      @idehenebenezer Месяц назад

      Jesus is the only way to salvation and to the father.
      Please repent today and turn away from your sins yo escape judgement 🙏🙏 There is no other way to get to the father but through him.

    • @oglothenerd
      @oglothenerd Месяц назад +5

      @@idehenebenezer I cannot tell if this is a funny way of saying that my idea is insane, or if this is genuinely an ad for Christianity.

    • @xM0nsterFr3ak
      @xM0nsterFr3ak Месяц назад +1

      For negative numbers look into 2-compliment and for floating point number look into IEEE 754

    • @oglothenerd
      @oglothenerd Месяц назад +1

      @@xM0nsterFr3ak I figured out the basics, but a video on how that stuff is actually dealt with in the CPU would be amazing!

  • @thibaut5345
    @thibaut5345 2 месяца назад +11

    This is not casting, this is converting. Casting is a grammatical operation (forcing the compiler to think that a data has a certain type, but not actually doing any conversation).

    • @Nicoder6884
      @Nicoder6884 Месяц назад +2

      Casting sometimes requires conversion.
      “10” - 2 in JavaScript both casts *and* converts “10” into 10 in order to return 8

  • @adityavs18
    @adityavs18 2 месяца назад +8

    Amazing. I’m literally addicted to learning like this through your videos. They’re awesome ! I can’t wait for the next one and yes I would love a video on conversion of the binary values back do string to understand how the print function works !

  • @patrick8613
    @patrick8613 2 месяца назад +2

    I talked to my colleagues about this exact problem, specifically the one you mentioned in the end, great video!

  • @AntonioZL
    @AntonioZL 2 месяца назад +6

    Not the topic I expected after the last videos, but still a very welcome one.

  • @user-nk7tb6qg3v
    @user-nk7tb6qg3v 2 месяца назад +4

    I love channels that demystify these things
    tks

  • @anonymous0x0
    @anonymous0x0 2 месяца назад +4

    This channel is pure gold.

  • @verysadboyo7424
    @verysadboyo7424 2 месяца назад +3

    I can sleep in peace now, I had exactly this question today and yes chair I was looking for double w.

  • @smallcube-zn2mm
    @smallcube-zn2mm 2 месяца назад +3

    Another way to do:
    1. Take the string as argument
    2. Access every character
    3. Use fixed values with switch cases for every character till '0' to '9'
    like
    switch(str[i])
    case '1' : 001
    4. Do bit shifting to create a BCD value containing all characters
    5. Convert BCD to binary
    6. return binary
    It may or may not be faster

    • @trapfethen
      @trapfethen Месяц назад

      Once you get into SIMD instruction extensions, then a plethora of performance optimizations become available to you.

  • @madelinew2884
    @madelinew2884 Месяц назад

    I'm really happy I found this channel... I somewhat knew how it worked, but this just makes it really clear. You are great at explaining things. I am eagerly waiting for more videos

  • @windowhand
    @windowhand Месяц назад +1

    Just want to say that you are the one i was searching for. You answers same questions as mines and in a way that i wanted. Hope you would get more known

  • @kunalchakraborty9735
    @kunalchakraborty9735 2 месяца назад +15

    Revolutionary idea of getting the actual number

  • @kossboss
    @kossboss Месяц назад +1

    Person reveal. Your a young lad. One of those prodigies I keep hearing about.

  • @brielov
    @brielov 2 месяца назад +1

    This is the way. Would love to see a performant way to do the same with floating points numbers. This kind of video is what I really like to watch.

    • @cyrilemeka6987
      @cyrilemeka6987 2 месяца назад

      Using IEEE-754 binary floating point 32 or 64 format, you would have to manually decode the floating point. First bitcast the floating point to an unsigned integer of the same size, I.e float -> ui32 or double -> ui64, then using the encoding specification you extract the sign, exponent and mantissa from the integer.

  • @cornevanzyl5880
    @cornevanzyl5880 Месяц назад

    This is so well explained, I don't think I'll ever be able to forget this.

  • @lordkauck
    @lordkauck 2 месяца назад +1

    literally Str(number) - 0x30 for 0-9, Str(uppercase letter) - 0x41 for A-Z, Str(lowercase)-0x61 for a-z
    Converting between the two is as simple as
    char(lower) = char(upper) ^ 0x20

  • @morzatt
    @morzatt Месяц назад

    Great video! I would really like to see a video explaining the problem with null values inside languages and how to avoid them, that would be very educative!

  • @Garfield_Minecraft
    @Garfield_Minecraft Месяц назад +1

    This is actually easy how I would think
    Since "0" is 48 we subtract 48 from it get the real value first then multiplying to the correct power of 10. So once the number is inputted "1234" turn them to binary 1 10 11 100 and multiply and adding(but computer does to know what index number to start with which isn't so hard) and we get the number before input another number. These process happened really fast we cannot notice them

  • @Pwnification
    @Pwnification 2 месяца назад

    This channel is perfect to watch alongside taking CS50 to start my programming journey. Pretty excited about understanding everything in this video and learning more. Thanks for the quality videos.

  • @jannegrey593
    @jannegrey593 2 месяца назад +1

    Another video! I'm glad I checked your channel, since there was no notification. Typical of RUclips sadly. Though it probably has to do with delay between the last part and this video. RUclips deprioritizes notifications if you normally have 1 week cadence and then suddenly release video month later. Honestly being a RUclipsr is a ton of work.

  • @swordoman2158
    @swordoman2158 Месяц назад

    When it gets to converting decimal fractions as strings to floats things get a lot more complicated. Looking forward to seeing a new video about this case in the future!

  • @ruhollahh01
    @ruhollahh01 2 месяца назад +1

    great job thank you
    i would love an explanation about formatting numbers into strings as well!

  • @Nick-ex4tk
    @Nick-ex4tk 2 месяца назад

    My man your videos are awesome. Can you do an explanation on how the clock is used to move the process forward from the transistor level? For example, how do transistor gates use the clock to take the next instruction into the instruction register at the right time?

  • @robelbelay4065
    @robelbelay4065 Месяц назад

    Beautiful explanation, especially if that code at the end. Thank you very much

  • @shmuel6
    @shmuel6 Месяц назад

    You my friend have done the impossible. You have actually made programming make sense.

  • @Garfield_Minecraft
    @Garfield_Minecraft Месяц назад +1

    This is actually easy how I would think
    Since "0" is 48 we subtract 48 from it get the real value first then multiplying to the correct power of 10. So once the number is inputted "1234" turn them to binary 1 10 11 100 and multiply and adding(but computer does to know what index number to start with which isn't so hard) and we get the number before input another number. These process happened really fast we cannot notice them
    I mean we can even start backwards just tell it(computer) how long the number is ourselves but that means we have to know tell the length parameter so that way is better

  • @mrdj6450
    @mrdj6450 2 месяца назад

    From now i respect my computer, doing this all process within micro seconds...
    Thanks for the best video...

  • @HkRines
    @HkRines Месяц назад +1

    0:07 Yes... Just yes. Maybe this will be SUPER slow but yes)
    I have this in mind:
    1. Represent each character in string with 4-bit binary number (Using Unicode)
    2. Make BCD number from all characters
    3. Convert BCD to binary.
    Now you have a number.
    For example:
    "532"
    1. || "5" = 0101 || 3 = 0011 || 2 = 0010 ||
    2. 0101 0011 0010
    (BCD to Binary algorithm)
    3. "532" = 1000010100
    __________
    Now I'll watch video)
    ----------------------------------
    Ps. Subtracting 48 is a very cleaver solution!! Now we can do same thing as i did.
    But initially i just wanted use table to store Unicode and number like this:
    | Unicode Number | Number in Binary |
    And use this table to convert each symbol to a number but yeah we can just subtract '0' encoding to get a number!

  • @Zensi123
    @Zensi123 Месяц назад +2

    Hi, thanks for this video. What tools do you use for your animations? They are amazing.

  • @1kvolt1978
    @1kvolt1978 2 месяца назад +1

    Well, actually, there is a limit for integer numbers (as well as float), at least in C. And there is also negative numbers. So the more proper function is a little bit more complex.
    I wrote mine like this:
    int64_t StrToNum(char *Str) {
    int64_t Result = 0;
    uint32_t Index = 0;
    bool IsNegative = false;
    if (Str[0] == '-') {
    IsNegative = true;
    Index = 1;
    }
    while ((Str[Index] != '\0') && (Str[Index] >= '0') && (Str[Index]

  • @merveilleskatumba2886
    @merveilleskatumba2886 Месяц назад

    The way I agree
    This channel is very underrated

  • @danielrhouck
    @danielrhouck 2 месяца назад

    I would like a future video about converting an int to a string, but I am more interested in the much more complicated process of converting a float to a string.

  • @timschulz9563
    @timschulz9563 2 месяца назад

    ASCII allows for the use of a bitmask to get the number itself. The probably preferred way to convert these BCD numbers to an integer is reverse double dabble. There's a wiki article about it. This algorithm gets rid of expensive and area intensive (depending on your architecture, first for CPU, second for FPGA/custom silicon) multiplications and relies on fast/small shifts and add/sub operations.

  • @Jack-do3sy
    @Jack-do3sy 2 месяца назад

    Man I love this channel so much, this would've been so helpful back when I was learning to do this kinda stuff lol

  • @dj.yacine
    @dj.yacine 2 месяца назад +2

    Always high quality content 😊

  • @TheFacal
    @TheFacal 2 месяца назад

    Thank you so much, this was a question I had from some time ago. I would love to see the continuation of this video :)

  • @olhoTron
    @olhoTron 2 месяца назад

    I work on a php application where someone in the past reimplemented the string to number conversion...
    And if you have questions...
    Yes, it involved a loop with a bunch of ifs to check each digit
    Yes, they messed it up
    Yes, changing the usages of the function to "(int)$value" fixed a lot of bugs
    Yes, the person who did it (acording to git blame) still works there but was promoted to manager
    No, we dont do code reviews or anything like that

  • @eliasepg
    @eliasepg 2 месяца назад

    It reminds me about the college times! I really like this stuff, thank you!

  • @CybernetonPL
    @CybernetonPL 2 месяца назад +1

    11:55 spoiler, it's the double dabble. Look for Sebastian lagues visualizing data with displays video

  • @perpetualrabbit
    @perpetualrabbit День назад

    At 7:28 I am getting worried you are going to ignore the fact that there is a maximum integer value (and minimum for negative, but let's not get into that yet).
    So for a unsigned decimal character string, the 'maximum' _string_ is "18446744073709551615", which is a string of ASCII characters and not a number yet.
    How are you going deal with strings that have a numerical interpretation that is larger than MAXINT?

  • @marcuswilliams3455
    @marcuswilliams3455 2 месяца назад

    Great, that's a perfect illustration of what happens internally with the atoi() function. Ah, I noticed there is minor difference between converting a numeric string to a binary integer vs converting a numeric string to a BCD number. And that is multiplying by 10 vs shifting by 4 bits (since BCD numbers represents each numeric digit every 4 bits).
    I find it rather interesting, with the IBM mainframe, existing a single machine instruction (CVD) which can convert a numeric string (up to 31 digits) to BCD number. Likewise, there's another instruction (CVB) which can convert these BCD number into integers.

  • @abhilasha4334
    @abhilasha4334 2 месяца назад

    Yes we need that too and don't forget to upload the remaining part of cpu episode

  • @utilizadorable
    @utilizadorable 2 месяца назад

    Great video, as always. Got me curious to understand how the process works with negative numbers.

  • @waynehawkins654
    @waynehawkins654 2 месяца назад

    Nice, I will show my class this. Well explained.

  • @thaivo666
    @thaivo666 Месяц назад

    Can you make a video about how to virtual memory works in OS? Thanks a lot. All of your videos are so useful.

  • @Milan____
    @Milan____ 2 месяца назад

    "Shipping to Alaska, Hawaii, Puerto Rico, and International addresses is currently not available." -> pity I was actually looking for a new chair
    Anyway, good video, it's nice to see easier topics now and then.

  • @cryptociva
    @cryptociva Месяц назад

    Your videos are a blessing!

  • @jbond5834
    @jbond5834 2 месяца назад

    the sequential method in the video also solve the issue ,when the input string is like '0987''

  • @thunder____
    @thunder____ 2 месяца назад +1

    The conditionals you add at 11:06 are incorrect, the C code should have || instead of &&, and the Python code should have a ‘or’ and check both ends the same way the C code does; the way you wrote the C condition can never possibly trigger to raise the error you intend, because a character can't possibly be below 0 and above 9 at the same time, and the Python condition will behave completely differently than the way you intend, because first the “‘0’ < char” will evaluate to a boolean, and thus will never trigger the “char > ‘9’” because, just like in C, booleans are either 0 or 1. And even if the Python code behaved the way you intended, it's still missing a ‘not’, so it would trigger when the char IS numeric, not when it's NOT.
    I believe it's also a better idea to return null in C in this case, because -1 is a valid integer and is thus much more difficult to detect as an error value.
    Overall, still a great video! You explain the computer science concept very well, which is ultimately the value this video provides, and I'm perfectly happy to overlook erroneous code examples because this is not a programming tutorial. I've learned an incredible amount about computer science from your videos already, and this video has been no exception.

    • @CoreDumpped
      @CoreDumpped  2 месяца назад +1

      Yeah, I already pinned a comment referring to this. My apologies, thanks for the feedback.

  • @portalwalker_
    @portalwalker_ Месяц назад

    I think it's more intuitive to multiply the numbers by magnitudes of 10 first and then adding them up. After that the better algorithm that you showed in the video would've been more clear I think

  • @electrolyteorb
    @electrolyteorb 2 месяца назад

    your AI voice is fine. dont change it... GOLD content as always!

  • @luislanga
    @luislanga 2 месяца назад

    Thank God I never thought about this before I saw the title of this video

  • @aldomaresca9994
    @aldomaresca9994 2 месяца назад

    dude, youre going to the moon, and i'm liking your videos all the way there

  • @anon_y_mousse
    @anon_y_mousse Месяц назад

    I've always found it rather beautiful that ASCII encodes decimal characters as 0x30 to 0x39 in hex, so mentally you can just remove 0x3 and know what the number is.

  • @knkootbaoat6759
    @knkootbaoat6759 2 месяца назад

    please do explain the process from getting from an integer to "string"/output. Keep up the great work!

  • @blackhorse8422
    @blackhorse8422 2 месяца назад

    Please make a video about big and little endianness, I always forget the order and don't understand the order of bits itself in comparison to the byte order.

  • @wikbar13
    @wikbar13 5 часов назад

    Good content, please keep it up!

  • @pepemanolo69
    @pepemanolo69 2 месяца назад

    Subscribed, wanna see the second part

  • @diadetediotedio6918
    @diadetediotedio6918 2 месяца назад

    Before watching the response, this was the algorithm I came up with:
    ```
    base = 10
    str = "1030"
    println(string_to_int(str, base))
    fn string_to_int(str: string, base: int) {
    let number = 0
    each (index, char) of str {
    let digit = lookup_from(char)
    let exp = base ** len(str) - index - 1
    number += digit * exp
    }
    return number
    }
    ```

  • @MickeyToler-ye9ds
    @MickeyToler-ye9ds 2 месяца назад

    I would like you to explain and give an example of the end process that you asked about.

  • @revolutionarydefeatism
    @revolutionarydefeatism 14 дней назад

    Please create a video explaining how CPUs handle floating-point numbers.

  • @user-ng3ps6vd6u
    @user-ng3ps6vd6u Месяц назад

    How to convert a number to a string: The key instrument is integer division. Let's consider the number 4327. Dividing by 10 we obtain 432 and remainder 7. Now, we already know how to convert a single digit to its corresponding ASCII code: just add 48 or ord('0'). So in this one step we obtained the so called least significant digit (7) and are left with 432. Now, we just have to repeat the same procedure until we are left with no more digits (when the last division yields 0 as the quotient).
    PS: Integer division is just a single processor instruction and actually gives both the quotient and the remainder in one go so it's pretty fast.

  • @Andremzsptm
    @Andremzsptm 2 месяца назад +1

    Great content as always!

  • @laoluade5741
    @laoluade5741 Месяц назад

    I would love to see an explanation for thr reverse!

  • @somerhaha1687
    @somerhaha1687 Месяц назад

    I had to learn this when making my own programming language and i wish i had found this video sooner .-.

  • @atzefatze
    @atzefatze Месяц назад +1

    11:50 ...yes please! :)

  • @marcopinedo2368
    @marcopinedo2368 2 месяца назад

    I'm guessing that in order to convert an integer to a string you have to make reverse process. Instead of multiplying you have to divide the number, take the reminder and add '0'

  • @talwald1680
    @talwald1680 2 месяца назад

    Great video, and it is a very introductory version of the algorithm. However, this is not an efficient algorithm. The reason is due to the fact that the alu can't parallelize the multiplications and the additions. You should see Andrei Alexandrescu's lecture on this! But this can be a cool continuation of this video.

    • @CoreDumpped
      @CoreDumpped  2 месяца назад +1

      Thanks for the advice, I'll take a look at the lecture as soon as I get some free time. I'm assuming it is related to SIMD but if not I'm sure I'll enjoy it anyways.

  • @noritesc5000
    @noritesc5000 Месяц назад

    done the string to float double and it myself
    but a different approach
    stuff skiped in this video
    - Sign of a value
    for applaing a Sign
    multyplay output value by -1 if the '-' is found at the start of a string
    - decimal parsing
    the same way as string to int
    but
    - do it 2 times
    and when . was found instead of multiplying value just divide decimal it by 10 for each Ituretion
    and cheak if value is not to large

  • @NinosYoukhana
    @NinosYoukhana 2 месяца назад

    Amazing! Thank you very much for doing this!

  • @yuseidrex
    @yuseidrex 2 месяца назад +1

    this channel is really good!

  • @user-mg5ut7fh9z
    @user-mg5ut7fh9z 2 месяца назад

    Please please do a video explaining operating system

  • @AbhijitGangoly
    @AbhijitGangoly 2 месяца назад

    Please make a video about the reverse function, Binary to Numerical String.

  • @EMLtheViewer
    @EMLtheViewer 11 дней назад

    11:10 Is this a mistake? It shows the condition for raising an error being that the current char is both less than ‘0’ and greater than ‘9’, which does not make sense. Either the boolean operator should be changed to the OR operator (||) or the comparison operators should be switched.

  • @RaphaelOkai
    @RaphaelOkai Месяц назад

    This is just soo beautiful. 😍

  • @valcubeto
    @valcubeto 2 месяца назад

    Underrated channel

  • @ak-yd6kc
    @ak-yd6kc 2 месяца назад +7

    How computer understand ascii code eg: A= 01000001 or 65 how that possible . because computer only know 0or1.

    • @michaelbeavitt1523
      @michaelbeavitt1523 2 месяца назад +1

      Computers don't really read the values 0 or 1 one at a time, they read 8 bit 'bytes' in a single operation. A byte can hold 256 numbers, or 0-255 (conveniently, the number of letters in the ASCII table... this is not a coincidence). The CPU reads a byte from the RAM and performs an operation on it, often using another byte from a different location in RAM, which gives you a new byte - you can operate on multiple bytes in succession to process numbers bigger than 255. Most modern CPUs have special instructions to operate on addresses bigger than 8 bits though.

    • @olhoTron
      @olhoTron 2 месяца назад +1

      The same way we understand numbers higher than 10 ever though we only use digits 0 to 9

  • @gustavoshigueo
    @gustavoshigueo 2 месяца назад

    11:10 the C if statement should be an OR instead of AND.
    The Python check is also wrong as chaining comparisons cannot be used to check if a number is OUTSIDE a range, only inside
    It should be
    if not '0'

    • @CoreDumpped
      @CoreDumpped  2 месяца назад +1

      Hi, thanks for paying attention to details like this. I already pinned a comment mentioning this. And I apology for the mistakes.

  • @tech_simpleterms
    @tech_simpleterms 2 месяца назад

    Kindly provide clue at the end of the video when will be the next video released?

  • @mohsenzare2511
    @mohsenzare2511 Месяц назад

    Thanks for your video

  • @helmytaufik6735
    @helmytaufik6735 2 месяца назад

    Arigatouu keep em coming 🔥🔥🔥

  • @oscarmendez9079
    @oscarmendez9079 2 месяца назад

    Thanks again for this amazing content

  • @hybrid7042
    @hybrid7042 2 месяца назад

    You are going to tell us about loop ,if what about that

  • @User-ty2ml
    @User-ty2ml 2 месяца назад

    Beautiful!!!! Thanks

  • @StevenHokins
    @StevenHokins 2 месяца назад

    Nicely done, thank you ❤

  • @JEMSS97
    @JEMSS97 2 месяца назад +1

    can you do kernel vs os

  • @TWPO
    @TWPO Месяц назад

    Simply awesome

  • @mdyousufgazi4030
    @mdyousufgazi4030 19 дней назад

    epic explanation

  • @king_james_official
    @king_james_official 2 месяца назад

    i thought it just indexes the string backwards and maps "0"-"9" to 0-9 and then multiplies by 10^n

  • @MOOBBreezy
    @MOOBBreezy 2 месяца назад

    Banger video once again!

  • @AkivaB
    @AkivaB Месяц назад

    Doesn't subtracting 48 just convert it to BCD where you can use reverse double dabble or am i tripping?

  • @mahmoudtawfiq6219
    @mahmoudtawfiq6219 2 месяца назад +1

    at 11:08 shouldn't we use || instead of && ?

    • @user-zw6vz4ec7n
      @user-zw6vz4ec7n Месяц назад

      Yes. The same mistake is in the python code on the bottom.

  • @flv-hd7nn
    @flv-hd7nn 2 месяца назад +1

    please continue>

  • @JordHaj
    @JordHaj 2 месяца назад

    Great explanation as always.
    I have a little question about 11:07. Are the conditions supposed to be like that?
    In the C example `str[i] < '0' && str[i] > '9'` will always return false, since it's checking if str[i] < 48 and str[i] > 57, which is never true. Maybe `str[i] >= '0' && str[i] '9'` will return true on chars that are NOT numeric chars, since it's checking if char > 48 and char > 57, equivalent to `char > 57`, equivalent to `char > '9'`. I suggest `'0'

    • @CoreDumpped
      @CoreDumpped  2 месяца назад

      Yes, mi bad. The condition should be || (or) instead of && (and).

    • @JordHaj
      @JordHaj 2 месяца назад +1

      @@CoreDumpped Oh I just realised I wrote the suggestions for checking for numerical chars, not the opposite.
      So in C it would be like you wrote in the reply, `str[i] < '0' || str[i] > '9'` and in Python basically the same, `char < '0' or char > '9'`. Or you could be fancy and use De Morgan's laws, `not('0'

  • @artiartem
    @artiartem 2 месяца назад

    Can you convert number to string? Or big number? Or float?