Average Error: 0.3 → 0.3
Time: 3.7s
Precision: 64
$\frac{xval}{xmax} \cdot 255$
$\frac{xval \cdot 255}{xmax}$
\frac{xval}{xmax} \cdot 255
\frac{xval \cdot 255}{xmax}
double f(double xval, double xmax) {
double r2671126 = xval;
double r2671127 = xmax;
double r2671128 = r2671126 / r2671127;
double r2671129 = 255.0;
double r2671130 = r2671128 * r2671129;
return r2671130;
}


double f(double xval, double xmax) {
double r2671131 = xval;
double r2671132 = 255.0;
double r2671133 = r2671131 * r2671132;
double r2671134 = xmax;
double r2671135 = r2671133 / r2671134;
return r2671135;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.3

$\frac{xval}{xmax} \cdot 255$
2. Using strategy rm
3. Applied associate-*l/0.3

$\leadsto \color{blue}{\frac{xval \cdot 255}{xmax}}$
4. Final simplification0.3

$\leadsto \frac{xval \cdot 255}{xmax}$

# Reproduce

herbie shell --seed 1
(FPCore (xval xmax)
:name "(xval / xmax) * 255"
:precision binary64
(* (/ xval xmax) 255))