473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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

Good day everyone. This sounds like a stupid question, but I became
just curious yesterday, and I looked up several textbooks. However, no
textbooks on computer language (that I have ) mentioned this. So I am
asking to you, gurus...

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

Mar 24 '07 #1
16 10784
On Mar 24, 12:13 am, "DirtyHarry" <kim20...@gmail.comwrote:
Good day everyone. This sounds like a stupid question, but I became
just curious yesterday, and I looked up several textbooks. However, no
textbooks on computer language (that I have ) mentioned this. So I am
asking to you, gurus...

Is there any particular reason to call 'float' instead of 'real'?
What you call 'double' - real32?

I'm certainly not well versed in the history of the languages ( I
suspect this dates back to C ) nonetheless, Fortran is the only
language I've encountered that used REAL. Granted, rational,
irrational etc - numbers are approximations of real arithmetic, I
suspect machine precision limitations plays an important role. Beyond
that I'm unsure what the impetus is.

Mar 24 '07 #2
DirtyHarry wrote:
Good day everyone. This sounds like a stupid question, but I became
just curious yesterday, and I looked up several textbooks. However, no
textbooks on computer language (that I have ) mentioned this. So I am
asking to you, gurus...

Is there any particular reason to call 'float' instead of 'real'?
float stands for "floating point" as opposed to "fixed point". It is a
more accurate description than "real" since not all real numbers are
representable by a floating point number.
Mar 24 '07 #3
"DirtyHarry" <ki******@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
Good day everyone. This sounds like a stupid question, but I became
just curious yesterday, and I looked up several textbooks. However, no
textbooks on computer language (that I have ) mentioned this. So I am
asking to you, gurus...

Is there any particular reason to call 'float' instead of 'real'?
So if we call a float a real, does that mean we have to call an int a fake?
float is more descriptive I believe.
Mar 24 '07 #4
DirtyHarry wrote:
Is there any particular reason to call 'float' instead of 'real'?
Because a 'float' is not a real number, but a floating point number.
There's a big difference.
Mar 24 '07 #5
Dnia Fri, 23 Mar 2007 21:49:04 -0700, ma740988 napisa³(a):
Fortran is the only language I've encountered that used REAL.
Pascal used it too ;)
And it's probably the language used formerly by OP, causing
his confusion upon encountering 'float' ;J

--
SasQ
Mar 24 '07 #6
Jim Langston wrote:
"DirtyHarry" <ki******@gmail.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
>Good day everyone. This sounds like a stupid question, but I became
just curious yesterday, and I looked up several textbooks. However, no
textbooks on computer language (that I have ) mentioned this. So I am
asking to you, gurus...

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

So if we call a float a real, does that mean we have to call an int a
fake?
I guess the OP is talking about the mathematical term as in "real number",
not the opposite of "fake".
float is more descriptive I believe.
Agreed.

Mar 24 '07 #7
DirtyHarry wrote:
Good day everyone. This sounds like a stupid question, but I became
just curious yesterday, and I looked up several textbooks. However, no
textbooks on computer language (that I have ) mentioned this. So I am
asking to you, gurus...

Is there any particular reason to call 'float' instead of 'real'?
Counter question: Is there any particular reason to call it 'real' instead
of 'float'?

Mar 24 '07 #8
DirtyHarry wrote:
Good day everyone. This sounds like a stupid question, but I became
just curious yesterday, and I looked up several textbooks. However, no
textbooks on computer language (that I have ) mentioned this. So I am
asking to you, gurus...

Is there any particular reason to call 'float' instead of 'real'?
float is short for "floating-point." double is short for
double-precision floating point.

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)
Mar 24 '07 #9
On Mar 24, 8:43 am, Rolf Magnus <ramag...@t-online.dewrote:
Counter question: Is there any particular reason to call it 'real' instead
of 'float'?
I suspect the OP's thought process reflects what I - perhaps all of us
- was taught in a mathematical sense. In that regard, I'd talk in
terms of integers, real numbers and complex numbers. These are terms
everyone understands including C / C++ programmers. I had a similar
question hen I first encountered 'floats and double'. I'd like to
believe Real32 and Real64 would suffice, but considering C/C++ has
been around for sometime, you chalk it up to 'it is what it is' and
move on.

In the end, the OP could always - worse case - typedef the float/
double to what he/she considers a more meaningful description. That's
the beauty of the language.

Mar 24 '07 #10
Gianni Mariani ha scritto:

It is a
more accurate description than "real" since not all real numbers are
representable by a floating point number.
neither are all the integers by int...
Mar 24 '07 #11
Giff wrote:
Gianni Mariani ha scritto:

It is a
>more accurate description than "real" since not all real numbers are
representable by a floating point number.

