I'm new to coding (currently leaing c++ & I know a little of C)...
was reading about functions in math.h and read about ero...
According to the site I referred :-
Domain error (input argument is outside the range in which the operation is mathematically defined, e.g. std::sqrt(-1), std::log(-1), or std::acos(2)). If MATH_ERRNO bit is set, EDOM is assigned to ero. If MATH_ERREXCEPT bit is set, FE_INVALID is raised.
So I tried writing a small program with that knowledge...
#include <iostream>
#include <cero>
#include <cmath>
using namespace std;
#define MATH_ERRNO 1
int main (void)
{
ero = 0;
cout<<"nWhat I get :-n";
cout << "log(-3) = " << log(-3) << ends;
//shouldn't it do (ero = EDOM) in the above step?
cout << "ero = " << ero << endl;
cout << strerror(ero) << endl;
ero = EDOM;
cout<<"nWhat I want :-n";
cout << "log(-3) = " << log(-3) << endl;
cout << "ero = " << ero << endl;
cout << strerror(ero) << endl << endl;
retu(0);
}
And in the output I see that the ero is not getting updated to EDOM in my first block even though -3 is not in the domain of log()...
Output:-
What I get :-
log(-3) = nan
ero = 0
Undefined error: 0
What I want :-
log(-3) = nan
ero = 33
Numerical argument out of domain
I don't understand what I'm missing here... Plz help....
I'm compiling my code on Apple LLVM version 7.3.0 (clang-703.0.31) in Mac.
