C library macro - ERANGE
C standard library - <errno.h>
description
Occurrence C library macroERANGE represents a range of error, it is out of range in the input parameters defined by mathematical functions when, errno is set to ERANGE.
statement
Here is the ERANGE macro statement.
#define ERANGE some_value
parameter
- NA
return value
- NA
Examples
The following example demonstrates the usage of the macro ERANGE.
#include <stdio.h> #include <errno.h> #include <math.h> int main() { double x; double value; x = 1.000000; value = log(x); if( errno == ERANGE ) { printf("Log(%f) is out of range\n", x); } else { printf("Log(%f) = %f\n", x, value); } x = 0.000000; value = log(x); if( errno == ERANGE ) { printf("Log(%f) is out of range\n" x); } else { printf("Log(%f) = %f\n", x, value); } return 0; }
Let's compile and run the above program, which will result in the following:
Log(1.000000) = 1.609438 Log(0.000000) is out of range