# IEEE 754 Floating-Point Arithmetic Quiz

The following questions are about floating-point arithmetic as defined by the IEEE 754 standard. The revised version from 2008 generalized floating-point arithmetic and introduced three decimal formats. Here we only consider the binary floating-point formats single precision (32-bit) and double precision (64-bit). Although, most questions are independent of the radix, range of exponent, and precision.

In the sequel we denote the floating-point approximation of any real number by the projection $$\fl \colon \mathbb{R} \to \mathbb{F}$$ where $$\mathbb{F}$$ is any finite and discrete floating-point number system. If not mentioned otherwise, we assume “round ties to even” which is the default rounding-direction (IEEE 754-2008 §4.3.3).

In order to distinguish between elementary operations over the reals and floating-point numbers we introduce the floating-point operators $$\oplus,\ominus,\otimes,\oslash$$ for their counterparts over the reals $${+},{-},{\times},{/}$$, respectively. We then have $$x \oplus y = \fl(x + y)$$ for floating-point numbers $$x,y$$ as well as similar definitions for $$\ominus,\otimes,\oslash$$. Furthermore, we lift these operators in order to deal with NaNs and infinities as defined by the IEEE 754 standard.

In order to distinguish between numbers, infinities, and NaNs the following notation is used. A number is typed in normal font like $$x, y, z$$. A datum is either an infinity, NaN, or a number and is typed bold face like $$\mathbf{x}, \mathbf{y}, \mathbf{z}$$.

• Floating-point numbers are uniformly distributed.

Yes
No
• Roughly half of all positive floating-point numbers are in the interval $$(0,1)$$.

Yes
No
• Only fractions with power-of-two denominators are representable.

Yes
No
• There exist integers $$x,y \in \mathbb{Z}$$ with $$x \neq y$$ such that $$\fl(x) = \fl(y) \neq \pm\infty$$.

Yes
No
• There exists a floating-point number $$x$$ such that $$x \oplus 1 = x$$.

Yes
No
• Addition of floating-point numbers is commutative, i.e., $$x \oplus y = y \oplus x$$ for all floating-point numbers $$x,y$$.

Yes
No
• Addition of floating-point numbers is associative, i.e., $$(x \oplus y) \oplus z = x \oplus (y \oplus z)$$ for all floating-point numbers $$x,y,z$$.

Yes
No
• Addition and multiplication of floating-point numbers is distributive, i.e., $$x \otimes (y \oplus z) = (x \otimes y) \oplus (x \otimes z)$$ and $$(x \oplus y) \otimes z = (x \otimes z) \oplus (y \otimes z)$$ for all floating-point numbers $$x,y,z$$.

Yes
No
• Expression $$0 \oslash 0$$ evaluates to

anything because it is undefined
an infinity
a NaN
• Expression $$1 \oslash 0$$ evaluates to

anything because it is undefined
an infinity
a NaN
• Equality relation is reflexive, i.e., $$\mathbf{x} \doteq \mathbf{x}$$ for any datum $$\mathbf{x}$$.

Yes
No
• Identity law holds for addition, i.e., $$\mathbf{x} \oplus 0$$ equals $$\mathbf{x}$$ for any datum $$\mathbf{x}$$.

Yes
No
• Zero property of multiplication holds, i.e., $$\mathbf{x} \otimes 0$$ equals $$0$$ for any datum $$\mathbf{x}$$.

Yes
No

## Score

You answered 0 out of 0 questions correctly!