msdfgen icon indicating copy to clipboard operation
msdfgen copied to clipboard

Div by zero fixes

Open GlassBeaver opened this issue 8 months ago • 5 comments

Fixed three cases of division by zero.

You can use the following macro to get errors at runtime when a div by zero or other floating-point error occurs, like NaN or inf. Need to enable it on every thread individually at thread creation (for a single-threaded app, just put it first thing in the main function). Ideally, you put this inside #if _DEBUG

// throw floating-point exceptions on any errors and NaN or inf #define THROW_ON_FP_ERROR()
uint32_t origFP;
_controlfp_s(&origFP, 0, 0);
_controlfp_s(nullptr, origFP & ~(_EM_INVALID | _EM_ZERODIVIDE), _MCW_EM);

GlassBeaver avatar Jun 12 '24 13:06 GlassBeaver