Floating Point Arithmetic Flashcards
(24 cards)
How are integers represented in computing?
Integers can be represented exactly using a fixed number of bits.
What is the largest unsigned integer that can be represented with n bits?
(2^n) - 1
How are negative integers represented in computing?
Using two’s complement notation.
Why do we need floating point representation?
Many scientific calculations involve non-integer values.
e.g., mass of an electron
What key feature makes floating point representation different from integer representation?
The decimal point can float, allowing for a wide range of values.
What components make up a floating point number?
- Significand/Mantissa
- Exponent
- Base
How would 9.109 × 10−31 be represented in floating point?
- Significand: 9.109
- Base: 10
- Exponent: -31
What is the most widely adopted standard for floating point arithmetic? What does it specify?
- IEEE 754
It specificies: - Number representations (e.g., single precision, double precision)
- How operations like addition, subtraction, multiplication, and division behave
What are the two most commonly used floating point precisions in C?
-
Single Precision: 32-bit (
float
) -
Double Precision: 64-bit (
double
)
Why is double precision preferred for scientific computing?
It provides greater accuracy and range compared to single precision
What happens if a number exceeds single precision limits?
It is represented as infinity (inf
)
How many bits does double precision floating point use? How are they split?
64-bits (8-bytes):
- 52 bits for the mantissa
- 11 bits for the exponent
- 1 bit for the sign
What does it mean for a floating point number to be normalised?
The exponent bits are not all 0s and not all 1s
How is a normalised floating point number represented in IEEE 754?
x=±(1.b{1}.b{2}…b{52}) x 2^(a{1}.a{2}…a{11})-1023
where:
- b{1}, b{2}, …b{52} are the mantissa bits
- a{1}, a{2}, …a{11} are the exponent bits
What is the smallest normalised double precision number? What is the largest?
- Small: 1 x 2^(1−1023) ≈ 10^(−308)
- Large: (2-2^-52) x 2^(2046-1023) ≈ 10^308
Why are floating point numbers not always exact?
Because they have finite precision, leading to rounding errors.
What is machine epsilon?
- The smallest difference between 1 and the next representable number
- For double precision, approximately: 2^(−52) ≈ 10^(−16)
What are the five floating point exceptions in IEEE 754?
-
Overflow (Result is too large) →
inf
or-inf
-
Underflow (Result too small) →
0
or subnormal -
Divide by Zero →
inf
or-inf
-
Invalid →
NaN
- Inexact → Rounded result
What is peak performance (R_{peak}
)?
The theoretical maximum performance of a system, measured in FLOP/s.
How is R_{peak}
used in HPC rankings?
It is listed in Top500 rankings, but R_{max}
is used for final ranking.
What system factors determine R_{peak}
?
- Number of sockets
- Number of processor cores per socket
- Clock frequency
- Number of operations per cycle
What modern features can increase the number of operations per cycle?
- Vector instructions: operates on multiple numbers at once
- Fused Multiply-Add operations: can multiply and add in one instruction
Given:
- 2 sockets
- 6 cores per socket
- 2.8 GHz clock speed
- 4 operations per cycle
What is the compute node R_{peak}
?
R_{peak}
= 2×6×2.8×4 = 134.4GFLOP/s
If a cluster has 192 compute nodes, where each compute node’s R_{peak}
= 134.4 GFLOP/s, what is its peak performance?
192×134.4GFLOP/s = 25.2TFLOP/s