bpo-40780: Fix failure of _Py_dg_dtoa to remove trailing zeros (GH-20435)

* Fix failure of _Py_dg_dtoa to remove trailing zeros

* Add regression test and news entry

* Add explanation about why it's safe to strip trailing zeros

* Make code safer, clean up comments, add change note at top of file

* Nitpick: avoid implicit int-to-float conversion in tests
3 files changed