YouTube2Text

[CS61C FA20] Lecture 06.4 - Floating Point: Examples, Discussion — Transcript

by CS 61C Departmental · 973 words · 156 segments · language en · Watch on YouTube

Full transcript

  1. 0:00and welcome back now let's see some
  2. 0:02examples and actually make you do some
  3. 0:04work
  4. 0:04so let's actually think about how to
  5. 0:06calculate some floating point
  6. 0:08back and forth from floating point to
  7. 0:09decimal and back
  8. 0:11so here we go first quiz pause the video
  9. 0:15what's the decimal equivalent
  10. 0:16of one one thousand one and then three
  11. 0:19ones and that
  12. 0:21go pause the video
  13. 0:25and welcome back see i kind of froze
  14. 0:27there like i was pretending like i was
  15. 0:29first
  16. 0:29okay let's do this together all right
  17. 0:32well first of all i see a one i think
  18. 0:34it's a negative number but i don't know
  19. 0:35if the other part
  20. 0:36always confuses me let's let's go so i
  21. 0:38first label them
  22. 0:39sine exponent significant first thing
  23. 0:41okay
  24. 0:42here's my equation i pull my equation
  25. 0:44out minus 1 to the s can be a negative
  26. 0:46number
  27. 0:471 plus significance so that's 1.111
  28. 0:50already times 2 to the exponent minus
  29. 0:53127.
  30. 0:54okay so first one is
  31. 0:58what's the exponent well that's 128 plus
  32. 1:00the one is 129.
  33. 1:02129 minus 127. we're gonna see that is
  34. 1:06minus that's two sorry that's two so one
  35. 1:08point one one one times two to the two
  36. 1:10means i move the binary point to the
  37. 1:13right
  38. 1:13two spots so that gives me minus one one
  39. 1:17one
  40. 1:17point one now you probably hope you can
  41. 1:20do this one from here this is like fixed
  42. 1:21point which is minus
  43. 1:23seven point not bad
  44. 1:26okay so that was a great explanation of
  45. 1:28how to do that with simple numbers we
  46. 1:29don't like to have
  47. 1:30a lot of energy in the significant it's
  48. 1:32just too much work but that's the basics
  49. 1:34of it pretty cool
  50. 1:35next one how would you represent
  51. 1:37one-third
  52. 1:39wait what this is repeating yeah it is a
  53. 1:41repeating fraction
  54. 1:42so in base 10 it's a repeating fraction
  55. 1:440.333
  56. 1:46so let's actually start well is there
  57. 1:48any halves nope there's no 0.5s in there
  58. 1:50is there any quarters yep that's 0.25
  59. 1:53okay subtract that off what are you left
  60. 1:54with okay keep doing this
  61. 1:56and you'll see that it actually works
  62. 1:57out to be a it's it's a uh
  63. 2:00it's a quarter not an eighth plus a 16th
  64. 2:04plus a 64th and so you'll see that it
  65. 2:07actually
  66. 2:08is a quarter a 16th a 64th 256. it
  67. 2:11actually skips one
  68. 2:12it starts by skipping one at the half
  69. 2:14and then every other one
  70. 2:16that's it so now we can do it if we know
  71. 2:19that we kind of do a couple of them and
  72. 2:20now we can actually do it so 2 to the
  73. 2:22minus 2 to the minus 4 to the minus 6 to
  74. 2:24the minus 8
  75. 2:25or let's write it here 0.010101 etc etc
  76. 2:33times 2 to the 0 because i don't need to
  77. 2:35move that or shift that at all okay
  78. 2:37so that's pretty cool
  79. 2:41so now what's that really when i
  80. 2:42normalize it remember i have to
  81. 2:43normalize it
  82. 2:45that becomes 1.01010101 times 2 to the
  83. 2:48minus 2
  84. 2:49okay because i had to shift the boundary
  85. 2:51point to the right so now to the minus
  86. 2:532. now you say to yourself
  87. 2:54how do i store both that exponent and
  88. 2:57the significant in there
  89. 2:58sine 0 it's positive number exponent is
  90. 3:02i got a minus 2
  91. 3:03plus the 127 to get 125. so the bit
  92. 3:06pattern has to say 125.
  93. 3:09and actually it's kind of interesting if
  94. 3:10you look at the bit pattern 125
  95. 3:12how many off how many here am i missing
  96. 3:14this looks pretty
  97. 3:15how am i missing from being all ones
  98. 3:17well it's really here i'm missing a two
  99. 3:19so you can kind of figure out quickly
  100. 3:21minus two that's i know that i'm too off
  101. 3:23of that which is 125
  102. 3:25because i'm missing the twos bit okay
  103. 3:30significand
  104. 3:32i just i'll say that another way 127 is
  105. 3:350
  106. 3:35and all ones minus 2 says
  107. 3:39minus 2 which is why there's a hole here
  108. 3:43and that 1 minus 1 is 0 and that's what
  109. 3:45that hole is just to make sure that it's
  110. 3:46significant is zero one zero zero one so
  111. 3:49i'm left with
  112. 3:50this bit pattern and that is a third
  113. 3:52kind of a neat bit pattern
  114. 3:55all right so let's see if we can
  115. 3:57actually understand the
  116. 3:59significant a little bit better and
  117. 4:01remember i i mentioned this a couple of
  118. 4:02videos but i want to be clear about it
  119. 4:060.34 if i give you that some decimal
  120. 4:08back in it
  121. 4:09you can say you know 0.34 is really like
  122. 4:11oh sorry 0.340.
  123. 4:13it's like having 340 over a thousand
  124. 4:16or it's like 34 over 100. so it's 3400
  125. 4:19that's no way to say that
  126. 4:21same way 0.110 let's think about that
  127. 4:240.110
  128. 4:25that's like saying 6 over eight i had
  129. 4:27three bits for the eight
  130. 4:29six over eight or three
  131. 4:32over four same thing point one one over
  132. 4:35a hundred so this is nice black people
  133. 4:38like this way of thinking about the
  134. 4:39significant
  135. 4:40there's another way of doing it which is
  136. 4:42you just add up the pieces of it we saw
  137. 4:45add up the place values
  138. 4:46so if i have 1.6732 it's really like
  139. 4:49one ones six tenths seven
  140. 4:52hundredths etc so 1.100
  141. 4:56is another way of saying well i have 1 1
  142. 4:591 half and 1 16. so i can either think
  143. 5:03of this number as
  144. 5:049 16 or a half plus a 16
  145. 5:09which is 9 16. so the two ways of
  146. 5:11thinking about this
  147. 5:12let's uh please choose the one that's
  148. 5:14more appropriate for you that kind of
  149. 5:15makes
  150. 5:16sense for you as you're thinking about
  151. 5:17these numbers but that does help to be
  152. 5:18able to
  153. 5:19to work with binary points on the
  154. 5:21fractional side kind of in a fixed point
  155. 5:22way
  156. 5:23all right see the next video

About this transcript

This page contains the full transcript of [CS61C FA20] Lecture 06.4 - Floating Point: Examples, Discussion by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 973 words across 156 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.