From the course: Python for JavaScript Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Numbers, numeric types, and decimals

Numbers, numeric types, and decimals - Python Tutorial

From the course: Python for JavaScript Developers

Start my 1-month free trial

Numbers, numeric types, and decimals

- [Instructor] In 1991, a malfunction in the Patriot Missile resulted in a tragedy. It is believed that this malfunction was caused due to a floating point-related error. Numbers can be easy to dismiss when it comes to software. We kind of take them for granted but I actually think part of understanding a programming language includes really understanding its numeric types. Let's head over to our exercise files and take a look at numeric types in JavaScript and Python. In JavaScript, we mostly see one double precision floating point type. Whether we simply define it as if it were an integer, like we see in line one or on line two, we will see that we get a floating point type and I will demonstrate that by logging the type of it to the console, as you can see on line four. Then I wanted to show you some strange unexpected behavior. You may be familiar with this example. If you add 0.2 and 0.1, what would you expect…

Contents