View previous topic :: :: View next topic

Author 
Message 
anu2 Warnings : 1 New User
Joined: 10 Jun 2007 Posts: 36 Location: Chennai




Hi ,
Please let me know the difference between Floating Point & Decimal Point.
Regards,
anu 

Back to top 




dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6968 Location: porcelain throne




floating point is a numeric datatype.
decimal point is a notation to separate the integer portion of a number and the fractional portion of a number 

Back to top 


anu2 Warnings : 1 New User
Joined: 10 Jun 2007 Posts: 36 Location: Chennai




In that case then what would be the difference between Floating Point and an integer. Please let me know. 

Back to top 


William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3158 Location: Tucson AZ




dbzTHEdinosauer wrote: 
floating point is a numeric datatype.
decimal point is a notation to separate the integer portion of a number and the fractional portion of a number 
That's mean...
Anu, start by reading the section on Computational items in the Language Reference. 

Back to top 


dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6968 Location: porcelain throne




No, it was not meant to be mean. He asked what is the difference between an apple and a stove. both have to do with eating, but.....
floating point datatype (can be short, long and real long) stores the number as scientific notation. (you can google scientific notation). Floating Point is a container.
a decimal point is a attribute for numeric datatype containers.
e.g., integers do not have a decimal point attribute.
A noncomputer example is when speaking of dollars and cents; the decimal point separates the two. A decimal point, unique to base 10 arithmetic, separates the integer portion (whole numbers) and the number and the > 1 & > 0 portion (fractional numbers) of the quantity. 

Back to top 


dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6968 Location: porcelain throne




William,
Mean would have been:
Decimal Points are fixed; floating points aren't. 

Back to top 


William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3158 Location: Tucson AZ




dbzTHEdinosauer wrote: 
Mean would have been:
Decimal Points are fixed; floating points aren't. 
better.... 

Back to top 


vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 276 Location: Bang,iflex




It is the basic thing, u must studied in your graduation......let it be....
Floating point: the varaible which is declared as a floating point variable, then varaible is can allows integer numbers from 0 to 9 with all possible combination with decimal point. in other words can be called as Real number
Integer: the variable declared with integer will allows combination numerals from 0 t0 9 with all possible combination with out a decimal point
Floating point and decimal point both are same there is no distinctiion between them.......
Thanks
Vasanth......... 

Back to top 


dick scherrer
Site Director
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix




Hello Vasanth,
Quote: 
Floating point and decimal point both are same there is no distinctiion between them....... 
You might want to do a bit of research and then post back here why this is in error. . . .
Floating point arithmetic and decimal arithmetic are not the same. 

Back to top 


vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 276 Location: Bang,iflex




Hi Dick,
Me trying to explain here, if u find incorrect pls correct me.
* If the variable is represented in decimal point form, then varaible
will be declared with integer part and the expected decimal point and the
number of points after the decimal point also decided and if you use
this variable for manipulation and for displaying the answer in the output window.
The structure of the declaration is retained in the ouput answer too,
means the integer part as in declaration and the decimal point and the number of digits after the decimal point is retained..
*If the variable is declared with floating point, then, here also there will be expected decimal point but here the number of digits after the decimal point will float, means if u use this variable for manipulation and for displaying the answer, it will give you complete precission of the answer after the decimal point at the output window...
Regard's
Vasanth........ 

Back to top 


dick scherrer
Site Director
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix




Hi Vansanth,
Please check out the following and see if if helps clear things up.
Quote: 
At the heart of many strange results is one fundamental: floatingpoint on computers is usually base 2, whereas the external representation is base 10. We expect that 1/3 will not be exactly representable, but it seems intuitive that .01 would be. Not so! .01 in IEEE singleprecision format is exactly 10737418/1073741824 or approximately 0.009999999776482582. You might not even notice this difference until you see a bit of code like the following:
Code: 
REAL X
DATA X /.01/
IF ( X * 100.d0 .NE. 1.0 ) THEN
PRINT *, 'Many systems print this surprising result. '
ELSE
PRINT *, 'And some may print this.'
ENDIF 
Floatingpoint arithmetic on digital computers is inherently inexact. The 24 bits (including the hidden bit) of mantissa in a 32bit floatingpoint number represent approximately 7 significant decimal digits. Unlike the real number system, which is continuous, a floatingpoint system has gaps between each number. If a number is not exactly representable, then it must be approximated by one of the nearest representable values.
Because the same number of bits are used to represent all normalized numbers, the smaller the exponent, the greater the density of representable numbers. For example, there are approximately 8,388,607 singleprecision numbers between 1.0 and 2.0, while there are only about 8191 between 1023.0 and 1024.0.
On any computer, mathematically equivalent expressions can produce different values using floatingpoint arithmetic. In the following example, Z and Z1 will typically have different values because (1/Y) or 1/7 is not exactly representable in binary floatingpoint: 
If you'd like a lot more explanation/examples of how floating point arithmetic differs from decimal arithmetic, check out
http://www.lahey.com/float.htm 

Back to top 


vasanthkumarhb
Active User
Joined: 06 Sep 2007 Posts: 276 Location: Bang,iflex




Hi Dick,
I posted the same, wat is explained above by you, but helps me a lot.
Thank you for your valuable reply.
Regard's
vasanth..... 

Back to top 


dick scherrer
Site Director
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix




You're welcome
Your intent may have been the same, but your post does not say the exactly the same thing (in English).
That is a situation we have to consider often in these forums. 

Back to top 


