IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Difference between Floating Point & Decimal Point


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
anu2
Warnings : 1

New User


Joined: 10 Jun 2007
Posts: 36
Location: Chennai

PostPosted: Fri Aug 24, 2007 3:25 pm
Reply with quote

Hi ,

Please let me know the difference between Floating Point & Decimal Point.


Regards,
anu
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 24, 2007 3:37 pm
Reply with quote

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
View user's profile Send private message
anu2
Warnings : 1

New User


Joined: 10 Jun 2007
Posts: 36
Location: Chennai

PostPosted: Fri Aug 24, 2007 5:12 pm
Reply with quote

In that case then what would be the difference between Floating Point and an integer. Please let me know.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Aug 24, 2007 5:19 pm
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 24, 2007 5:44 pm
Reply with quote

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 non-computer 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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 24, 2007 6:54 pm
Reply with quote

William,

Mean would have been:

Decimal Points are fixed; floating points aren't.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Aug 24, 2007 7:14 pm
Reply with quote

dbzTHEdinosauer wrote:
Mean would have been:

Decimal Points are fixed; floating points aren't.
icon_lol.gif better.... icon_lol.gif
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Fri Sep 28, 2007 2:52 pm
Reply with quote

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......... icon_lol.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri Sep 28, 2007 9:26 pm
Reply with quote

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
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Mon Oct 01, 2007 3:02 pm
Reply with quote

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........ icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Oct 02, 2007 5:40 am
Reply with quote

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: floating-point 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 single-precision 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


Floating-point arithmetic on digital computers is inherently inexact. The 24 bits (including the hidden bit) of mantissa in a 32-bit floating-point number represent approximately 7 significant decimal digits. Unlike the real number system, which is continuous, a floating-point 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 single-precision 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 floating-point 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 floating-point:


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
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Mon Oct 08, 2007 5:24 pm
Reply with quote

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..... icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Oct 09, 2007 6:27 am
Reply with quote

You're welcome icon_smile.gif

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Help required to reset decimal points... DFSORT/ICETOOL 3
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts Difference between joblib and steplib JCL & VSAM 2
No new posts Pull data using date difference betwe... DB2 6
No new posts small int to zoned decimal conversion DFSORT/ICETOOL 3
Search our Forums:

Back to Top