Numerical Error when doing division for Case [3, 3, 8, 8]
I am just trying to figure out a naive solution before I optimize the algorithm. \n\nIt seems that I ran into numerical issue in Case [3,3,8,8]. I tried to debu
I am just trying to figure out a naive solution before I optimize the algorithm. \n\nIt seems that I ran into numerical issue in Case [3,3,8,8]. I tried to debug and it seems it calculates 8/3 as 2.6666666666666665, which in turn gives some number very close to 24.0 but not exact for 8 / (3 - 8 / 3). What should I do in general to handle this kind of situation? \n\n```\nclass Solution(object):\n    def judgePoint24(self, nums):\n        """\n        :type nums: List[int]\n        :rtype: bool\n        """\n        return 24.0 in self.Possible_All_Perm(nums)\n    \n    def Possible_All(self, nums):\n        if len(nums) == 1:\n            return [float(nums[0])]\n        result_temp = set()\n        for i in range(len(nums)-1):\n            list1 = self.Possible_All(nums[:i+1])\n            list2 = self.Possible_All(nums[i+1:])\n            result_temp.update(set([i + j for i in list1 for j in list2]))\n            result_temp.update(set([i * j for i in list1 for j in list2]))\n            result_temp.update(set([i - j for i in list1 for j in list2]))\n            result_temp.update(set([i / j for i in list1 for j in list2 if j != 0.]))\n        print(nums, result_temp)\n        return list(result_temp)\n    \n    def Possible_All_Perm(self, nums):\n        result = set()\n        for i in itertools.permutations(nums):\n            result.update(self.Possible_All(i))\n        return list(result)\n```
[]