Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Normalizing a range of numbers to a percentage

by stevieb (Canon)
on Mar 07, 2019 at 22:56 UTC ( [id://1231032]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
        my $x = (($tap - $min) * ($new_max - $new_min) / ($max - $min));
        say "$tap: $x";
    }
    
  2. or download this
    0: 0
    1: 0.392156862745098
    ...
    253: 99.2156862745098
    254: 99.6078431372549
    255: 100
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1231032]
Approved by choroba
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found