 So I've thrown something on the screen and I want you to actually pause the video for a second and Take a look at this see if you can figure out what's going on here So hopefully you've taken that time you've gone in you've actually Come back with a little bit of a question Because if you we kind of take a look at that math right there double number equals one Minus zero point one minus zero point one minus zero point one minus zero point one I should come back with a zero point five. This should be so rudimentary that I don't even understand why You made me pause the video and do this in the first place except, huh That's that's not right. That's a zero point five zero zero zero zero fourteen zeros one Well, here's what's going on again when we looked at the idea of having a Decimal place in code in programming We run into a bit of an issue, you know that one point zero that's going on there or any of those decimal places one point zero Could I have not just said one point zero zero or one point zero zero zero Where do I stop? And I have to go there a very long time you're thinking oh, well, I can just stop The computer stops at some point. Well, how it stops actually is kind of at that rounding off point It has to find its middle in between You know that next digit So what's actually going on there is With all of these is I've done that so many times so often that I run into this issue so suddenly when I do some Floating point math on the computer even though the computer is very good at doing mathematical calculations it runs into an issue of Storing those ones and zeros and what equates out so all of a sudden I get something like Point five fourteen zeros one So how do I resolve this and this is actually Known as creating something known as an approximation an approximation is Just that it's me setting up something that's just it's Close enough if you want to think of it like that I'm making something that will be close enough to my answer that I'll go ahead and accept it as my answer again This is going back to our beginning of the slides We looked at those circles This was close enough the same kind of concept is going on here is I'm basically stating that all right I'm close enough that I will accept this as an answer So again, let's get back to our slides So how do we do that? Well, we start off with something simply by creating What's known as an epsilon? Now I'm gonna write out this code here and you can pause the video or skip ahead and a Few things are going on here. Oh Not like that. That's not what I meant So the first thing is that one I made it a final meaning it's a constant variable meaning my program can't change it I can't change it It's always gonna be that and one of the things that we do with that if we name it in all capital letters This is just a good way to indicate this is gonna be all caps You know, I'm not gonna be able to change this later especially when my lines of code my programming language is gonna be a hundred lines of code or 200 or a thousand or ten thousand, you know when this starts to grow I don't want to have to scroll up to the top of my screen just to see oh, I can't change this It's a good little indicator for me So the next little bit is I'm gonna keep the math going the same way But now what I want to do is I want to see is this close enough and How I write this out is simply put I Take whatever my Actual number is and then I just do some basic math I go. All right. Well am I close enough? To what I was expecting I'm expecting 0.5 Again, we're gonna do that math if we do that math we get 0.5 with a bunch of ones so I'm not 100% there well What I do is I I write this out. I've got my math there and I say is that at least Close enough to my epsilon That is less than my epsilon epsilon sort of my cutoff point. You can think of it that way It's the you must be this tall to ride So if I'm this tall, yes, I can ride, but if I'm this tall, no, I can't that's what's going on here So then I just write out my system dot out print line Number is Approximately 5.0 0.5 And if we take a look at that code for a second we compile that up and Then we run it. Nope. You can see 0.5 is approximately 5 and so that's where we can get into that a little bit, but let's say if we've changed this out What if I then said it was That Well, if we say it's only a 10th in our case You'll see that it's still Approximately, it's close enough but Let's fool around with this a little bit more. Let's see if we can't change it a little bit Let's get rid of say that last one. So this should be 0.56 We can pile it up. We run it. Notice how we didn't get any print statement again That's because if only happens when it's true So we didn't get to see it if I uncomment that first line of code and compile this I get to see what My expression is and it's 0.6. 0.6 is not a and it's still got you know the 14 zeros and whatnot But 0.6 is not a 0.5. So again, it's not approximately 0.5 that's where these things can come into play if I Changed my epsilon so that it was a one now Maybe a one's a little too far. I'm gonna go with point five Now we're being you know, we're being a little Mucky on things to see if we can get this so that point six is Approximately a point five again. Let's think about what the math is going on there 0.6 minus 0.5 Gives me point one point one is less than Point five and so we've just stated that 0.6 is approximately 0.5