Saagar Jha
(replying to Saagar Jha)
The answer has nothing to do with “limits of double precision” or “rounding” or “you can’t actually expect these kinds of precise results from floating point”. Just because the rules are hard to understand doesn’t mean that nothing is specified or that there aren’t guarantees
Saagar Jha
(replying to Saagar Jha)
Programmers learn about strings being character arrays and then they learn about Unicode and it traumatizes them so much that they just assume that like you can no longer do any useful operations on strings. And they will confidently go up to people doing this and say as such
Saagar Jha
(replying to Saagar Jha)
In many cases people will use it to avoid diagnosing real problems! If your code works with dates that doesn’t mean you can point at that part and say “oh this is probably broken because date math is hard” when something behaves in a way you didn’t expect
Saagar Jha
(replying to Saagar Jha)
When working in security I cannot just point at some code and say “this has undefined behavior therefore it is exploitable”. Even though compiler authors will generally tell you otherwise (mostly out of frustration) you can build useful security properties on top of UB
Saagar Jha
(replying to Saagar Jha)
Anyways the point I am making is that if “I don’t understand this” is in any part of your reasoning chain the final result needs to also be “I don’t understand this” not “things don’t work this way”
Wowfunhappy
(replying to Saagar Jha)
@saagar Playing devils's advocate a bit: it may be the case that you can increment a variable by using butterfly wings to deflect incoming cosmic rays, but I don't understand cosmic rays, and it's easier to write `i++`. Learning something you don't understand is often harder than just implementing something you do, so if you're trying to just get stuff done, saying "please use this solution which I know will work" isn't necessarily bad advice.
Wowfunhappy
(replying to Wowfunhappy)
@saagar Mind, I'm perfectly aware of all the ways this leads to madness. "Just use this library" leading to endless layers of abstraction, for example.
Saagar Jha
(replying to Wowfunhappy)
@Wowfunhappy To be clear I am not against abstraction or selecting what you want to learn here. I just caution against going “oh this thing is hard to understand therefore I will tell other people that they cannot work with it and must fear it”