IEEE 754 standard
Standard for floating-point computation established in 1985 by the Institute of Electrical and Electronics Engineers (IEEE). Exercises and theory. Links: overflow, underflow, special cases, wikipedia single precision
15 flashcards · Computer Science · by lakesare
Find positive and negative underflow of IEEE 754.
positive underflow: from 0 to 1.0 * 2-127 negative underflow: from - 1.0 * 2-127 to 0 Basically we got to find the closest number to 0 that can be represented by: • 1 bit: sign • 8 bits: exponent in excess-127 • 23 bits: significand, with implicit 1. in front of it Note this doesn't consider denormal values.
What's considered a normalized form of a number in IEEE 754?
Just like in scientific notation, number is normalized when radix point is put after the first nonzero digit, e.g.: 1.001011.
Represent 5.75 in IEEE 754 single precision format.
first bit: 0 because 5.75 is positive normalizing significand: 5.75 = 101.112 = 1.01112 * 22 now let's express exponent (2) in 8-bit excess-127 notation: 2 + 127 = 129 = 100000012 and significand as 23 bits without first 1.: 0111000000000000 0 10000001 0111000000000000
Find positive and negative overflow of IEEE 754. Calculator: rapidtables
1.99999988079071044922...*2127 (1.9999... is just 1.1111111111111111...23 bits in binary, and 127 comes from 111111102 - 127 = 254 - 127 = 127) Why is the maximum exponent 11111110 instead of 11111111?NaN's are represented by a bit pattern with an exponent of all 1s and a non-zero fraction. Therefore 11111111 is reserved. Basically we got to find the biggest number that can be represented by: • 1 bit: sign • 8 bits: exponent in excess-127 • 23 bits: significand, with implicit 1. in front of it
What 2 floating-point types does IEEE 745 specify?
single-precision (32-bit format, binary32) double-precision (64-bit format, binary62) IEEE 754 specifies additional floating-point formats, e.g. base-10 representations.
What notation is chosen for representing exponent in IEEE 754? Why?
Excess-127. We need to be able to represent a signed number, so we're left with: 2's complement excess notation A very frequent operation in calculating floating point numbers is comparing exponents. This is much faster in excess notation, so it's chosen.
What's the default rounding mode for IEEE 754? Why?
Round to the nearest; ties to even. in order to avoid a bias that may accumulate if we're rounding to +infinity all the time e.g.. Links: youtube video explaining rounding modes
Using following wording, describe IEEE 754 single precision format.
• 1 bit: sign • 8 bits: exponent in excess-127 • 23 bits: significand, with implicit 1. in front of it
Floating point number presented in IEEE single precision (32 bits) is 01101011101101010000000000000000. Find this number in decimal. Here is a link for converting binary to decimal: rapidtables.com.
0 11010111 01101010000000000000000 First bit is a sign, and it's 0, therefore sign is positive. Next 8 bits is an exponent in excess-127. To find a number in excess-127 notation, we would: add 127 to number convert it to binary Reversing these steps, we get 11010111 as 215 in decimal, and 215 - 127 = 88. Exponent is 288. Remaining bits signify a significand, with implicit 1. preceding it. 1.01101010000000000000000 = 1.414062510. Final answer: 1.4140625 * 288 Links: example 1 and explanation
What 4 sections floating-point numbers can't represent?
negative/positive overflow negative/positive underflow
Name 5 rounding modes defined in IEEE 754.
Roundings to nearest Round to nearest, ties to even – rounds to the nearest value; if the number falls midway it is rounded to the nearest value with an even (zero) least significant bit. Round to nearest, ties away from zero – rounds to the nearest value; if the number falls midway it is rounded to the nearest value above (for positive numbers) or below (for negative numbers); this is intended as an option for decimal floating point. Directed roundings Round toward 0 – directed rounding toward…
What's a normalized VS denormalized number?
normalized: numbers that can be represented without leading zeros in its significand. denormalized: numbers filling the underflow gap around zero in floating-point arithmetic.
How do we express subnormal numbers?
If all the bits of exponent are 0, it's a denormalized form. (-1)sign * 0.significand * 21-127. Links: youtube video on denormalized form
Name 5 steps to convert decimal number to IEEE 754 floating point number.
5.75 to binary (101.11) binary to normalized binary (1.0111 * 22) significand is 0111... exponent (2) to 8-bit excess-127 notation = 12910 = 100000012 sign bit is 0, because it's positive 1 bit: sign 8 bits: exponent 23 bits: significand
How are these expressed in IEEE 754: zero denormalized infinity NAN
zero - exponent: 0, mantissa: 0 denormalized: exponent: 0, mantissa: non-zero infinity - exponent: 1, mantissa: 0 NAN - exponent: 1, mantissa: non-zero