Author Topic: Bignums?  (Read 121 times)

NoCforMe

  • Member
  • ****
  • Posts: 684
Bignums?
« on: September 24, 2022, 07:21:52 AM »
Anyone know anything about bignums?

Specifically, looking for actual implementations in assembler (or in C or some other translatable language), or even a good conceptual explanation.

Just found out about this technique. (Lets you handle numbers of any arbitrary size without being limited by the size of your registers.)

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Bignums?
« Reply #1 on: September 24, 2022, 08:05:11 AM »
From dedndave "Ling Long Kai Fang Bignum to ASCII"
http://masm32.com/board/index.php?topic=222.msg978#msg978


Something like this?
A search here for "Bignum" will yield some more results


I also have 'Ascii Adder' that I used for my fibonacci generator.
http://masm32.com/board/index.php?topic=7262.msg79593#msg79593
Adds ascii decimal text strings of virtually any length (depending on amount of memory allocated of course)...
... :biggrin:

NoCforMe

  • Member
  • ****
  • Posts: 684
Re: Bignums?
« Reply #2 on: September 24, 2022, 08:48:05 AM »
Um, maybe. Not sure that's the same thing, and not quite ready to delve into that code. But it might be that stuff.

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Bignums?
« Reply #3 on: September 24, 2022, 08:49:04 AM »
What do you need it for, what data type?
And, does it have to be fast?
At any rate I think there are still a few math nerds enthusiast members heer who may be able to help.
... :biggrin:

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Bignums?
« Reply #4 on: September 24, 2022, 09:01:01 AM »
a couple more links (from giggle)

A Verified Bignum implementation in x86-64 Machine Code a pdf


working-with-big-numbers-using-x86-instructions


Not sure if this might be what you are after
... :biggrin:

NoCforMe

  • Member
  • ****
  • Posts: 684
Re: Bignums?
« Reply #5 on: September 24, 2022, 09:28:59 AM »
Thanks--that's exactly the sort of stuff I was looking for. I found that scholarly PDF myself, worth looking at. Also found a complete implementation guide (descriptive text, not code), for converting decimal #s to floating-point, which is what I'm interested in at the moment. Interesting stuff.

jj2007

  • Member
  • *****
  • Posts: 12964
  • Assembler is fun ;-)
    • MasmBasic
Re: Bignums?
« Reply #6 on: September 24, 2022, 10:30:34 AM »
You might search the forum for REAL16 or QuadMath, if that's precise enough.

NoCforMe

  • Member
  • ****
  • Posts: 684
Re: Bignums?
« Reply #7 on: September 24, 2022, 12:20:39 PM »
No, I want bignums. Gigantic, humongous, gargantuan #s. "Arbirtary precision".

zedd151

  • Member
  • *****
  • Posts: 1268
Re: Bignums?
« Reply #8 on: September 24, 2022, 02:20:34 PM »
When I was working on ascii adder, I had made a wisecrack to dedndave about making an ascii subtractor , ascii multiplier, and ascii divider.
Of course I didn't complete that series but if I did, the next in line would have been ascii subtractor.
With those two, it's theoretically possible to do multiplication and division albeit longhand. And it doesn't have to be done with ascii text, could be data with adjustments of course. For floats, just keep good track of the decimal places.  :biggrin:
Sounds like a phun coding exercise. Perfect for the Laboratory. Any takers?
 If I ever clear my slate of current projects, I might continue work in this vein with ascii subtractor.  :cool:  dedndave, jimg (helped with its use in the aforementioned fibonacci generator), and rrr314159 (iirc) were instrumental in my work on ascii adder giving some tips. That's when I learned of dedndaves Ling Long Kai Fang library btw.
... :biggrin:

NoCforMe

  • Member
  • ****
  • Posts: 684
Re: Bignums?
« Reply #9 on: September 24, 2022, 02:38:08 PM »
That stuff makes my head hurt.

daydreamer

  • Member
  • *****
  • Posts: 2094
  • beer glass
Re: Bignums?
« Reply #10 on: September 24, 2022, 07:29:22 PM »
Impressive code by raymond with bigness on huge 2^64 fibonnaci
http://masm32.com/board/index.php?topic=9773.msg107857#msg107857
SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."