change the magic number 4 to float size

float size may be different on various devices, this magic number should be change to sizeof(float) to be more secure.