Reputation: 106
I am working on a script for unity which takes arrays of numbers (each index only has a number from 0-9. If the number goes above 10, it takes 10 away and increases the [index + 1] value by 1. so, if i wanted a number that was 850, my list would be
List<int> Money = new List<int>() { 0, 5, 8, 0, 0 };
This works, my problem is i am unable to figure out a way to multiply two of these together and get a final answer, i would normally just use regular numbers, but i want this system to be able to go past unity's int limit and scientific notation limit of e+300.
Any help is greatly appreciate, thank you. Have a nice day!
Edit: if this isn't clear enough, here is an example
List1 = {0, 5, 8, 0}
List2 = {3, 6, 3, 0}
i need to multiply list1 and list2 to get
List3 = {0, 5, 5, 6, 0, 3}
Since 850 * 363 = 306,550
Upvotes: 1
Views: 899
Reputation: 1037
To actually give an answer to this in fact quite interesting learning task: I would suggest implementing traditional "manual" multiplication: https://www.wikihow.com/Do-Long-Multiplication Not sure what (internal) libraries like BigInteger do under the hood, but theoretically this would work with your lists because it allows you to go step by step through 10s place, 100s place, 1000s place and so on.
Upvotes: 1