Add a global constant outside of this function

```python
MAX_DOUBLE = np.finfo(np.float64).max
```

and reuse here.