On 02/20/2011 09:43 PM, Walter Bright wrote:
Jonathan M Davis wrote:
It may be that you would still end up with situations where two values that
you would think would be the same aren't due to rounding error or whatnot.
However, with a fixed point value, you wouldn't have the problem where a
particular value could not be held in it even if it's within its range of
precision. As I understand it, there are a number of values which cannot be
held in a floating point and therefore end up being rounded up or down simply
because of how floating points work and not because there the precision isn't
high enough.

That happens with decimal representations, too, just with a different set of
numbers.

It's definitely true however, that using fractions would be much more
accurate for a lot of stuff. That wouldn't be particulary efficient though.
Still, if you're doing a lot of math that needs to be accurate, that may be
the way to go.

The set of irrational numbers cannot (by definition) be represented by a ratio.

For example, the square root of 2.

This is true, indeed. The difference with decimals and/or rationals is that the set of (exactly) representable numbers is the one of numbers that look like 'finite' to us, like 0.1 (which cannot be represented using binary floats, whatever the size). In addition, rationals allow carrying representations across computations without creating unnecessary rounding errors at each step. Is there any plan for them in D2 in the future? The question of irrationals exists, for sure, but it's not a trap since we cannot ignore/forget they are not representable. (same for infinite rationals like 1/3)

Denis
--
_________________
vita es estrany
spir.wikidot.com

Reply via email to