Snippet stringType

Discussion in 'Systems and Snippets' started by Darthfett, Jan 4, 2010.

  1. Darthfett

    Darthfett Super Mod

    Ratings:
    +614 / 0 / -0
    Whoops. I updated the functions with an inner-loop check (which should only get evaluated a maximum of two times). Unfortunately, I can't simply skip the first character now, as if there are exactly two signs, it would return true unless I checked every single character, which would dismantle the algorithm. Instead, I'll simply check if there's a sign, and if it's the first character.

    This is true, and it's the reason why I used the algorithm of checking the string in slices of 8. If I had any problems using the SubString function, I might use the BJ, but I don't. It starts at 0 like an array, and I understand it.

    I think that 'sublen' is unneeded, i mean you can simply use 'i' instead.

    That's what I was doing before the last update, but if a string was not a multiple of 8 in length, it would cause the function to try to evaluate 8 characters even if there were only 2 remaining. 'sublen' puts a limiter on the length of each substr.

    S2I("123456789123456789") == 2147483647

    When you get large numbers that are longer than 8 (sometimes 9), it causes problems. :p

    *sigh* fine! :p
     
  2. Troll-Brain

    Troll-Brain You can change this now in User CP.

    Ratings:
    +85 / 0 / -0
    Ah overflow, with the type integer it seems cyclic.
    Max = 2^31 +1.
    And if you increment it, it becomes - 2^31, then , -2^31 - 1 and so one ...
    Where with floats we have weird results, because of this type i suppose, don't know so much about that.

    But i wouldn't consider such integers/reals as valid though :p

    Also i'm pretty sure you can forgive the variable 'sublen', but i'm to much lazy actually ot think about that, will probably post it later if I've found a way.
     

Share This Page