RE: Floating point math is the devil!

avatar

You are viewing a single comment's thread:

In computers, we have floating point math and integer math.
It is interesting that no one has done fractional math yet.
It would be a very big advantage for certain problem types.

But i also remember the days when we had an entire separate chip to do math coprocessing.
and it was mostly just a processor with registers that held floating point numbers.

And your example is why i still like C and like typed values.

To many of the modern languages will just convert types on the fly, but i really hate that, i would wish a warning about changing types.



0
0
0.000
2 comments
avatar

One can do fractional math by recording the numerator and denominator separately. The problem is that the set of rational numbers is not closed over some math operations; So you have to avoid those operations. So, you really don't gain that much for all of the extra storage.

One can do fixed decimal math by remembering the location of the decimal place. I've worked on many systems that record every thing as pennies.

Of course there is a problem with every mathematical system we used because it is impossible to create a math system that is complete.

0
0
0.000
avatar

Yes, with a programmable computer, you can get it to do any kind of math... the hard way.

But think of things like Autocad. Having a 1/16 fractional system or a 1/12 fractional system would have made a lot of the math and number storage easy.

Instead you have 0.0625 and 0.41667 stored everywhere.

And, as you said, it can be imitated. And moving the decimal place to pennies, or ⅒ of pennies works well for those kinds of integers that deal with money.

0
0
0.000