Tested and updated mygetdouble function