Проверка переменной на null
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
float a, b, h;
ofstream ofile;
float f(float x){
try{
return log(sqrt(3.0*x-1.0))/x/cos(x+2.0);
}
catch(...){
return NULL;
}
}
void print(){
ofile.open("out.txt", ios_base::out);
ll cnt=0;
cout << "Undefined x:\n";
for(float i=a; i<=b; i+=h){
float y=f(i);
if(y==NULL) cout << i << '\n';
ofile << i << " " << y << "\n";
++cnt;
}
cout << "\nDots number - " << cnt << "\n";
ofile.close();
}
int main(){
cin >> a >> b >> h;
print();
return 0;
}
При выполнении программы не выполняется условие y==NULL, хотя должно. В чём проблема?