Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Normalizing a range of numbers to a percentage

by hdb (Monsignor)
on Mar 08, 2019 at 08:22 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-18 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found