Home > Electronics Tutorials > C Language Tutorial > math.h - Error Conditions

C Language Programming Library Reference Guide

math.h - Error Conditions

All math.h functions handle errors similarly.

In the case that the argument passed to the function exceeds the range of that function, then the variable errno is set to EDOM. The value that the function returns is implementation specific.

In the case that the value being returned is too large to be represented in a double, then the function returns the macro HUGE_VAL, and sets the variable errno to ERANGE to represent an overflow. If the value is too small to be represented in a double, then the function returns zero. In this case whether or not errno is set to ERANGE is implementation specific.

errno, EDOM, and ERANGE are defined in the errno.h header.

Note that in all cases when it is stated that there is no range limit, it is implied that the value is limited by the minimum and maximum values of type double.

Note: To report broken links or to submit your projects, tutorials please email to Webmaster

Discover

     more......