




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
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