Just curious has anyone else seen roc give the wrong panic message?
Recently I saw a case of "multiplication overflow", but it came from an addition.
I've specifically seen reports of that one
of it saying multiplication overflow where it should have said something else (I heard about it in the case of subtraction instead of addition)
only kinda related, but I think we could make that error message a lot more helpful, especially for people not used to different number types - e.g. U8 multiplication overflowed. U8s range from 0 to 255, and this multiplication resulted in a number outside those bounds. Converting to a larger number size (e.g. by calling Num.toU16 on both numbers) before multiplying would increase these bounds.
I would appreciate a more clarified error message. You could also suggest using signed int version if they attempt to go below zero.
Could also mention the saturating or wrapping versions of the functions
maybe just link to some docs on how to handle overflow
Wait, does Roc have the wrapping and saturating version of arithmetic infix operators, like Zig does? Or just the regular addWrap et. al. functions?
functions only
Damn, those infix versions are super nice in Zig. They basically solve all the ergonomic problems of always crashing on overflow, if you're trying to write something very numerical.
Last updated: Jul 26 2025 at 12:14 UTC