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

Single and Double Precession Floting Point


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rdr

New User


Joined: 26 May 2006
Posts: 35
Location: india

PostPosted: Thu Nov 29, 2007 4:12 pm
Reply with quote

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

New User


Joined: 21 Jul 2006
Posts: 18
Location: Pune

PostPosted: Thu Nov 29, 2007 5:11 pm
Reply with quote

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

Global Moderator


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

PostPosted: Thu Nov 29, 2007 6:01 pm
Reply with quote

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

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu Nov 29, 2007 6:46 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Fri Nov 30, 2007 1:29 am
Reply with quote

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

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Tue Apr 22, 2008 2:11 pm
Reply with quote

How will you identify if a COBOL program is having double precision computation or not ?
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 792
Location: Chennai, India

PostPosted: Tue Apr 22, 2008 2:28 pm
Reply with quote

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

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Tue Apr 22, 2008 2:55 pm
Reply with quote

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

New User


Joined: 22 Mar 2007
Posts: 57
Location: India

PostPosted: Tue Apr 22, 2008 7:23 pm
Reply with quote

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

Moderator Emeritus


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

PostPosted: Tue Apr 22, 2008 7:31 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Point and Shoot )PTNS TSO/ISPF 0
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Help in extracting data between doubl... DFSORT/ICETOOL 5
No new posts Submit multiple jobs from a library t... JCL & VSAM 14
No new posts Convert single row multi cols to sing... DFSORT/ICETOOL 6
Search our Forums:

Back to Top