Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

how to map one value to another in C

// More accuarte
#include <math.h>
double round(double d)
{
    return floor(d + 0.5);
}

double slope = 1.0 * (output_end - output_start) / (input_end - input_start);
double output = output_start + round(slope * (input - input_start));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #map #C
ADD COMMENT
Topic
Name
1+6 =