C library macro - EDOM
C standard library - <errno.h>
description
Occurrence C library macroEDOM represents a domain error, it exceeds the input parameter mathematical functions defined domains, errno is set to EDOM.
statement
Here is EDOM macro statement.
#define EDOM some_value
parameter
- NA
return value
- NA
Examples
The following example demonstrates EDOM macro usage.
#include <stdio.h> #include <errno.h> #include <math.h> int main() { double val; errno = 0; val = sqrt(-10); if(errno == EDOM) { printf("Invalid value \n"); } else { printf("Valid value\n"); } errno = 0; val = sqrt(10); if(errno == EDOM) { printf("Invalid value\n"); } else { printf("Valid value\n"); } return(0); }
Let's compile and run the above program, which will result in the following:
Invalid value Valid value