aaronqli
aaronqli

Reputation: 809

Smallest/Largest float or double precision constant in OpenCL

I need the smallest/largest floating point number in an OpenCL kernel program which involves computing log probability. I had a look on OpenCL reference manual but I cannot locate such constants.

In Java it is equivalent to something like Double.MAX_VALUE;

In C it is in float.h

Upvotes: 4

Views: 3644

Answers (2)

Eric Bainville
Eric Bainville

Reputation: 9886

They are called FLT_MAX / FLT_MIN, and DBL_MAX / DBL_MIN. See Macros and Limits in the OpenCL 1.2 spec.

Upvotes: 7

aaronqli
aaronqli

Reputation: 809

Well one obvious solution is to just use 1E+37. But it would be good to know if OpenCL has already defined such constants.

Upvotes: 0

Related Questions