But even though we usually think that floating point numbers are like real numbers, they actually are discrete numbers approximating a real value. This can lead to strange effects, when you add or subtract two numbers with largely different order of magnitude.
Right, but that's a problem with how we represent numbers in computers, not with a lack of type enforcement. A better reason might be to get you to think about why you're trying to combine floats and integers in arithmetic operations, which seems like a weird thing to do. I'm open to examples in which that's "proper", though.
Log in to continue
We're a place where coders share, stay up-to-date and grow their careers.
Right, but that's a problem with how we represent numbers in computers, not with a lack of type enforcement. A better reason might be to get you to think about why you're trying to combine floats and integers in arithmetic operations, which seems like a weird thing to do. I'm open to examples in which that's "proper", though.