Page 1 of 1

A way to add 'Infinite' Integers?

Posted: Oct 15th, '18, 22:34
by Calloway
I was just playing around with C++ when I stumbled across a tutorial on how to multiply very large integers by using strings.
I made a little example http://coliru.stacked-crooked.com/a/a92b251c4593be48 based off of Sergey Zubkov's C++ code and so far everything seems to work great, so why not implement this into GP?

Re: A way to add 'Infinite' Integers?

Posted: Oct 16th, '18, 16:21
by MSandro
Sounds very nice. But I think the performance would be very low. Working with large integers in GPs current implementatiin isn't performing that good at all.

Re: A way to add 'Infinite' Integers?

Posted: Oct 22nd, '18, 05:00
by manyone
as an exercise, i translated the code to GP! (https://www.geeksforgeeks.org/multiply- ... s-strings/)

Re: A way to add 'Infinite' Integers?

Posted: Oct 22nd, '18, 19:21
by Calloway
There was a small error with a small fix that makes the whole thing work perfectly,
just add

Code: Select all

(letters (toString s))
when you define the nums2list method

Re: A way to add 'Infinite' Integers?

Posted: Oct 23rd, '18, 02:09
by manyone
it works in its current form but i have to right click on the input boxes so they change from oval (numeric input) to rectangle (string input) before i enter my data. (see image).
however, after i applied your fix, i don't have to think about doing that anymore! thanks!

Re: A way to add 'Infinite' Integers?

Posted: Feb 27th, '19, 18:36
by Calloway
Hmm, this could be optimized even more by using adding 32 integers together instead of number by number but I don't know how this could be implemented :/