improve double2string function