Author Topic: Needed Routines  (Read 28098 times)

0 Members and 3 Guests are viewing this topic.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Needed Routines
« Reply #15 on: January 27, 2011, 06:00:12 pm »
Ah, well pseudo-code is just the algorithm explained as words.  For instance:

Pseudo-code for eating a sandwich:
1.) Get out bread, meat, cheese, and condiments
2.) Layer appropriately
3.) Eat :)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #16 on: January 27, 2011, 06:05:52 pm »
Oh, okay... lemme see... Divide MP number by E:
Get pointer to multi precision number
Get length in bytes of said number
Zero out A
Multiply this value by 8 for the number of bits
Use a multi precision shifting routine to shift the bits left
Do a 17 on A (erm, shift left while carrying in the carry)
compare a to E
If A is greater than or equal, subtract E and set the last bit (by adding 1) to the multi-precision number

The result is that the old mp number contains the results of a division by E.

It is like long dividing... in binary...

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: Needed Routines
« Reply #17 on: January 27, 2011, 09:37:15 pm »
Thanks for the info. Aren't 31 bytes numbers a bit large, though? O.o

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #18 on: January 27, 2011, 09:40:12 pm »
yep ^-^ Which is what makes it useful to people like me who like to work with large numbers :D I plan to make some math functions available for BatLib that deal with much larger numbers. Maybe I'll add some symbolic, but I doubt it :P

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Needed Routines
« Reply #19 on: January 27, 2011, 10:04:28 pm »
Big Integers would be awesome.  As in integers that fill up as much room as mem can hold.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #20 on: January 27, 2011, 11:13:31 pm »
Yep :D I can tweak the routine a little to handle numbers much larger than 248-bits... I think it would add about 14 bytes to the code (because ED43**** and ED4B**** are four bytes and some push/pop things could be removed).

SirCmpwn

  • Guest
Re: Needed Routines
« Reply #21 on: January 29, 2011, 01:39:13 pm »
Hi,
I did disappear due to the extreme escalation of problems at home.  I'll pop in occasionally as often as I can, but it won't be often.  I'm still managing some work on tiDE, though.
Xeda, I'd love to use those routines!  They would be especially useful.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #22 on: January 29, 2011, 02:15:42 pm »
Okay, I hid them in the spoilers in these posts:
Rectangles:
http://ourl.ca/6825/168393
MP_Div_E:
http://ourl.ca/6825/168438

And the documentation is somewhere in this PDF :D

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Needed Routines
« Reply #23 on: January 29, 2011, 02:18:38 pm »
Just a tip: Try not to put [code] tags in spoilers. In some browsers (like Chrome) it shows up really, really small.




Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #24 on: January 29, 2011, 02:20:07 pm »
Sorry, I just like fixed width stuff. I'll remove them, though.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Needed Routines
« Reply #25 on: January 29, 2011, 02:26:53 pm »
You can use [tt][/tt] for fixed-width without code blocks :)




Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #26 on: January 29, 2011, 02:27:53 pm »
Oh, thanks! I know I saw that somewhere, but I couldn't remember what the code thing was.

SirCmpwn

  • Guest
Re: Needed Routines
« Reply #27 on: January 29, 2011, 03:33:40 pm »
Thanks, where does the screen buffer fit into that routine?
(By the way, if you'd be willing to share any more routines, I'd love it :D)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Needed Routines
« Reply #28 on: January 29, 2011, 03:36:27 pm »
Ah, let me check which version of that routine I uploaded. One used a pointer stored in a temporary RAM address and the other just used plotSScreen. I forgot Scout's tool converted to decimal, not hex. Oh, and I'm working on more ideas :D

SirCmpwn

  • Guest
Re: Needed Routines
« Reply #29 on: January 29, 2011, 03:38:02 pm »
The one using plotSScreen would be nice.