It would be nice if <math_constants.h> defined a reasonable set of usual constants for half-precision floats: 1.0_h, 0.0_h, etc.

I couldn’t find any past forum posts on this subject.

I’ll file an RFE.

It would be nice if <math_constants.h> defined a reasonable set of usual constants for half-precision floats: 1.0_h, 0.0_h, etc.

I couldn’t find any past forum posts on this subject.

I’ll file an RFE.

The current contents of math_constants.h is determined purely by the internal needs of the CUDA math library. CUDA supports half floats only as a storage format, not as a computational format. Consequently, no math library functions for half floats are implemented and likewise no half-float constants are defined.

Given the normal way in which math_constants.h gets populated, an RFE for the inclusion of additional constants should therefore specify the specific additional constants requested. I note that CUDA does not have a half-float data type: half float data is stored in unsigned short operands. Any half-float constants would probably wind up looking something like this:

```
#define CUDART_ONE_H 0x3c00
#define CUDART_INF_H 0x7c00
```

Got it.

I like the naming convention used in the math_constants.h file though and wound up defining a few FP16 constants that mimic the names in that file.

Glad to hear you find the naming convention to your liking. From my time working on the math library I can say that there is not actually much of a convention, I simply named the constants in whatever way seemed suitable at the time I added them, which happened over a stretch of approximately five years.