Re: Why float is called as 'float', not 'real'?
- From: Gary Scott <garylscott@xxxxxxxxxxxxx>
- Date: Sat, 24 Mar 2007 11:38:15 -0500
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
.
- Follow-Ups:
- Re: Why float is called as 'float', not 'real'?
- From: Richard Maine
- Re: Why float is called as 'float', not 'real'?
- References:
- Why float is called as 'float', not 'real'?
- From: DirtyHarry
- Re: Why float is called as 'float', not 'real'?
- From: Louis Krupp
- Why float is called as 'float', not 'real'?
- Prev by Date: ffnet 0.6 - neural networks and fortran
- Next by Date: Re: Why float is called as 'float', not 'real'?
- Previous by thread: Re: Why float is called as 'float', not 'real'?
- Next by thread: Re: Why float is called as 'float', not 'real'?
- Index(es):
Relevant Pages
|