3 ms·
Real numbers include rational numbers (numbers which can be represented as a fraction of two integers) and irrational numbers (numbers that can't be represented
by rob74 2mo ago
Real numbers include rational numbers (numbers which can be represented as a fraction of two integers) and irrational numbers (numbers that can't be represented as a fraction - the most famous one is probably π). Since irrational numbers have an infinite number of decimal places, they obviously can't be stored as a floating point value and also can't be written down exactly, no matter how many decimal places you use. "Arbitrary precision" constants might get you closer, but yes, you will never be able to store a "true" irrational number in a computer.
- kibwen 2mo ago> you will never be able to store a "true" irrational number in a computer. Joke's on you, in my programming language all numbers are written in phinary: https://en.wikipedia.org/wiki/Golden_ratio_base https://en.wikipedia.org/wiki/Golden_ratio_base
- afdbcreid 2mo agoIt must be interesting to program in it! But yes, you can absolutely represent irrational numbers (only a finite amount of them of course). You can even do it symbolically.
- mswphd 2mo agoit's worth mentioning the infinite number of decimal places isn't an issue. there is the formalism of computable numbers to get around this https://en.wikipedia.org/wiki/Computable_number https://en.wikipedia.org/wiki/Computable_number roughly represent each number as a turing machine, which on input i outputs the ith digit. it works fine (it's slower than floats, but that's a different concern). the issue is that the computable numbers are relatively small. in particular, there are countably many turing machines, so they're a countable subset (in fact subfield) of the reals. so in a precise sense they only make up a vanishingly small fraction of the real numbers. but they still capture many important mathematical constants, e.g. e and pi.