support both float and double types