Adding Decimals with BS2!!
bomber
Posts: 297
As most of you know, using decimals in regular math computation is almost an imposibility. I have contrived some code to add two decimal numbers together. There are some notes that are in the code. Please read the notes at the beginning of the program. They tell you how to use the program. There are a few bugs that will give you an INCORRECT ANWSER unless you follow the directions at the beginning of the code.
UPDATE!!! The constant "dec_digits" defines the number of digits in the decimal place. if the constant "dec_digits" is smaller then the actual number of digits, It will be incorrect. if dec_digits = 2 and the entered number is 1 digit long, it will read incorrectly! you MUST put it in the form of ".10" if dec_digits = 2.
UPDATE!!! The constant "dec_digits" defines the number of digits in the decimal place. if the constant "dec_digits" is smaller then the actual number of digits, It will be incorrect. if dec_digits = 2 and the entered number is 1 digit long, it will read incorrectly! you MUST put it in the form of ".10" if dec_digits = 2.
Comments
Nice article, however, I would suggest in the future to do some research as far as terminology used.
“Decimals” and floating point arithmetic performed are not identical.
Cheers
Vaclav