Real data type

A real data type is a data type used in a computer program to represent an approximation of a real number. Because the real numbers are not countable, computers cannot represent them exactly using a finite amount of information. Most often, a computer will use a rational approximation to a real number.

## Contents

* 1 Rational numbers
* 2 Fixed-point numbers
* 3 Floating-point numbers
* 4 Decimal numbers
* 5 See also
* 6 References

## Rational numbers

Main article: Rational data type

The most general data type for a rational number (a number that can be expressed as a fraction) stores the numerator and the denominator as integers. For example 1/3, which can be calculated to any desired precision. Rational number are used, for example, in Interpress from Xerox Corporation.[1]

## Fixed-point numbers

Main article: Fixed-point arithmetic

A fixed-point data type uses the same, implied, denominator for all numbers. The denominator is usually a power of two. For example, in a hypothetical fixed-point system that uses the denominator 65,536 (216), the hexadecimal number 0x12345678 (0x1234.5678 with sixteen fractional bits to the right of the assumed radix point) means 0x12345678/65536 or 305419896/65536, 4660 + the fractional value 22136/65536, or about 4660.33777. An integer is a fixed-point number with a fractional part of zero.

## Floating-point numbers

Main article: Floating-point arithmetic

A floating-point data type is a compromise between the flexibility of a general rational number data type and the speed of fixed-point arithmetic. It uses some of the bits in the data type to specify an exponent for the denominator, today usually power of two although both ten and sixteen have been used.[2]

## Decimal numbers

Main article: Decimal data type

The decimal type is similar to fixed-point or floating-point data type, but with a denominator that is a power of 10 instead of a power of 2.

## See also

* Binary number
* Decimal number
* Hexadecimal number
* IEEE Standard for Floating-Point Arithmetic

## References

1. ↑ Sproull, Robert F.; Reid, Brian K. (June 1983). Introduction to Interpress. Xerox Corporation. p. 19. https://bitsavers.org/pdf/xerox/interpress/XSIG_038306_Introduction_to_Interpress_Jun1983.pdf. Retrieved February 11, 2024.
2. ↑ "IBM 32-bit Numbers". https://nssdc.gsfc.nasa.gov/nssdc/formats/IBM_32-Bit.html.

* v
* t
* e

Data types

Uninterpreted|

* Bit
* Byte
* Trit
* Tryte
* Word
* Bit array

Numeric|

* Arbitrary-precision or bignum
* Complex
* Decimal
* Fixed point
* Floating point
* Double precision
* Extended precision
* Long double
* Octuple precision
* Quadruple precision
* Single precision
* Reduced precision
* Minifloat
* Half precision
* bfloat16
* Integer
* signedness
* Interval
* Rational

Pointer|

* Address
* physical
* virtual
* Reference

Text|

* Character
* String
* null-terminated

Composite|

* Algebraic data type
* generalized
* Array
* Associative array
* Class
* Dependent
* Equality
* Inductive
* Intersection
* List
* Object
* metaobject
* Option type
* Product
* Record or Struct
* Refinement
* Set
* Union
* tagged

Other|

* Boolean
* Bottom type
* Collection
* Enumerated type
* Exception
* Function type
* Opaque data type
* Recursive data type
* Semaphore
* Stream
* Top type
* Type class
* Unit type
* Void

Related
topics|

* Abstract data type
* Data structure
* Generic
* Kind
* metaclass
* Parametric polymorphism
* Primitive data type
* Protocol
* interface
* Subtyping
* Type constructor
* Type conversion
* Type system
* Type theory

See also platform-dependent and independent units of information

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Real data type. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Real_data_type&oldid=3982263"
*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template