text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
>> I could just turn one into 1.0, and 10 into 10.0, which would, indeed,
4,471.12
7.31
have the effect of converting them into floats-- still hopefully
4,478.43
3.96
the same number.
4,482.39
0.79
Or it turns out there's something we'll see again before long.
4,483.18
2.7
You could cast the numbers.
4,485.88
1.29
>> You can, using this parenthetical expression, you can say,
4,487.17
2.71
hey, computer, take this 10, which I know is an int.
4,489.88
2.68
But treat it, please, as though it's a float.
4,492.56
2.1
But this feels unnecessarily complex.
4,494.66
2.02
>> For our purposes today, let's just literally
4,496.68
2.36
make them floating point values with a decimal point, like this.
4,499.04
3.66
Let me go ahead and rerun, make imprecision, good, dot slash
4,502.7
4.36
imprecision, enter.
4,507.06
1.81
OK, we're looking good.
4,508.87
2.12
>> 1 divided by 10, according to my Mac here, is, indeed, 0.100000.
4,510.99
7.204
Now, I was taught in grade school there should be an infinite number of 0's.
4,518.194
3.166
So let's at least try to see some of those.
4,521.36
1.791
It turns out that printf is a little fancier still than we've been using.
4,523.151
3.619
It turns out you don't have to specify just percent f, or just percent i.
4,526.77
4.12
You can actually specify some control options here.
4,530.89
2.94
>> Specifically, I'm going to say, hey, printf,
4,533.83
2.64
actually show me 10 decimal points.
4,536.47
3.19
So it looks a little weird.
4,539.66
1.16
But you say percent, dot, how many numbers
4,540.82
2.025
you want to see after the decimal point, and then f
4,542.845
2.125
for flat, just because that's what the documentation says.
4,544.97
3.37
Let me go ahead and save that.
4,548.34
1.74
>> And notice too, I'm getting tired of retyping things.
4,550.08
2.38
So I'm just setting the up and down arrow on my keys here.
4,552.46
3.44
And if I keep hitting up, you can see all of the commands
4,555.9
2.81
that I made, or incorrectly made.
4,558.71
2.38
>> And I'm going to go ahead now and not actually use that, apparently.
4,561.09
3.54
Make imprecision, dot slash imprecision-- so
4,564.63
6.786
what I was taught in grade school checks out.
4,571.416
1.874
Even if I print it to 10 decimal places it, indeed, is 0.10000.
4,573.29
5.72
But you know what?
4,579.01
0.83
>> Let's get a little greedy.
4,579.84
1.31
Let's say, like, show me 55 points after the decimal.
4,581.15
2.84
Let's really take this program out for a spin.
4,583.99
2.17
Let me remake it with make imprecision, dot slash, imprecision.
4,586.16
5.01
>> And here we go.
4,591.17
1.22
Your childhood was a lie.
4,592.39
2.03
Apparently, 1 divided by 10 is indeed 0.100000000000000005551115123--
4,594.42
13.99
>> What is going on?
4,608.41
1.33
Well, it turns out, if you kind of look far enough out in the underlying
4,609.74
3.62
representation of this number, it actually
4,613.36
2.59
is not exactly 1/10, or 0.1 and an infinite number of zeros.
4,615.95
4.45
Now, why is that?
4,620.4
1.23
>> Well, even though this is a simple number to us humans, 1 divided by 10,
4,621.63
4.62
it's still one of infinitely many numbers that we could think up.
4,626.25
4.66
But a computer can only represent finitely many so numbers.
4,630.91
3.58
And so, effectively, what the computer is showing us is its closest
4,634.49
4.22
approximation to the number we want to believe is 1/10,
4,638.71
4.23
or really 0.10000 ad infinitum.
4,642.94
4.82
>> Rather, though, this is as close as it can get.
4,647.76
2.665
And, indeed, if you look underneath the hood,
4,650.425
1.875
as we are here by looking 55 digits after the decimal,
4,652.3
4.75
we actually see that reality.
4,657.05
2.94
Now as an aside, if you've ever seen the movie--
4,659.99
2.62
most of you probably haven't-- but Superman 3 some years ago,
4,662.61
3.17
Richard Pryor essentially leveraged this reality in his company to steal a lot
4,665.78
3.72
of fractions and fractions of pennies, because the company-- as I recall,
4,669.5
4
it's been a while-- was essentially throwing away anything that didn't fit
4,673.5
3.71
into the notion of cents.
4,677.21
1.58
>> But if you add up all these tiny, tiny, tiny numbers again,
4,678.79
2.69
and again, and again, you can, as in his case, make a good amount of money.
4,681.48
3.48
>> That same idea was ripped off by a more recent, but still now older
4,684.96
3.05
movie, called Office Space, where the guys in that movie,
4,688.01
2.49
did the same thing, screwed it up completely, ended up with way too much
4,690.5
3.001
money in their bank account.
4,693.501
1.165
It was all very suspicious.
4,694.666
1.134
But at the end of the day, imprecision is all around us.
4,695.8
3.49
>> And that, too, can be frighteningly the case.
4,699.29
2.95
It turns out that Superman 3 and Office Space aside, there
4,702.24
3.35
can be some very real world ramifications
4,705.59
2.87
of the realities of imprecise representation of data
4,708.46
3.83
that even we humans to this day don't necessarily
4,712.29
2.48
understand as well as we should, or remember as often as we should.
4,714.77
3.46
And, indeed, the following clip is from a look at some very real world
4,718.23
4.72
ramifications of what happens if you don't appreciate the imprecision that
4,722.95
4.78
can happen in numbers representation.
4,727.73
2.335
>> [VIDEO PLAYBACK]
4,730.065
1.235
>> -Computers, we've all come to accept the often frustrating problems that
4,731.3
4.32
go with them-- bugs, viruses, and software glitches,
4,735.62
4.69
for small prices to pay for the convenience.
4,740.31
2.82
But in high tech and high speed military and space program applications,
4,743.13
4.67
the smallest problem can be magnified into disaster.
4,747.8
5
>> On June 4th, 1996, scientists prepared to launch an unmanned Ariane 5 rocket.
4,752.8
6.1
It was carrying scientific satellites designed
4,758.9
2.32
to establish precisely how the earth's magnetic field interacts
4,761.22
3.38
with solar winds.
4,764.6
2.81
The rocket was built for the European Space Agency,
4,767.41
3.39
and lifted off from its facility on the coast of French Guiana.
4,770.8
3.57
>> -At about 37 seconds into the flight, they first
4,774.37
3.17
noticed something was going wrong.
4,777.54
1.73
The nozzles were swiveling in a way they really shouldn't.
4,779.27
2.98
Around 40 seconds into the flight, clearly, the vehicle was in trouble.
4,782.25
4.33
>> And that's when they made a decision to destroy it.
4,786.58
2.27
The range safety officer, with tremendous guts, pressed the button,
4,788.85
3.93
blew up the rocket, before it could become a hazard to the public safety.
4,792.78
5.37