As part of project 9 is was thinking of doing the above.
What I'm wondering is if there's a mistake in my thinking concerning design (and whether it's possible to implement at all)
So the idea is that you'd have something like:
var NumBer x
let x = -273235837434000000057345374530.000030040340050345030523462
(Am implementing in this way
let x=NumBer.new("-273235837434000000057345374530.000030040340050345030523462");
and transferring the string to a number array)
So far so good (ie I can convert a long strings (at least 50 chars) into number arrays appropriately aligned).. .
For addition and subtraction the decimal points have to be aligned (is that really true ? I guess so) but not so for multiplication or division?
In order to speed things up, rather than storing each digit in an array element, I'm storing 4 digits (max 9999) so once i've got my decimal points aligned it should be fairly trivial to add or subtract.
eg
27 3235 8374 3400 0000 0573 4537 4530.0000 3004 0340 0503 4503 0523 462 plus
3457 3456 9834 5739.2346 3997 1100 0001 2200
easy.
My worry is multiplication etc. (I wrote a similar class in C++, but it's not very well written and it's well over 600 lines, eek)
Obvs I'll have to implement Equals and maybe Less Than as well. And the division !
Before I go a 'waste' a few weeks on this, does anyone see any holes in my thinking etc etc. Any input much appreciated even if you think i'm bonkers.
Then if I can get it to work, use that class to do some mandlebrot drawing...
Thanks in advance