Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Expression evaluator
#15
Quote:ORACLE,
In Stalib, you mention having to "teach" it to subtract. What subtract method did you use?
1) the method where if the digit you're subtracting is greater than the one above, you borrow 1 from the top of the next digit position and add 10 to your top digit.
2) the method where if the digit your subtracting is greater than the one above, you add 1 to the bottom of the next digit position, and add 10 to your top digit.

Method 1 is very hard to program because when you go to "borrow" you may have to move over several digit positions to find one that is not zero.

Method 2 is very easy to program.
*****

Ahem... I'm adding and subtracting using STRINGS. Each number is stored in a string so numbers in QBasic can be 32,767 digits long. For addition etc I have to extract each individual number and add/subtract them, and then carry. The base routines are actually by Neo for his BIGINT lib (I was gonna use agamemnus's clone but it doesn't work properly), but now I am adding decimal, negative and standard form support (the *hard* part).
Reply


Messages In This Thread
Expression evaluator - by Nexinarus - 07-10-2003, 10:48 AM
Expression evaluator - by Agamemnus - 07-10-2003, 05:46 PM
Expression evaluator - by toonski84 - 07-10-2003, 07:05 PM
Expression evaluator - by Moneo - 07-10-2003, 11:36 PM
Expression evaluator - by Antoni Gual - 07-10-2003, 11:48 PM
Re: Expression evaluator - by Mango - 07-11-2003, 12:29 AM
Expression evaluator - by toonski84 - 07-11-2003, 12:38 AM
Expression evaluator - by whitetiger0990 - 07-11-2003, 01:39 AM
Expression evaluator - by Moneo - 07-11-2003, 03:44 AM
Expression evaluator - by Nexinarus - 07-11-2003, 03:55 AM
Expression evaluator - by Moneo - 07-11-2003, 06:30 AM
Expression evaluator - by oracle - 07-11-2003, 07:09 AM
Expression evaluator - by Moneo - 07-11-2003, 09:02 AM
Expression evaluator - by na_th_an - 07-12-2003, 06:48 PM
Expression evaluator - by oracle - 07-14-2003, 03:37 AM
Expression evaluator - by Moneo - 07-14-2003, 04:18 AM
Expression evaluator - by Agamemnus - 07-14-2003, 05:06 AM
Expression evaluator - by Moneo - 07-14-2003, 05:22 AM
Expression evaluator - by na_th_an - 07-14-2003, 05:53 AM
Expression evaluator - by Moneo - 07-14-2003, 05:59 AM
huh? - by Agamemnus - 07-14-2003, 06:36 AM
Expression evaluator - by Moneo - 07-14-2003, 07:09 AM
Expression evaluator - by oracle - 07-14-2003, 07:12 AM
Expression evaluator - by Moneo - 07-14-2003, 07:35 AM
Expression evaluator - by relsoft - 07-14-2003, 10:30 AM
Expression evaluator - by Nexinarus - 07-14-2003, 04:12 PM
Expression evaluator - by na_th_an - 07-14-2003, 04:48 PM
Expression evaluator - by Agamemnus - 07-14-2003, 05:53 PM
Expression evaluator - by na_th_an - 07-14-2003, 06:55 PM
Expression evaluator - by Agamemnus - 07-14-2003, 08:26 PM
Expression evaluator - by na_th_an - 07-14-2003, 09:07 PM
Expression evaluator - by Agamemnus - 07-14-2003, 09:14 PM
Expression evaluator - by Moneo - 07-15-2003, 03:54 AM
Expression evaluator - by na_th_an - 07-15-2003, 04:37 AM
Expression evaluator - by Moneo - 07-15-2003, 06:06 AM
Expression evaluator - by Nexinarus - 07-16-2003, 03:34 AM
Expression evaluator - by Agamemnus - 07-16-2003, 04:03 AM
Expression evaluator - by na_th_an - 07-16-2003, 04:14 AM
Expression evaluator - by Nexinarus - 07-16-2003, 04:52 AM
Expression evaluator - by Agamemnus - 07-16-2003, 05:57 AM
Expression evaluator - by Nexinarus - 07-16-2003, 06:29 AM
Expression evaluator - by Moneo - 07-20-2003, 11:39 PM
Expression evaluator - by Nexinarus - 07-21-2003, 09:49 AM
Expression evaluator - by oracle - 07-21-2003, 09:51 AM
Expression evaluator - by Nexinarus - 07-21-2003, 10:00 AM
Expression evaluator - by Blitz - 07-22-2003, 07:38 AM
Expression evaluator - by Agamemnus - 07-22-2003, 07:12 PM
Expression evaluator - by Nexinarus - 07-23-2003, 09:40 AM
Expression evaluator - by na_th_an - 07-23-2003, 03:04 PM
Expression evaluator - by Agamemnus - 07-23-2003, 05:03 PM
Expression evaluator - by na_th_an - 07-23-2003, 05:16 PM
Expression evaluator - by Nexinarus - 07-24-2003, 12:41 AM
Expression evaluator - by Agamemnus - 07-24-2003, 12:57 AM
Expression evaluator - by Nexinarus - 07-24-2003, 09:46 AM
Expression evaluator - by toonski84 - 07-24-2003, 10:03 AM
Expression evaluator - by Nexinarus - 07-24-2003, 10:06 AM
Expression evaluator - by toonski84 - 07-24-2003, 10:14 AM
Expression evaluator - by Nexinarus - 07-24-2003, 02:16 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)