Author Topic: numbers over 255^2  (Read 7584 times)

0 Members and 2 Guests are viewing this topic.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
numbers over 255^2
« on: June 08, 2010, 04:54:16 pm »
ok i was wandering if there was a way to use numbers over the 255 squared 65000 or what ever.
I am mostly asking this to figure out how to manipulate programs i make and will not ever actually NEED to use this. but it would be nice to learn.
as always, thanks for your time.
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: numbers over 255^2
« Reply #1 on: June 08, 2010, 05:10:30 pm »
The trick is to use two numbers I think and put them together (one of them would be from 0 to 9999, to make things easier). I'm gonna try to write a program to demonstrate how it can be done but like last time I awnsered a question someone else will probably come with a clear awnser before me ;D (I guess that's what happen when I am visual x.x)

EDIT: There we go, but the major issue is getting the formatting right :/ (since it's two separate numbers). Basically when the second number reaches 10000 it makes the first increase by 1 and the second is reset to 0

In addition to that, if you have a game where score increases by 10 points multiples, you can simply append a 0 at the end of the score number. This is what Quigibo did in his Pyoro game.
« Last Edit: June 08, 2010, 05:24:23 pm by DJ Omnimaga »

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: numbers over 255^2
« Reply #2 on: June 08, 2010, 05:20:35 pm »
thanks i think i understand what you are saying.
my thought was more pointed into imputing numbers instead of outputting
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: numbers over 255^2
« Reply #3 on: June 08, 2010, 05:23:29 pm »
ooh ok x.x. I am unsure then :S

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: numbers over 255^2
« Reply #4 on: June 08, 2010, 05:29:32 pm »
i would still like to hear your input  (lol calculator command)  about displaying the larger numbers
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: numbers over 255^2
« Reply #5 on: June 08, 2010, 06:31:45 pm »
Note: backup in case I made a typo

0->A->B
Repeat getkey(15)
Text(0,0,B▶Dec
Text((B>9)+(B>99)+(B>999)+(B>9999)+1*4,0,A▶Dec
A+999->A
If A>9999
A-10000->A
B+1->B
End
End

Note I tried adding formatting using boolean logic, like I would do in TI-BASIC, but it didn't work (I mean Text(4+4(B>9)+4(B>99)+4(B>999)+4(B>9999),0,A▶Dec for example)

EDIT: thanks to calc84/dude84se, fixed.

There you go, you have support for a number up to 655359999 (altough it will glitch if you add more than 10000 at once)
« Last Edit: June 08, 2010, 06:51:37 pm by DJ Omnimaga »

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: numbers over 255^2
« Reply #6 on: June 08, 2010, 07:07:01 pm »
If you change "If A>9999" to "While A>9999", it will let you add up to 55536 or so without glitching :)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: numbers over 255^2
« Reply #7 on: June 08, 2010, 07:13:24 pm »
not sure what to mean x.x could you explain how to use it?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: numbers over 255^2
« Reply #8 on: June 08, 2010, 08:58:16 pm »
It will keep subtracting 10000 from A and adding 1 to B until A is under 9999 again. Though, if the original addition to A gives a result more than 65535, it won't work properly.

Edit: typo
« Last Edit: June 08, 2010, 08:59:15 pm by calc84maniac »
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: numbers over 255^2
« Reply #9 on: June 08, 2010, 09:26:53 pm »
thanks much.... i think i understand all this
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: numbers over 255^2
« Reply #10 on: June 08, 2010, 09:28:49 pm »
It will keep subtracting 10000 from A and adding 1 to B until A is under 9999 again. Though, if the original addition to A gives a result more than 65535, it won't work properly.

Edit: typo
I'm even more confused now -.- sorry

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: numbers over 255^2
« Reply #11 on: June 08, 2010, 09:37:43 pm »
so this wont correctly count higher than 255 squared?
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: numbers over 255^2
« Reply #12 on: June 08, 2010, 11:30:02 pm »
You can always display them manually...

This displays the 32-bit number in the location Str1, but destroys the number afterwards. (range of 0 to 4,294,967,295)

Lets Make Str1 hold 9000*9000 = 81,000,000  In Hex, that's 4D3F640.

Code: [Select]
:[04D3F640]->Str1
:
:For(D,0,9)
:0->A
:For(B,0,3)
:A*256+{Str1+B}->C^10->A
:C/10->{Str1+B}
:End
:Output(15-D,0,A+'0'▶Frac)
:End
:Disp i

Of course, you can extend this to any arbitrary length.

Please don't ask me how this works.  I looked up the algorithm on the learn z80 in 28 days tutorial.  I kind of see why it might work, but I don't really know it enough to explain.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: numbers over 255^2
« Reply #13 on: June 08, 2010, 11:40:32 pm »
mhmm interesting, that could be another way to do it I guess. As for the issue regarding adding/substracting a value higher than the part of the number to the right to it, one thing that you can do if you don't need a lot of speed (example: in a RPG at the end of a battle when an enemy gives you 156500 gold at once) is to just gradually increase your gold total by chunks of 10000 until it added 150000 then add the remaining 6500 manually. That said I don't think that's so slow, so it could work in more situations, for example when losing HP in a RPG where damages can exceed 65535

Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: numbers over 255^2
« Reply #14 on: June 08, 2010, 11:53:23 pm »
Yeah, like in videogames in the 8-bit/16-bit era... In these games, internally, the numbers can't be over 65535 and most games allows you to have more points than that... You will often see games that stops counting at 999999 or 9999990. Also, you will often see at the end of a level the point counter increment by 10 in some fancy way with dings each time it increments.

And I would do 32-bit variables with 2 16-bit variables too.
« Last Edit: June 08, 2010, 11:55:05 pm by juju2143 »

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.