MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Difference between Decimal and Floating

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
ChandraKota
Beginner


Joined: 03 Aug 2006
Posts: 2
Topics: 1

PostPosted: Thu Aug 03, 2006 12:21 am    Post subject: Difference between Decimal and Floating Reply with quote

Hi All,

From many days, a question is drilling my mind. What is the difference between a Floating point number and a decimal number.. Is it the only representation it differs or also the way the numbers are stored internally matters. I know Single Point floating number is a 32 bit representation of a real number. But on a 32 bit machine or 64 bit machine how does it really matters. I'm not sure whether I'm confusing myself here.
_________________
Thanks & Regards
KRC
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Aug 03, 2006 5:41 am    Post subject: Reply with quote

ChandraKota,

Check this link and go through all the links:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.3?DT=20020923143836
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12382
Topics: 75
Location: San Jose

PostPosted: Thu Aug 03, 2006 7:59 am    Post subject: Reply with quote

ChandraKota,

If you are talking about DB2 float and deciaml then here is an explanation to the equivalent cobol formats.

Code:

REAL or FLOAT(n)         =   COMP-1
1<=n<=21
     
DOUBLE PRECISION,        =   COMP-2
or FLOAT(n) 22<=n<=53

DECIMAL(i+d,d)           =   COMP-3(Packed decimal)



COMP-1 refers to short floating-point format and COMP-2 refers to long floating-point format, which occupy 4 and 8 bytes of storage, respectively. The leftmost bit contains the sign and the next 7 bits contain the exponent; the remaining 3 or 7 bytes contain the mantissa. COMP-1 and COMP-2 data items are stored in z900 hexadecimal format.

COMP-3(Packed-decimal) items occupy 1 byte of storage for every two decimal digits you code in the PICTURE description, except that the rightmost byte contains only one digit and the sign. This format is most efficient when you code an odd number of digits in the PICTURE description, so that the leftmost byte is fully used. Packed-decimal items are handled as fixed-point numbers for arithmetic purposes.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ChandraKota
Beginner


Joined: 03 Aug 2006
Posts: 2
Topics: 1

PostPosted: Fri Aug 04, 2006 7:58 pm    Post subject: Reply with quote

Thanks Kolusu, your reply is really impressive. So its all about the way, the data is stored .
_________________
Thanks & Regards
KRC
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group