---
title: "COBOL – Single Precision and Double Precision Floating Point"
description: "The most confused COBOL data types question is on comp-1 and comp-2 data items. Explained in a clearly how these two are differ in COBOL. Perfectly good for project and interviews. Explained with examples for single and double precision."
url: https://srinimf.com/2014/02/05/cobol-single-double-floating-point/
date: 2014-02-05
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2014/02/pexels-photo-4202344.jpeg?fit=1880%2C1253&ssl=1
categories: ["Categories", "COBOL"]
tags: ["COBOL Tips and Tricks"]
type: post
lang: en
---

# COBOL – Single Precision and Double Precision Floating Point

COBOL developers face difficulty to answer this question. The answer is for single precision data stored in 32 bits, and for double precision data stored in 64 bits of computer memory. Checkout here [What is the difference between a 32-bit and 64-bit system?](https://techterms.com/help/difference_between_32-bit_and_64-bit_systems#:~:text=One%20bit%20in%20the%20register,temporary%20values%20besides%20memory%20addresses.)

---

## **What is comp-1**

Comp-1 is also called a single-precision floating-point number. Picture clause is not required.

Related[How to Use DIGITS function to get Digits from Decimal Column Value](https://srinimf.com/2017/07/19/db2-digitis-function-example/)

**Single-precision floating-point format** is a computer number format that occupies 4 bytes (32 bits) in computer memory and represents a wide dynamic range of values by using a floating-point. Checkout [Single-precision floating-point format](https://en.wikipedia.org/wiki/Single-precision_floating-point_format).

Related[COBOL Tough Questions (2 of 3)](https://srinimf.com/2012/01/08/cobol-tough-questions-2-of-3/)

Comp-1 items are 4 bytes long. Internally data is stored in hexadecimal format.

Example:

01 floattmp USAGE COMP-1

In IEEE 754-2008 the 32-bit base 2 format is officially referred to as **binary32**. It was called **single** in IEEE 754-1985. In older computers, other floating-point formats of 4 bytes were used.

## **What is comp-2**

Comp-2 is also called double-precision floating-point number. Picture clause is not required.

**Double-precision floating-point format** is a computer number format that occupies 8 bytes (64 bits) in computer memory and represents a wide dynamic range of values by using floating-point. Checkout [Double-precision floating-point format](https://en.wikipedia.org/wiki/Double-precision_floating-point_format).

Related[Valuable Quotes Even not Teach in Harvard](https://srinimf.com/2017/07/18/valuable-quotes-these-even-you-will-not-get-from-harvard/)

So comp-2 items are 8 bytes long. Internally data is stored in hexadecimal format.
Example:

01 floattmp2 USAGE COMP-2;

Related[SQL ‘Aggregate’ Vs ‘DISTINCT’](https://srinimf.com/2015/10/11/db2-aggregate-function-tricky-questions/)

Computers with 32-bit storage locations use two memory locations to store a 64-bit double-precision number (a single storage location can hold a single-precision number).

Related[10 Killer Tips to Write PLI program Easily](https://srinimf.com/2016/03/09/10-killer-tips-to-write-zos-pli-program/)

Double-precision floating-point format usually refers to **binary64**, as specified by the IEEE 754 standard, not to the 64-bit decimal format **decimal64**.

Related Posts

- ![](https://dotcompatterns.files.wordpress.com/2020/04/sharon-mccutcheon-wx3joq0xbh4-unsplash-1.jpg?w=682)
- ![](https://dotcompatterns.files.wordpress.com/2020/04/michael-mims-isczhsdwk1m-unsplash-1.jpg?w=750)
- ![](https://dotcompatterns.files.wordpress.com/2020/04/ashton-bingham-sahbl2upxco-unsplash-1.jpg?w=750)
- ![](https://dotcompatterns.files.wordpress.com/2020/04/baby-natur-hld-gd-wn7k-unsplash-1.jpg?w=750)

### Outstanding learning resources

Learn any hobby with a little amount.

[Learn more](https://bit.ly/2PiYjNF)

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2014%2F02%2F05%2Fcobol-single-double-floating-point%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2014%2F02%2Fpexels-photo-4202344.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=COBOL%20-%20Single%20Precision%20and%20Double%20Precision%20Floating%20Point)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2014/02/05/cobol-single-double-floating-point/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2014/02/05/cobol-single-double-floating-point/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2014/02/05/cobol-single-double-floating-point/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2014/02/05/cobol-single-double-floating-point/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20COBOL%20-%20Single%20Precision%20and%20Double%20Precision%20Floating%20Point&body=https%3A%2F%2Fsrinimf.com%2F2014%2F02%2F05%2Fcobol-single-double-floating-point%2F&share=email)
-

### Like this:

Like Loading…
