cancel
Showing results for 
Search instead for 
Did you mean: 

Division by zero

Ecohe
Associate II

Is there a way to prevent a crash while there is a division at zero.

For example when there is a division by zero it will return zero

11 REPLIES 11
TDK
Guru

> I can not find all the places and situations when these cases occur.

Is your hope that your code will work in spite of ignoring all divisions by zero?

Surely dividing by zero indicates a flaw somewhere in code logic or otherwise. How is your code so riddled with these errors that you can't isolate where it happens?

If you feel a post has answered your question, please click "Accept as Solution".

AFAIK in Cortex-M4 the division by 0 trap is not enabled by default, so there's some code which explicitly enables it (in some sort of SystemInit() or similar obscure piece of code which comes automagically with the environment).

JW