problem with cudaMemset2D

The function cudaMemset2D ( void * devPtr, size_t pitch, int value, size_t width, size_t height )
in the reference,it says the parameter “value” - Value to set for each byte of specified memory
what does it mean?
I’m trying to use the API to initialize a 2d array,but in the emulation mode ,i found the value is -0.0013270393, not the number i want.
my code as follow:
cudaMemset2D((void**)in.d_odata,in.pitch2,0,width*sizeof(flo
at),height);
so ,what is te problem ?

The CUDA memset functions take “value” as an int. However it should work with 0 since the representation of 0.0f and 0 are the same. You could try using a kernel to set the memory instead.

The CUDA memset functions take “value” as an int. However it should work with 0 since the representation of 0.0f and 0 are the same. You could try using a kernel to set the memory instead.