"fpclassify" is undefined

Hello All,

I am using the fpclassify in math.h to check when the data is inf or not before launching the gpu kernel for computation. The I got the following error message.

xxxx.cu(648): error: identifier “fpclassify” is undefined

Any suggestions?


To the best of my knowledge, fpclassify() does not exist in CUDA. Use the C/C++standard function isinf() instead to check for infinities, similarly use the standard function isnan() to check for NaNs.


I notice belatedly that your original usage of fpclassify() apparently occurs in host code (" check … before launching the gpu kernel"; emphasis mine).

If that is a correct assessment of the situation, the compiler error message occurs because the host toolchain does not provide fpclassify(), which was the case with older versions of MSVC as I recall.

In any case, fpclassify() is usually slow on all platforms that do provide it because it is a very general check, and from a performance perspective it is advisable to use the more specific checking functions isinf() and isnan().