Some programing languages, notably Pascal, have a type of numbers called "real".

However, mathematically speaking, these types aren't real. For them to be "real", these types have to be able to represent any real number. Real numbers like 1/3 and irrationals, however, can't be represented in floating point. So why do some programing languages call these types "real"?

  • 4
    Real numbers were introduced as distinct from integer numbers. Both Algol and Fortran pre-date Pascal and use "real" to mean non-integers. Commented Jul 18, 2014 at 14:35
  • 4
    The int type doesn't really denote integers in most languages either. The use of unsigned int instead of nat or natural is a bit perplexing though.
    – Doval
    Commented Jul 18, 2014 at 14:39
  • 11
    Many languages also habe a type called "integer" which cannot represent all integers. Commented Jul 18, 2014 at 14:47
  • 1
    Calling them rational would lead to the expectation that exact rational arithmetic could be performed.
    – AakashM
    Commented Jul 18, 2014 at 15:04
  • 3
    I think you have the question backwards. At a time when most of the existing languages were using "real" to mean floating-point (as opposed to integer), C chose to use "float" instead of "real". Your question could just as easily, and more correctly IMHO, be stated as "Why does C (and its derivatives) use "float" instead of "real" to denote (machine-approximate, i.e., floating-point) real numbers?". Commented Jul 18, 2014 at 16:18

2 Answers 2


Short answer: because it is the default approximation of a real number the language in question provides.


All Pascal float values are actually real numbers. In C or C++ you also have -0, +/-inf and +/-NaN which are not real numbers, but practically most floats that you use are real numbers.

  • So what? Half of what you said is in my answer, the rest is irrelevant to the question Pascal, when it was invented, had no floating point numbers that were not real. Your reading is totally irrational. So try again, with some effort this time. After reading the question, maybe.
    – gnasher729
    Commented Aug 31, 2022 at 13:46
  • All rational numbers, floating point numbers and integers are real numbers. But it would be really confusing if Pascal called integer types "real" too.
    – Simon B
    Commented Sep 1, 2022 at 10:11
  • Simon B, and there are reasons not to put tomatoes into a fruit salad.
    – gnasher729
    Commented Sep 2, 2022 at 10:47
  • Maybe I'm being dense here, but isn't your point in the inverse direction OP asked? Well of course every 2-bin system float numbers are Real numbers, they can even be able to easily store non-Real numbers precisely. But, is the other way around true? Maybe for periodic numbers, 3-state can store precisely 1/3, but not for irrational numbers. And the plot twist: we don't need it, float = R under a convention, and that's ok, we just need many bits we need to a certain usable point, as @DocBrown pointed. We call all the time PI = 3.14, 3.1415. Commented Feb 1 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.