A simple program turned into one of my most sophisticated endeavors. A simple program that reads input (a floating point number) from the user and counts the number of digits after the decimal point. The algorithm, essentially, involves multiplication by 10, and truncation of the fractional portion of the float. The algorithm seemed handy till I input the value 123.568987
The program outputs the number of digits after decimal point to be 5 since 12356898.7 is rounded up to 12356899. Is there anyway I can avoid the round-off. I am using assembly.
Geez it seems as if the rounding is dependent on the architecture you are working with, it will vary with different systems. since you dont need teh values on the left side of the decimal, did you try subracting 123 before doing your multiplication ?