Re: Why float is called as 'float', not 'real'?



Louis Krupp wrote:

DirtyHarry wrote:

This sounds like a stupid question, but I became just curious
yesterday, and I looked up several textbooks on computer languages
including FORTRAN, C++, and IDL. However, no textbooks on computer
language mentioned this. So I am asking to you, gurus...

We call real numbers as real in mathematics, but we call them as
'floating point' in computer science, especially almost all computer
languages.

Is there any particular reason to call 'float' instead of 'real'?

Harry from South Korea


My guess is that "floating point" was used to distinguish the data representation from "fixed point." Note that COBOL provides decimal data with digits to the right and left of the decimal point, so fixed point isn't necessarily the same thing as "integer." In fact, I have seen code that represented non-integer data with a limited range by binary fixed point.

"Real" is used to mean "anything that's not necessarily integer," and non-integers are usually stored as floating point. (Floating point data stores both the exponent and what is sometimes called the mantissa. My apologies if you already knew that.)

The oldest computer languages I've used, FORTRAN and ALGOL, both use "real," but as Glen noted, that wasn't the case with primeval FORTRAN.

C's use of "float" is a more recent, and more accurate, description of the data type. As Gib noted, even with a countably infinite number of bits, computers couldn't come close to representing all of the reals. They could catch all of the rationals, though.

I would say that "REAL" is perfectly in keeping with Fortran's avoidance of specifying "low level details". The specific format used, floating point, can be considered just an implementation detail.


Louis


--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows it can't be done.

-- Henry Ford
.



Relevant Pages

  • Re: Why float is called as float, not real?
    ... However, no textbooks on computer ... The oldest computer languages I've used, FORTRAN and ALGOL, both use "real," but as Glen noted, that wasn't the case with primeval FORTRAN. ... As Gib noted, even with a countably infinite number of bits, computers couldn't come close to representing all of the reals. ...
    (comp.lang.fortran)
  • Re: Am I Crazy? V. simple math question.
    ... I have seen deliberate uses of overflow. ... floating point numbers "real". ... Fortran was for scientific and mathematical applications. ... There is no general way to represent the mathematical reals ...
    (comp.lang.java.programmer)
  • Re: Fibonacci series...please help!!!
    ... what kind of data types would i use to create those 'buckets'. ... CHARACTER and COMPLEX. ... For example, Fortran has COMPLEX. ... You can do calculations on REALs ...
    (comp.lang.fortran)
  • Re: help reading fortran generated binary data...
    ... >> Helmut Giese ... That would probably have been Arjen, Tcl's FORTRAN guru:) but he ... floating point values as raw binary data, so I am only guessing here. ... read them back in using programs compiled with the same compiler - ...
    (comp.lang.tcl)
  • Re: demonic numbers !
    ... are expressed in the vast majority of computer languages. ... intend to be using floating point numbers, ... a different float expression is like arguing that telephone and adding ...
    (comp.lang.lisp)