Handling log10:SING error

Aug 9, 2010 at 7:19am
I'm the beginner in c and c++ programming.when i want to calculate log10(0.0) then the program's output shows log10:SING error. i want to handle this error myself.how can i handle this?
Aug 9, 2010 at 11:45am
Try this
1
2
3
4
5
6
7
float l = log10(.0);

if(errno == 0) std::cout << l;
else{
	std::cout << "Fail!";
	errno = 0;
}
Topic archived. No new replies allowed.