>> SPEAKER 1: Suppose I'd like to write a program that prints out a float,
specifically the result of dividing 1 by 10.
Well, my first instincts would be to write this program as follows.
Float f equals 1 divided by 10, and then print f of percent .1f, thereby
signifying that I'd like to print a float to one decimal place,
backslash n comma f.
Let's now compile this program.
Make float 0 dot slash float 0.
>> Well, that's not quite right.
I'm quite sure that 1 divided by 10, or 1/10 is not 0.0, but 0.1, and yet
here I'm seeing on the screen 0.0.
What's going on?
Well, it turns out that in c, if you divide an int by an int,
you get back an int.
And so even though 1 divided by 10 is indeed 0.10, 0.1 cannot fit in an int,
and so what c does is it truncates, or throws away everything after the
decimal place, thereby leaving us with just 0.
>> But then, of course, with print f, we specify that we'd like to print f to
one decimal place, and so that 0 is displayed as 0.0.
Well, clearly this is a problem that needs a solution.