Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Normalizing a range of numbers to a percentage

by hdb (Monsignor)
on Mar 08, 2019 at 08:22 UTC ( #1231045=note: print w/replies, xml ) Need Help??


in reply to Normalizing a range of numbers to a percentage

For such a simple translation it might be overkill but you could also use an interpolation module such as Math::Interpolate for the translation.

use strict; use warnings; use Math::Interpolate qw(linear_interpolate); print "$_: ".linear_interpolate( $_, [0,255], [0,100])."\n" for 0..255 +;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-05-24 18:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (84 votes). Check out past polls.

    Notices?