Add a double conversion utility function
rework API to use return values instead of result pointers