Map Value to Range

Map a value from one range to another.

Code

General
echo "scale=2; ($value - $inMin) * ($outMax - $outMin) / ($inMax - $inMin) + $outMin" | bc

Parameters

Value to map

Input range min

Input range max

Output range min

Output range max

Server

More Bash Snippets