correctly convert real to double if real precision is used