View previous topic :: View next topic
|
Author |
Message |
rdr
New User
Joined: 26 May 2006 Posts: 35 Location: india
|
|
|
|
What is this single and doubble precession floting point?
What is the difference between them, can any one explain explain it with some example?? |
|
Back to top |
|
|
amajhi
New User
Joined: 21 Jul 2006 Posts: 18 Location: Pune
|
|
|
|
When you declare variable as
01 ws-var1 pic 9.99.
It is called single percision floating point.
and when it is declared as
01 ws-var1 pic 9v99.
It is called double precision floating point.
Difference is single precision floating point will take 1 byte extra in comparision double precision floating point.
Guys correct me if there is misunderstanding. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
01 ws-var1 pic 9.99 is an edit mask
and
01 ws-var1 pic 9v99. usage is display.
you have to use one of the usage comp-? to indicate single and double percision floating point. I don't use them in banking and insurance so you guys will have to go to the manual. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
Guys correct me if there is misunderstanding. |
Yes, there is complete misunderstanding.
rdr is asking about COMP-1 and COMP-2. I would suggest rdr to read manual for knowing more about them. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Amajhi,
Where did you come to your understanding of floating point?
I suggest you discontinue using that source of information as it is completely in error. |
|
Back to top |
|
|
Deepakgoyal2005
New User
Joined: 22 Mar 2007 Posts: 57 Location: India
|
|
|
|
How will you identify if a COBOL program is having double precision computation or not ? |
|
Back to top |
|
|
Gnanas N
Active Member
Joined: 06 Sep 2007 Posts: 792 Location: Chennai, India
|
|
|
|
From manual,
Code: |
COMPUTATIONAL-1 or COMP-1 (floating-point)
Specified for internal floating-point items (single
precision). COMP-1 items are 4 bytes long.
COMPUTATIONAL-2 or COMP-2 (long floating-point)
Specified for internal floating-point items (double precision).
COMP-2 items are 8 bytes long. |
|
|
Back to top |
|
|
Deepakgoyal2005
New User
Joined: 22 Mar 2007 Posts: 57 Location: India
|
|
|
|
Thanks for the response...
but i want to know that if there do not exist any such field(COMP 1 or 2) in the Cobol Code and i want to know whether these can be used in the code then how can i? |
|
Back to top |
|
|
Deepakgoyal2005
New User
Joined: 22 Mar 2007 Posts: 57 Location: India
|
|
|
|
Is there any internal routine in COBOL to convert COMP-2 variables before processing specially when the lenth of the defined varaible is greater than 15. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Is there any internal routine in COBOL to convert COMP-2 variables |
What would you want to convert them to? Keep in mind that floating point is little used in cobol as floating point is typically not used for mainframe business (checkbook/accounting/inventory) applications.
I suggest you spend some time in the COBOL documentation (available via the "IBM Manuals" link at the top of the web page. There are both Language Reference and Programmers Guides available for multiple versions of cobol.
When you find something in the documentation that is not clear, post it here and your question concerning what you found. Someone should be able to help clarify for you. |
|
Back to top |
|
|
|