Thanks for mentioning that. It's a problem I occasionally need to solve and based on your comment, I found this helpful write up by Nick Higham [1].
[1] https://nhigham.com/2021/01/26/what-is-the-nearest-positive-...
[1] https://nhigham.com/2021/01/26/what-is-the-nearest-positive-...