A way to add 'Infinite' Integers?

Extending or modifying the GP system itself (advanced!)

Moderator: MSandro

Post Reply
User avatar
Calloway
Posts: 68
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

A way to add 'Infinite' Integers?

Post by Calloway » Oct 15th, '18, 22:34

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?

MSandro
Posts: 156
Joined: Jul 26th, '17, 21:12

Re: A way to add 'Infinite' Integers?

Post by MSandro » Oct 16th, '18, 16:21

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.

manyone
Posts: 17
Joined: Nov 5th, '17, 07:56

Re: A way to add 'Infinite' Integers?

Post by manyone » Oct 22nd, '18, 05:00

as an exercise, i translated the code to GP! (https://www.geeksforgeeks.org/multiply- ... s-strings/)
Attachments
bigmult.JPG
bigmult.gpp
(7.04 KiB) Downloaded 6 times

User avatar
Calloway
Posts: 68
Joined: Apr 30th, '18, 00:28
Location: Eastern United States

Re: A way to add 'Infinite' Integers?

Post by Calloway » Oct 22nd, '18, 19:21

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

manyone
Posts: 17
Joined: Nov 5th, '17, 07:56

Re: A way to add 'Infinite' Integers?

Post by manyone » Oct 23rd, '18, 02:09

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!
Attachments
stringonly.JPG
stringonly.JPG (11.92 KiB) Viewed 310 times

Post Reply