in reply to Re: Normalise numbers
in thread Normalise numbers

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;

You can however offset anything to 0, so the bug fix has that result.


Perl is Huffman encoded by design.