working for float and double also