Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
b+ String Math Update
#24
Even an integer 64 handles up to 19 digits without problem:   9,223,372,036,854,775,807

Since 9 digits * 9 digits = max 18 digits, you'd still be able to hold the answer without overflow.

As for tracking any sort of sign.... *WHY* for goodness's sake?!

Do this:

positive * positive = positive
negative * negative = positive
positive * negative = negative
negative * positive = negative

Simple rule, settled from the beginning with your numbers and now you're only dealing with the positive values with the sign safely already stored off to the side.

3 * 3 .... positive numbers only
-3 * -3 .... negative * negative = positive so it's just the same as 3 * 3
-3 * 3 .... negative * positive = negated (3 * 3)

Either way, you're always just doing multiplication with positive values... The sign of the answer is sorted out easily elsewhere in the code. Wink
Reply


Messages In This Thread
b+ String Math Update - by bplus - 09-26-2022, 06:01 PM
RE: b+ String Math Update - by Pete - 09-26-2022, 06:27 PM
RE: b+ String Math Update - by bplus - 09-26-2022, 06:38 PM
RE: b+ String Math Update - by Pete - 09-26-2022, 06:53 PM
RE: b+ String Math Update - by vince - 09-29-2022, 03:16 AM
RE: b+ String Math Update - by bplus - 09-29-2022, 09:26 AM
RE: b+ String Math Update - by Pete - 09-29-2022, 07:59 PM
RE: b+ String Math Update - by bplus - 10-01-2022, 05:22 PM
RE: b+ String Math Update - by bplus - 10-01-2022, 05:30 PM
RE: b+ String Math Update - by Pete - 10-01-2022, 06:09 PM
RE: b+ String Math Update - by bplus - 10-01-2022, 06:45 PM
RE: b+ String Math Update - by bplus - 10-02-2022, 01:49 AM
RE: b+ String Math Update - by Kernelpanic - 04-03-2025, 04:14 PM
RE: b+ String Math Update - by Dragoncat - 04-02-2025, 06:29 AM
RE: b+ String Math Update - by bplus - 04-02-2025, 01:35 PM
RE: b+ String Math Update - by SMcNeill - 04-02-2025, 02:02 PM
RE: b+ String Math Update - by Dragoncat - 04-04-2025, 06:42 AM
RE: b+ String Math Update - by SMcNeill - 04-04-2025, 07:28 AM
RE: b+ String Math Update - by bplus - 04-02-2025, 02:26 PM
RE: b+ String Math Update - by SMcNeill - 04-02-2025, 03:11 PM
RE: b+ String Math Update - by Pete - 04-03-2025, 05:02 PM
RE: b+ String Math Update - by SMcNeill - 04-03-2025, 06:12 PM
RE: b+ String Math Update - by Pete - 04-03-2025, 06:18 PM
RE: b+ String Math Update - by SMcNeill - 04-03-2025, 07:24 PM
RE: b+ String Math Update - by Pete - 04-03-2025, 09:43 PM
RE: b+ String Math Update - by SMcNeill - 04-03-2025, 10:11 PM
RE: b+ String Math Update - by Pete - 04-03-2025, 11:49 PM
RE: b+ String Math Update - by bplus - 04-04-2025, 12:40 AM
RE: b+ String Math Update - by Dragoncat - 04-04-2025, 04:53 AM
RE: b+ String Math Update - by Dragoncat - 04-11-2025, 07:02 AM
RE: b+ String Math Update - by Dragoncat - 04-11-2025, 07:27 AM
RE: b+ String Math Update - by bplus - 04-11-2025, 11:56 AM



Users browsing this thread: 2 Guest(s)