Hi everyone!
I am newbie to CUDA and I am wondering what I am doing wrong with this function to have the error:
“error: expression must have integral or enum type”
device float peaks (float x, float y) //
{
return 3*(1-x)^2expf(-(x^2) - (y+1)^2) - 10 (x/5 - x^3 - y^5)expf(-x^2-y^2) - 1/3 expf(-(x+1)^2 - y^2);
}
Could anyone please help me? I would be very grateful…
This doesn’t work neither
float z;
z=3*(1-x)^2expf(-(x^2) - (y+1)^2) - 10 (x/5 - x^3 - y^5)expf(-x^2-y^2) - 1/3 expf(-(x+1)^2 - y^2);
return z;
In C, the carat (“^”) character is integer bitwise XOR, not exponentiation. The compiler is complaining because you are trying to do bitwise XOR between a float and an integer, which is illegal. Perhaps a good book on basic C programming is in order?
In C, the carat (“^”) character is integer bitwise XOR, not exponentiation. The compiler is complaining because you are trying to do bitwise XOR between a float and an integer, which is illegal. Perhaps a good book on basic C programming is in order?
Thank you, I have forgotten my basic C.