frac function in CUDA

I took a look on the functions that CUDA supports and I saw that trunc() is supported (returns the integer part of a number) but I can’t find a function that returns the fractional part of it (known as frac() in standard C).
Maybe they have renamed the function?
Does anybody know how to calculate that part?

I don’t think frac() is part of the standard C math library, and we don’t have in CUDA either. It’s pretty simple to implement though:

float fracf(float x)
return x - floorf(x);

thanks mate!

No problem!

Somebody pointed out to me that you should really use “x - truncf(x)” if you want it to handle negative numbers correctly.