Single-Precision Floating-Point Format
A Single-Precision Floating-Point Format is a computer number format that uses 32 bits to represent a wide dynamic range of numeric values by employing a floating radix point.
- Context:
- It can represent real numbers (floating-point values) using 32 bits within computer memory, allowing for a compact representation of wide-ranging values.
- It can (typically) encode a number in three parts: the sign bit, the exponent, and the fraction (or mantissa), which contributes to its ability to handle a vast range of values.
- It can offer a balance between the range of values and the precision of those values, making it suitable for many scientific and engineering applications where double precision is unnecessary.
- It can (often) be chosen over double-precision floating-point format for applications where memory space is a concern, as it occupies half the memory space.
- It can provide an exact representation for any integer value up to 224, beyond which point the representation can become approximate.
- ...
- Example(s):
- IEEE 754 standard.
- In programming languages like C, Java, and Python, the `float` keyword typically denotes a single-precision floating-point variable.
- ...
- Counter-Example(s):
- Floating-Point Format (bfloat16).
- Double-Precision Floating-Point Format, which uses 64 bits.
- Fixed-Point Arithmetic format, where the number of digits after the decimal point is fixed.
- See: Embedded Systems, Computer Number Format, 32 Bits, Computer Memory, Dynamic Range, Floating Point, Fixed-Point Arithmetic, Signedness, Integer, IEEE 754, IEEE 754-2008, Standardization.
References
2024
- (Wikipedia, 2024) ⇒ https://en.wikipedia.org/wiki/Single-precision_floating-point_format Retrieved:2024-3-27.
- Single-precision floating-point format (sometimes called FP32 or float32) is a computer number format, usually occupying 32 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.
A floating-point variable can represent a wider range of numbers than a fixed-point variable of the same bit width at the cost of precision. A signed 32-bit integer variable has a maximum value of 231 − 1 = 2,147,483,647, whereas an IEEE 754 32-bit base-2 floating-point variable has a maximum value of (2 − 2−23) × 2127 ≈ 3.4028235 × 1038. All integers with 7 or fewer decimal digits, and any 2n for a whole number −149 ≤ n ≤ 127, can be converted exactly into an IEEE 754 single-precision floating-point value.
In the IEEE 754-2008 standard, the 32-bit base-2 format is officially referred to as binary32; it was called single in IEEE 754-1985. IEEE 754 specifies additional floating-point types, such as 64-bit base-2 double precision and, more recently, base-10 representations.
One of the first programming languages to provide single- and double-precision floating-point data types was Fortran. Before the widespread adoption of IEEE 754-1985, the representation and properties of floating-point data types depended on the computer manufacturer and computer model, and upon decisions made by programming-language designers. E.g., GW-BASIC's single-precision data type was the 32-bit MBF floating-point format.
Single precision is termed REAL in Fortran, SINGLE-FLOAT in Common Lisp, float in C, C++, C#, Java, Float in Haskell and Swift, and Single in Object Pascal (Delphi), Visual Basic, and MATLAB. However, float in Python, Ruby, PHP, and OCaml and single in versions of Octave before 3.2 refer to double-precision numbers. In most implementations of PostScript, and some embedded systems, the only supported precision is single.
- Single-precision floating-point format (sometimes called FP32 or float32) is a computer number format, usually occupying 32 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.