From the course: C Programming for Embedded Applications
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Fixed-point math - C Tutorial
From the course: C Programming for Embedded Applications
Fixed-point math
- [Instructor] At this point, it's important to understand that floating-point numbers are not a silver bullet. They're just not adequate for every situation or application. Take banking for instance, did you know that you just can't add 100 million to one with 32-bit floats? Feel free to try it, just make sure you're using 32-bit floats. Now, this would mean that if you go to the bank and make a deposit for $1 into your account with a balance of 100 million, your balance will stay unchanged. Sure it's just a dollar, but if you made a 100 million consecutive deposits of $1 each, your balance would still remain unchanged. This is due to the fact that floats have a precision of about six decimal places, this is sometimes referred to as the big number eating the small number. So, now let's get to know fixed-point numbers with a comparison. At the left, we have floating-point numbers and some characteristics. And to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.