in reply to Normalise numbers
-- Randal L. Schwartz, Perl hacker Be sure to read my standard disclaimer if this is a reply.
You spotted the bug, but not the solution. You can't "scale" 0 to 1, you have to offset it. To handle that you would need to add another test to the code and adjust $min in the $min == $max special case:
$min -= 1 if $min == $max; [download]
You can however offset anything to 0, so the bug fix has that result.