3 ms·
What about I64.min_value() / (-1)? Why does that give 0? If you're doing wrap-around arithmetic it should give I64.min_value(). https://tio.run/##K8jPq/z/PzG5J
by simonbyrne 8y ago
What about I64.min_value() / (-1)? Why does that give 0? If you're doing wrap-around arithmetic it should give I64.min_value().
https://tio.run/##K8jPq/z/PzG5JL9IwTcxM49LAQjyUssVkotSE0tSNVLzyqwUXPPKNBVs7cByOaklChUKtgqeZiZ6uZl58WWJOaWpGpoK@goauoaaYCVAPXr5pSV6BUWZeSUaFXrFJUBGuoam5v//AA https://tio.run/##K8jPq/z/PzG5JL9IwTcxM49LAQjyUssVkotSE0tSNV...
- spooneybarger 8y agoThat might be an LLVM bug. `I64.max_value() + 1` gives the expected result. I'm going to have to look into that. Thanks.
- simonbyrne 8y agoApologies, I realise my comment was a bit snarky. Pony looks like a really neat language: I'll be interested to see what you do with it. Unfortunately LLVM considers division overflow undefined: http://llvm.org/docs/LangRef.html#id109 http://llvm.org/docs/LangRef.html#id109 If it's any use, you can see what Julia ended up doing here: https://github.com/JuliaLang/julia/issues/8188 https://github.com/JuliaLang/julia/issues/8188
- spooneybarger 8y agoI didn't take it as snarky. I was genuinely surprised. Thank you. If you intended it to be snarky, I didn't notice. And thank you for the additional info, I've updated the issue I opened accordingly: https://github.com/ponylang/ponyc/issues/2858 https://github.com/ponylang/ponyc/issues/2858