Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Real data type
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
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 set|countable]], computers cannot represent them exactly using a finite amount of information. Most often, a computer will use a [[rational number|rational]] approximation to a real number. ==Rational numbers== {{Main|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 [[Integer (computer science)|integers]]. For example 1/3, which can be calculated to any desired precision. Rational number are used, for example, in [[Interpress]] from [[Xerox Corporation]].<ref>{{cite book |last1=Sproull |first1=Robert F. |last2=Reid |first2=Brian K. |title=Introduction to Interpress |date=June 1983 |publisher=Xerox Corporation |page=19 |url=https://bitsavers.org/pdf/xerox/interpress/XSIG_038306_Introduction_to_Interpress_Jun1983.pdf |access-date=February 11, 2024}}</ref> ==Fixed-point numbers== {{Main|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 (2<sup>16</sup>), 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|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.<ref>{{cite web |title=IBM 32-bit Numbers |url=https://nssdc.gsfc.nasa.gov/nssdc/formats/IBM_32-Bit.html |website=NASA |access-date=February 11, 2024}}</ref> ==Decimal numbers== {{Main|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 754|IEEE Standard for Floating-Point Arithmetic]] ==References== {{Reflist}} {{data types}} {{DEFAULTSORT:Real Data Type}} [[Category:Data types]] [[Category:Computer arithmetic]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Data types
(
edit
)
Template:Main
(
edit
)
Template:Reflist
(
edit
)