




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Lecture notes on Math Review for EECS 442 WI 2021. The lecture covers topics such as Floating Point Arithmetic, Adding Numbers, Fixed-Point Arithmetic, and Floating Point Numbers. The lecture also discusses the Free Drinks in Vegas Theorem and some Gotchas. The document highlights that computer numbers aren’t math numbers and that overflow, accidental zeros, roundoff error, and other issues can occur.
Typology: Lecture notes
1 / 137
This page cannot be seen from the preview
Don't miss anything!





























































































HW0 out, due 2/
HW1 out soon
impossible.
gaps
reference for you to review later
Each game/variable has mean $0.10, std $
100 games is
uncertain and
fun!
100K games is
guaranteed profit:
99.999999% lowest
value is $0.064.
$0.01 for drinks
$0.054 for profits
distributed numbers (mean=31, std=1)
variable with mean 31 and std
(
)*+
≈ 10
,)
Result:
17.4695??
7
6
5
4
3
2
1
0
“Integers” on a computer are integers modulo 2
k
Carry
Flag
Result
8
7
6
5
4
3
2
1
0
42
32 + 9 x 40 / 10 =
32 + 104 / 10 =
Overflow
32 + (9 x 40) / 10 =
uint
32 + (9 x 40) / 10 = 68
math
Why 104?
9 x 40 = 360
360 % 256 = 104
Should be:
9x4=
32 + 10 =
42
7
6
5
4
3
2
1
0
How can we do fractions?
5
4
3
2
1
0
Sign (S) Exponent (E)
Fraction (F)
𝑺
𝑬#𝒃𝒊𝒂𝒔
𝟑
7 - 7
0
Bias: allows exponent to be negative (bias = - 127 for float32)
Note: fraction = significant = mantissa;
exponents of all ones or all zeros are special numbers
Sign Exponent
Fraction
0
x 1.00 = - 1
0/
0
x 1.125 = - 1.
1/
0
x 1.25 = - 1.
0 1 0
2/
0
x 1.75 = - 1.
0
x 1.875 = - 1.
6/
7/
7 - 7=
(-bias)
−𝟏
𝑺
𝟐
𝑬#𝒃𝒊𝒂𝒔
𝟏 +
𝑭
𝟐
𝟑
Sign Exponent
Fraction
0
x 1.00 = - 1
0
x 1.125 = - 1.
2
x 1.00 = - 4
2
x 1.125 = - 4.
Gap between numbers is relative , not absolute
Sign Exponent Fraction
2
x 1.00 = - 4
x 1.00 = - 0.
2
x 1.125 = - 4.
Actual implementation is complex