It would be interesting to see a breakdown of the ways in which ill-formed inputs could affect the output. And how much work it would be to detect such inputs and return some kind of sentinel error value - in the same style as the current code.
(Not quite interesting enough for me to do it myself though ;-)
(Not quite interesting enough for me to do it myself though ;-)