Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
Single and Double Precession Floting Point

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
rdr

New User


Joined: 26 May 2006
Posts: 23

PostPosted: Thu Nov 29, 2007 4:12 pm    Post subject: Single and Double Precession Floting Point
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
References
PostPosted: Thu Nov 29, 2007 4:12 pm    Post subject: Re: Single and Double Precession Floting Point Reply with quote

amajhi

New User


Joined: 21 Jul 2006
Posts: 15
Location: Pune

PostPosted: Thu Nov 29, 2007 5:11 pm    Post subject: Reply to: Single and Double Precession Floting Point
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

Senior Member


Joined: 20 Oct 2006
Posts: 1519
Location: germany

PostPosted: Thu Nov 29, 2007 6:01 pm    Post subject:
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

Senior Member


Joined: 27 Feb 2007
Posts: 548
Location: Mumbai,India

PostPosted: Thu Nov 29, 2007 6:46 pm    Post subject:
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

Global Moderator


Joined: 23 Nov 2006
Posts: 7993
Location: 221 B Baker St

PostPosted: Fri Nov 30, 2007 1:29 am    Post subject:
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: 17
Location: Delhi

PostPosted: Tue Apr 22, 2008 2:11 pm    Post subject: Query about double precision computation
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 SNG

Senior Member


Joined: 06 Sep 2007
Posts: 415
Location: India

PostPosted: Tue Apr 22, 2008 2:28 pm    Post subject:
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: 17
Location: Delhi

PostPosted: Tue Apr 22, 2008 2:55 pm    Post subject:
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: 17
Location: Delhi

PostPosted: Tue Apr 22, 2008 7:23 pm    Post subject:
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

Global Moderator


Joined: 23 Nov 2006
Posts: 7993
Location: 221 B Baker St

PostPosted: Tue Apr 22, 2008 7:31 pm    Post subject:
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1