Real numbers are represented by Float (32-bit) and Double (64-bit). These are binary formats which only approximately represent the complete range of Real numbers. Real numbers include all the Rationals (countable infinite), and the Irrationals (uncountable infinite). Double can at best represent only a small, finite subset of the Rationals.
The IEEE-754 double precision floating point encoding uses 53-bit mantissa (52-bits explicitly stored), an 11-bit exponent, and 1-bit for sign. Read about IEEE Double precision floating point here.
The range of integers which can be exactly represented is +/- 2^53-1, while the exponent represents a range of 10^+/-308.
You cannot express an integer x exactly where |x| > 2^53.
You cannot express fractions exactly which are not of the form k/2^n, where k, n are integers (and k, n are within above limits). Thus, you cannot represent 1/3, 1/5, 1/7, 1/11, etc.
Any rational fraction where the denominator is relatively prime to 2 cannot be exactly represented. Any fraction k/P, where P is the product of primes other than 2, and k is not a multiple of P, cannot be exactly represented by IEEE-754 floating point.
The behavior you are observing is due to 1/5 being approximately represented, and the conversion from internal double/float representation to character representation performs rounding to some precision. All languages which use machine floating point (double/float) exhibit similar behavior, but the routines which convert from float to print may round these approximate numbers differently.
As a consequence of Cantor's proof that the Real numbers are uncountable and the Rational numbers are countable, almost all Real numbers are irrational.