5 ms·
X could be .999... .9 repeating is a numerical number that technically does not equal itself, although I'm sure most compilers would round the number to 1; so
by CastItUp 16y ago
X could be .999...
.9 repeating is a numerical number that technically does not equal itself, although I'm sure most compilers would round the number to 1; so I'm not sure if it's what your looking for. But as for a boolean, or an integer that would fit that solution, I cant think of any time that it could occur.
x = .999...
10x = 9.999...
10x-x = 9.999... - .999...
9x = 9
x = 1
.999... != 1
- mooism2 16y ago0.9 recurring equals itself. You prove above that 0.9 recurring equals 1 (the final step does not follow from what you write before), not that 0.9 recurring does not equal itself.
- bartonfink 16y agoGiven how floating point works, I'm not sure that the floating point representation closest to 1 would ever round to 1 (which is neatly representable). That proof works because you're working with real numbers, which have no encoding restrictions.
- CastItUp 16y agoI think you are on the right track of where I am getting... Before running through all the code, x = .9999999, but at the end of all the operations, x = 1, so; if placed in a "for loop", with a condition outside of the loop, its possible that the compiler would return "false" for x = x.
- bmm6o 16y agoThe equality relation on the reals obeys reflexivity (as well as transitivity, etc). You're barking up the wrong tree. For a mathematical example, you'll need something much more exotic than R.