Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Perpetual string math calculator.
#11
Since this is string math, I think you guys are overlooking one obvious thing.

Let's take 1/3 for an example -- the answer is "0.33..."

See that "..." at the end there? That tells you that you're dealing with a repeating fraction, Without it, you're just dealing with 0.33. You don't need to go looking for a repeating pattern; just make certain to assign those "..." to the end of your results, and then if you need to reverse engineer the answer, you can easily do so without having to look for a repeating pattern which may or may not be there. "0.33" could be 1/3 rounded to 2 digits, or it could just be 33/100.

Since you're not just doing numeric-math, but are instead doing full fledged string-manipulation, why not give meaningful results with your string answer which holds more information than just numbers can provide?

I'd suggest a simple "...##" approach, where "..." represents something repeating, and "##" represents how many digits before the repetition. With such a method, 1/3 is "0.3...1" -- with one glance you can tell that you have one repeating digit, and it's the 3. From there you can do your reverse magic mumbo jumbo if you need to, to turn it back into 1/3, and then you can process it from there.

1/3 = 0..3...1
0.3...1 * 0.3...1 = (1/3) * (1/3) = (1/9)
Reply


Messages In This Thread
Perpetual string math calculator. - by Pete - 08-10-2022, 05:11 PM
RE: Perpetual string math calculator. - by Pete - 08-11-2022, 03:24 AM
RE: Perpetual string math calculator. - by Pete - 08-11-2022, 12:39 PM
RE: Perpetual string math calculator. - by Pete - 08-11-2022, 08:29 PM
RE: Perpetual string math calculator. - by Pete - 08-11-2022, 10:08 PM
RE: Perpetual string math calculator. - by bplus - 08-11-2022, 10:07 PM
RE: Perpetual string math calculator. - by Jack - 08-11-2022, 10:35 PM
RE: Perpetual string math calculator. - by SMcNeill - 08-11-2022, 11:03 PM
RE: Perpetual string math calculator. - by Pete - 08-11-2022, 11:35 PM
RE: Perpetual string math calculator. - by Jack - 08-11-2022, 11:42 PM
RE: Perpetual string math calculator. - by Pete - 08-11-2022, 11:51 PM
RE: Perpetual string math calculator. - by Pete - 08-12-2022, 01:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Word Processor Using Single String Pete 3 221 02-28-2026, 12:07 AM
Last Post: Pete
  new approach to base conversion system and math library Dragoncat 2 577 07-16-2025, 10:19 PM
Last Post: Dragoncat
  b+ String Math Update bplus 31 5,187 04-11-2025, 11:56 AM
Last Post: bplus
  I'm adding SQR to my new faster string math routines... Pete 17 3,315 04-01-2025, 04:56 PM
Last Post: Pete
  Font from a string pattern - help needed grymmjack 22 4,982 08-27-2023, 07:26 PM
Last Post: grymmjack

Forum Jump:


Users browsing this thread: 1 Guest(s)