Asking the question is answering it!
Use the following algorithm:
$norm_min=1; $norm_max=3; $mini; $maxi; $mini=<DATA>; $maxi=$mini; @figures=<DATA>; foreach (@figures) { chomp; $mini=$_ if $_<$mini; $maxi=$_ if $_>$maxi; } print "$mini $maxi\n"; foreach (@figures) { chomp; my $result=($_ - $mini) * ($norm_max - $norm_min) / ($maxi - $mini +) + $norm_min; print "$_: $result\n"; } __DATA__ 10 3 50 -8 100 67
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
In reply to Re: number normalization
by CountZero
in thread number normalization
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |