3 ms·
Well, one of the points is that even if things work properly/as expected 99.8% of the time, when you add layer after layer of "works ok most of the time", you e
by slx26 5y ago
Well, one of the points is that even if things work properly/as expected 99.8% of the time, when you add layer after layer of "works ok most of the time", you end up with a very unreliable system. And given that all computing revolves around manipulating numbers, the fact that there's so much wiggle room (even if there are often good reasons for most of the differences we are seeing here, which are fundamentally semantical differences anyway), should at least make you slightly uncomfortable when thinking about building complex systems. And that's without entering the realm of what happens with overflows, underflows, NaNs and everything else. The bases are solid, but we can still see quite a lot of holes.
- mingodad 5y agoThank you for explaining your understand of the issue presented here with a wide view. I was shocked when I got the results shown here and thought of times in the past were I copied and pasted formulas (and sometimes did some small changes to be accepted by the language I was using) without thinking that any language would interpret it differently without warning. Other good worth replies in my opinion: amichal https://news.ycombinator.com/item?id=28100036 https://news.ycombinator.com/item?id=28100036 hinkley https://news.ycombinator.com/item?id=28101243 https://news.ycombinator.com/item?id=28101243 hansvm https://news.ycombinator.com/item?id=28100156 https://news.ycombinator.com/item?id=28100156 I believe that most of us are acting in good faith most of the time and we need some common examples/tests like basic math expressions that we could use to check/evaluate any/most implementations in programming languages to try prevent or minimize divergences like the ones shown here by a random generated expression that has no other meaning than a uncommon valid? test case to show an issue.
- MauranKilom 5y agoMy point was that the expression could be one sixth the length and contain no more than two parentheses, from what I gather. Hence the question what the purpose of constructing this expression was - it just looks like somebody facerolled their numpad and then made random edits until the syntax was ok.
- slx26 5y agoYeah, sorry about that. I'm generally against obfuscation, but in this case, the "why" of the resulting differences in calculations is well known to most programmers; the big issue is not "why we get different results", but rather "are we ok this type of inconsistent behavior". If you simply showed that modulo and implicit casting work differently in different languages, we wouldn't have had any discussion. With the obfuscation, we got some discussion about the main point... and the discussion about the obfuscation. Honestly, none of us managed to capture all the perspectives well enough. Yeah, the "Ask HN" could have used a less obfuscated expression and been better worded to clarify that the specific semantic differences weren't the main point here. Similarly, most commenters (myself included in my previous comment) failed to realize/clarify that there were two discussions going on here, but that one of them is settled with a technical footnote.