neither are all the integers by int...
All integers from INT_MIN to INT_MAX are. For 'float' that is not so.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Mar 24 '07 #12
On Mar 24, 8:58 am, "ma740988" <ma740...@gmail.comwrote:
On Mar 24, 8:43 am, Rolf Magnus <ramag...@t-online.dewrote:
Counter question: Is there any particular reason to call it 'real' instead
of 'float'?

I suspect the OP's thought process reflects what I - perhaps all of us
- was taught in a mathematical sense. In that regard, I'd talk in
terms of integers, real numbers and complex numbers. These are terms
everyone understands including C / C++ programmers. I had a similar
question hen I first encountered 'floats and double'. I'd like to
believe Real32 and Real64 would suffice, but considering C/C++ has
been around for sometime, you chalk it up to 'it is what it is' and
move on.
A "real" type would have to be able to represent irrational numbers -
which floating point numbers cannot represent, since all floating
point numbers (except for infinity) are rational.
In the end, the OP could always - worse case - typedef the float/
double to what he/she considers a more meaningful description. That's
the beauty of the language.
Defining a "real" typedef for float is not going to change the types
of numbers that a float can represent. So the typedef would not change
the fact that a float does not represent real numbers, but the "real"
name could mislead anyone who sees it - into believing that it does.

Greg

Mar 25 '07 #13
* Greg Herlihy:
On Mar 24, 8:58 am, "ma740988" <ma740...@gmail.comwrote:
>On Mar 24, 8:43 am, Rolf Magnus <ramag...@t-online.dewrote:
>>Counter question: Is there any particular reason to call it 'real' instead
of 'float'?
I suspect the OP's thought process reflects what I - perhaps all of us
- was taught in a mathematical sense. In that regard, I'd talk in
terms of integers, real numbers and complex numbers. These are terms
everyone understands including C / C++ programmers. I had a similar
question hen I first encountered 'floats and double'. I'd like to
believe Real32 and Real64 would suffice, but considering C/C++ has
been around for sometime, you chalk it up to 'it is what it is' and
move on.

A "real" type would have to be able to represent irrational numbers -
which floating point numbers cannot represent, since all floating
point numbers (except for infinity) are rational.
>In the end, the OP could always - worse case - typedef the float/
double to what he/she considers a more meaningful description. That's
the beauty of the language.

Defining a "real" typedef for float is not going to change the types
of numbers that a float can represent. So the typedef would not change
the fact that a float does not represent real numbers, but the "real"
name could mislead anyone who sees it - into believing that it does.
Well. 'int' is rather misleading too. Come to think of it, is there
any type name in a programming language that isn't misleading, when one
thinks of it with mathematical-inspired expectations?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Mar 25 '07 #14
"DirtyHarry" worte:
Good day everyone. This sounds like a stupid question, but I became
just curious yesterday, and I looked up several textbooks. However, no
textbooks on computer language (that I have ) mentioned this. So I am
asking to you, gurus...

Is there any particular reason to call 'float' instead of 'real'?
My guess is that it originated with the hardware designers. It seemed
descriptive so others that came along just adopted it.
My theory seems to be supported by this link.

http://www.oars.utk.edu/math_archive...pr99/0144.html
Mar 25 '07 #15
Thanks, everyone... Finally I got out of clouds...
Mar 27 '07 #16
Dnia Fri, 23 Mar 2007 21:59:12 -0700, Jim Langston napisa³(a):
So if we call a float a real, does that mean we have to
call an int a fake?
unreal :>

--
SasQ
Mar 28 '07 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Marcus | last post by:
I have a column in a MySQL database called price and of type FLOAT(8,2). I then insert two rows into my table, one where price = 100.00 and one where price = 100.01, and then try to find these...
5
by: Peter Scheurer | last post by:
Hi, we found some strange behavior when operating with floats and round(). The following simplified statement reproduces the problem. select 6.56 - round(convert(float, 6.56), 2) from...
3
by: Mark | last post by:
What are the best .NET datatypes to handle SQL Server's Float and Real datatypes? I'd like to avoid using the SQL Server specific datatypes like SqlInt32 or similar. Thanks in advance. -Mark
8
by: bearophileHUGS | last post by:
sys.maxint gives the largest positive integer supported by Python's regular integer type. But maybe such attribute, with few others (they can be called min and max) can be given to int type itself....
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
23
by: JDT | last post by:
Hi, It seems that using floats as the first tupelo for an STL map (shown below) can cause problems but I don't remember what the problems were. Is it common practice to use a structure like...
6
by: Toe001 | last post by:
In a program for use with a micro, I have a variable of type float (real number) and wish to save it to EEPROM. I have a routine which writes a byte at a time to EEPROM at the location (address) I...
8
by: d major | last post by:
I was very puzzled about the conversion between float and long, I cann't understand why a long val can convert to a float, as the below codes show: typedef unsigned long u_long; float val =...
22
by: Bill Reid | last post by:
I just noticed that my "improved" version of sscanf() doesn't assign floating point numbers properly if the variable assigned to is declared as a "float" rather than a "double". (This never...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.