The problem is that sum can contain `nan`, `oo`, or `-oo`. Now certainly,
`>>> some_number + nan`
`>>> nan`

But on the other hand:
`>>> oo + nan`
`>>> oo`

The explanation needs some context first.

The way sympy deals with basic operations is this (for two operands):
1. If both operations are *numbers*, i.e. they can be evaluated directly without first needing to evaluate individual arguments, then sympy's inherent capabilities give the correct results. Ex,
`>>> 5 + nan`
`>>> nan`
But, if one or both of the operands must first be evaluated, then in that case sympy was facing problems (which was the issue to begin with). Ex:
`>>> 5 + sin(oo)`
`>>> 5.00000000000000000000`

Now this behaviour occurs due to the fact the `sin(oo)` is evaluated first. Then its floating point value is what gets operated on.

Now that we have some context of the problem, here is the explanation:

If either oo, nan, or -oo in the terms that re supposed to be added, we have two options:

1. We define a bunch of new conditions, each dealing with what must be done in every exceptional case. I suppose there can be 3 total cases * 2 types of operations (+ and -). We can reduce these to a few cases but it wound't fit very well with DRY principles. Or, we can do this.

2. Since we know that sympy is good enough in dealing with expressions *if operands don't have to be evaluated first*, we just check if one or more of the operands is one of the exceptional values, and if it is so indeed, we just pass to sympy the *evaluated operands*. This means sympy takes care of all exceptional cases on its own without us having to repeat the code that's already there.

I hope that clarifies the issue.

As for the second query, yes it seems that precision does not matter. I'll set the precision to 1 then in the above line.