You copied the Doc URL to your clipboard.

About trapping software floating-point division-by-zero errors

Software floating-point division-by-zero errors can be trapped with the following intrinsic:


This traps any division-by-zero errors in code, and untraps all other exceptions, as illustrated in Example 37.

#include <stdio.h>
#include <fenv.h>

int main(void)
{    float a, b, c;
    // Trap the Invalid Operation exception and untrap all other exceptions:
    c = 0;
    a = b / c;
    printf("b / c = %f, ", a); // trap division-by-zero error
    return 0;

See also


ARM C and C++ Libraries and Floating-Point Support Reference: