Comment How about building a real number object? (Score 1) 456
Since we all know that computers work in discreet values and thus create approximations of select real numbers, why not take advantage of this and create a real number class? Yes, there would be a lot of overloads on the operators and perhaps we have to update the math.h library, but still, this seems to be the most accurate way. Only at display time, or printing does it need to perform some kind of binary conversion so it can be used with some given api, but at least the errors don't get drastically worse with many subsequent computations going against a float. This could be particularly useful in a financial institution where your inputs are gauranteed to be only fractions of 100th (at worse I am assuming).
For example, we can implement a class that has two ints such as int numerator, int denominator... and from there we have to overload the operators and maybe create some kind of conversive function as well input/output functions. Well, what do you think?
Here is an example... suppose that you have to deposit 33 cents... you would convert and store this into to the realnum obj as 33 num 100 denom. From there I think you can have pretty darn accurate calculations. Oh btw, make sure the user input was loaded as a string and have that parsed into the real num object.
Just a thought. I might be wrong though