mass = 0
mass == 0 ? INFINITY : 1.0f/mass

this throws a zero division exception, buy only when compiled with xbps-src and then loaded into sbcl 😖 what the fuck, how

Comparisons wit a zero should be avoided, instead define an epsilon and compare with it. Something like:

Abs(value) < 0.00001 ? Zero : not zero

@pixel oh apparently it's fixed, just isn't in the release yet

That's how floats work, it's dangerous to check with equality, if you want to compare two floats, you need to compare the absolute difference with an epsilon

@pixel this was actually the fix they did, the actual code I was running apparently had just 1.0f / mass
@pixel so.. in c, when you duvide by zero, there isn't any error, it's just undefined behavior, but since the result doesn't matter in that case it never came up when doing it in C, but SBCL sure does trap all those signals, as does GDB, so they both throw a error at this point
@pixel the processor/os sends the signal but the c program basically doesn't care
Sign in to participate in the conversation Mastodon Instance

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!