I wouldn't say this is a general rule, but it can be a good thing to do in at least two cases:
1. To learn. Especially compare what you wrote with what is already in the library
2. To cover special cases. There used to be a library for FORTRAN (yes, I'm that old) from the Numerical Algorithms Group that often had several ways of doing what looked like the same thing, but in slightly different cases.