Hello,
What is the best way to implement sign function in CUDA (Sign function - Wikipedia) which takes float as input and gives float as output. Here is probably the worst implementation as illustration:
float sign(float x)
{
if (x < 0.0f) return -1.0f;
if (x == 0.0f) return 0.0f;
if (x > 0.0f) return 1.0f;
}