conversion to double without .net functions