just store the numbers as binary string uwu
no need to care about cpu architecture ever again.
need a 6827891 bit number? sure, just set up your string and get working
And what about mathemetical operations like add and subtract, do string operations on them?
i mean, this is somewhat how bigInt works, just that it works with decimals instead of binary.
but yea, you make a class, define an add and subtract method, then then does an index by index addition/subtraction, and then returns the value in the end or updates the value in the object directly.
it obviously isnt as efficient as working with normal ints and so on, but it gets the job done in situations where you need extremely large numbers as you arent bound to 32 or 64 bit anymore.
added bonus, it works on every platform.
No bigfloat yet, even though it's extremely easy if we're willing to make the same math operations tradeoff.
i would go as far as to say, the main use case for bigInts is when you are doing RSA for example, calculating with massive exponents and so on.
as for floats/doubles, i suppose those just arenr as useful to make them a default thing.
but yea, functionality wise, they would work the same way
I know how bigint works, but you don't use it everywhere , because each operation requires karatsuba and fft. While using computer architecture to solve arithmetic operations is better for integer because each bit operation is done together. Hence we work on integers not on bigint unless necessary.
well yea, they are very inefficient, as such their usage is pretty limited.
One such use case would be RSA for example, with the MASSIVE exponents that you use to generate keypairs.
Just concatenate the operation into the string.
Store it as a decimal digit string like Cobol. You can even save memory by using only 2 digits for the year.
processor explodes
I was writing some assembly not too long ago where I needed to do 64bit adds in 32bit code. This is where I leaned that x86 has instructions for arbitrary precision arithmetic.
It has add carry and extending multiplication. arm also has those.
Some years ago I needed/wanted 64 bit variables at a 8 bit PIC microcontroller...
I had to use another compiler for that, but then it worked.
bro is colossal
Bro exceeds INT32_MAX
Bro that’s DJ Khaled
Suffering from overflow
i refuse to believe
Legends foretold the coming of Huge Endian