There are some rounding errors in the tests, but otherwise the implementation seems correct.
Attach a file by drag & drop or click to upload