Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Faster addition in string math. Now with multiplication!
#4
Here's the trick for subtracting string math -- it's just addition !!

-3 - 3... if the signs are the same, you just add the values and keep the sign. -3 + -3

3 - 4 or 4 - 3... if signs are different, the result will always be the sign of the largest number.

3 - 4 is 3 + -4. 4 is larger than 3, so we use the sign on the 4 for the result. (-) The swap a and b so a is 4, b is 3, and subtract up to 18 digits at a time.

That's all there is to it. Wink
Reply


Messages In This Thread
RE: Faster addition in string math. - by SMcNeill - 08-18-2022, 08:16 PM
RE: Faster addition in string math. - by Pete - 08-18-2022, 09:15 PM
RE: Faster addition in string math. - by SMcNeill - 08-18-2022, 09:59 PM
RE: Faster addition in string math. - by SMcNeill - 08-18-2022, 10:08 PM
RE: Faster addition in string math. - by SMcNeill - 08-18-2022, 11:46 PM
RE: Faster addition in string math. - by Pete - 08-19-2022, 10:07 AM
RE: Faster addition in string math. - by SMcNeill - 08-19-2022, 11:26 AM
RE: Faster addition in string math. - by Pete - 08-19-2022, 04:44 PM
RE: Faster addition in string math. - by SMcNeill - 08-19-2022, 04:58 PM
RE: Faster addition in string math. - by SMcNeill - 08-19-2022, 05:57 PM
RE: Faster addition in string math. - by Jack - 08-19-2022, 09:54 PM
RE: Faster addition in string math. - by SMcNeill - 08-19-2022, 11:48 PM
RE: Faster addition in string math. - by SMcNeill - 08-20-2022, 03:49 AM
RE: Faster addition in string math. - by Pete - 08-20-2022, 06:16 AM
RE: Faster addition in string math. - by SMcNeill - 08-20-2022, 06:41 AM



Users browsing this thread: 12 Guest(s)