Skip to main content
Knowledgebase
Home
Renesas Electronics America - Knowledgebase

What error occurs when passing 0 to the argument X of C Standard library?

Latest Updated:11/13/2009

Question:

The FPU exception occurs when passing 0 to the argument X of C Standard library function "atan2(y,x)".

Answer:

The argument x of C Standard library function "atan2(y,x)" is a divisor. In case of the C/C++ compiler package for SuperH Family, it is executed "divided by 0" when passing the argument x to 0. In case of executing "divided by 0" with the FPU, you need to admit "divided by 0" at the "Floating Point Status/Control Register (FPSCR)" before executing. The FPU exception occurs, in case of "divided by 0" without admitting "divided by 0" at the FPSCR. Refer to the hardware manual of each devise about the detail of the FPSCR.

Except "atan2(y,x)", the FPU exception could be occurred by the above reason, if you pass 0 to the second argument of the following C Standard library functions.

Name of the function
  atan2f(x,y)
  fmod(x,y)
  fmodf(x,y)

Suitable Products
C/C++ Compiler Package for SuperH Family