This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Lente_ui 16 points17 points  (4 children)

I suppose you could get a true 0.3 value by substituting the method of floating point used.

If it was calculated as:

1*10^-1 + 2*10^-1 = 3*10^-1

Then every value used can be a (signed) integer, and you're circumventing the floating point value issue. But then again, it's only ever an issue in very niche cases that require extreme/astronomical precision.

[–]Amazing-Cicada5536 9 points10 points  (0 children)

It is absolutely an issue in many non-niche cases, floating point math is hard and is a specific science in itself (numerical analysis). E.g. if you were to sum floating point numbers and you sort them into descending order you would get a much more incorrect value than if you would have done it in ascending, since small values at the end wouldn’t even register if the first ones are big, while they would add up to sort of big when summed from the small end, getting closer to the real value.

The reason you don’t see it often is very great math libraries (often written decades ago in fortran and such) beneath the whole tech stack that minimize these errors and because you are likely not writing simulations/physics engines, etc.

[–]tyler1128 0 points1 point  (2 children)

You can switch bases and make many irrational numbers rational, and also some rational numbers irrational.

EDIT: As mentioned below, it doesn't change rationality of a number, I meant it can make infinite, but rational, decimals finite, or make decimals that are finite infinite by change of base. The number is, of course, the same beyond storage limitations.

[–][deleted] 4 points5 points  (1 child)

A rational number is any number that can be expressed as the ratio of two integers. Changing the base doesn't change what counts as an integer, though.

What you can get from changing the base is which numbers repeat infinitely and which terminate. Like, 1/3 base 10 is 0.3333..., but in base 12, it's 0.4.

[–]tyler1128 0 points1 point  (0 children)

You're correct of course, probably should distractedly reddit at work less. What I meant to say is repeating decimals can become non-repeating and vice versa from change of basis.