If you read the excellent Beautiful Code: Leading Programmers Explain How They Think (O’Reilly, 2007), you probably remember the chapter contributed by Brian Hayes entitled Writing Programs for “The Book”.
The thrust of the chapter is that, somewhere, not necessarily in an earthly library, there exists a book containing the best possible algorithms for computing functions or programs. Much of the artistry and craftsmanship in programming concerns the search for those ideal algorithms.
That chapter just reverberated with me (“Yes! That’s what I’m trying to do!”) and I’m reminded of it every time I’m writing new functions. In particular, finding ways to cover the entire argument domain of a function and not overflow the result or experience large errors in the case of approximations.
I really like the Lisps for these types of functions because of the “infinite” precision math that can be used. It makes it possible to come up with functions that just work without having to worry so much about overflow protection. If performance isn’t good enough, then you can worry about how to speed it up.