Discussion on: Has type safety gone too far?

tsupinie profile image
Tim Supinie

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.