Development.Shake.Progress:message from shake-0.15.5

Percentage Accurate: 99.4% → 99.4%
Time: 7.3s
Alternatives: 8
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{x \cdot 100}{x + y} \end{array} \]
(FPCore (x y) :precision binary64 (/ (* x 100.0) (+ x y)))
double code(double x, double y) {
	return (x * 100.0) / (x + y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * 100.0d0) / (x + y)
end function
public static double code(double x, double y) {
	return (x * 100.0) / (x + y);
}
def code(x, y):
	return (x * 100.0) / (x + y)
function code(x, y)
	return Float64(Float64(x * 100.0) / Float64(x + y))
end
function tmp = code(x, y)
	tmp = (x * 100.0) / (x + y);
end
code[x_, y_] := N[(N[(x * 100.0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot 100}{x + y}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot 100}{x + y} \end{array} \]
(FPCore (x y) :precision binary64 (/ (* x 100.0) (+ x y)))
double code(double x, double y) {
	return (x * 100.0) / (x + y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * 100.0d0) / (x + y)
end function
public static double code(double x, double y) {
	return (x * 100.0) / (x + y);
}
def code(x, y):
	return (x * 100.0) / (x + y)
function code(x, y)
	return Float64(Float64(x * 100.0) / Float64(x + y))
end
function tmp = code(x, y)
	tmp = (x * 100.0) / (x + y);
end
code[x_, y_] := N[(N[(x * 100.0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot 100}{x + y}
\end{array}

Alternative 1: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x \cdot 100}{x + y} \end{array} \]
(FPCore (x y) :precision binary64 (/ (* x 100.0) (+ x y)))
double code(double x, double y) {
	return (x * 100.0) / (x + y);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * 100.0d0) / (x + y)
end function
public static double code(double x, double y) {
	return (x * 100.0) / (x + y);
}
def code(x, y):
	return (x * 100.0) / (x + y)
function code(x, y)
	return Float64(Float64(x * 100.0) / Float64(x + y))
end
function tmp = code(x, y)
	tmp = (x * 100.0) / (x + y);
end
code[x_, y_] := N[(N[(x * 100.0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot 100}{x + y}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{x \cdot 100}{x + y} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 98.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\ \;\;\;\;\frac{x \cdot 100}{y}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{-100}{x}, 100\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (/ (* x 100.0) (+ x y)) 0.0005)
   (/ (* x 100.0) y)
   (fma y (/ -100.0 x) 100.0)))
double code(double x, double y) {
	double tmp;
	if (((x * 100.0) / (x + y)) <= 0.0005) {
		tmp = (x * 100.0) / y;
	} else {
		tmp = fma(y, (-100.0 / x), 100.0);
	}
	return tmp;
}
function code(x, y)
	tmp = 0.0
	if (Float64(Float64(x * 100.0) / Float64(x + y)) <= 0.0005)
		tmp = Float64(Float64(x * 100.0) / y);
	else
		tmp = fma(y, Float64(-100.0 / x), 100.0);
	end
	return tmp
end
code[x_, y_] := If[LessEqual[N[(N[(x * 100.0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], 0.0005], N[(N[(x * 100.0), $MachinePrecision] / y), $MachinePrecision], N[(y * N[(-100.0 / x), $MachinePrecision] + 100.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\
\;\;\;\;\frac{x \cdot 100}{y}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{-100}{x}, 100\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x #s(literal 100 binary64)) (+.f64 x y)) < 5.0000000000000001e-4

    1. Initial program 99.7%

      \[\frac{x \cdot 100}{x + y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{100 \cdot \frac{x}{y}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{100 \cdot x}{y}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{100 \cdot x}{y}} \]
      3. lower-*.f6496.6

        \[\leadsto \frac{\color{blue}{100 \cdot x}}{y} \]
    5. Simplified96.6%

      \[\leadsto \color{blue}{\frac{100 \cdot x}{y}} \]

    if 5.0000000000000001e-4 < (/.f64 (*.f64 x #s(literal 100 binary64)) (+.f64 x y))

    1. Initial program 99.9%

      \[\frac{x \cdot 100}{x + y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{100 + -100 \cdot \frac{y}{x}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{-100 \cdot \frac{y}{x} + 100} \]
      2. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-100 \cdot y}{x}} + 100 \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y \cdot -100}}{x} + 100 \]
      4. associate-/l*N/A

        \[\leadsto \color{blue}{y \cdot \frac{-100}{x}} + 100 \]
      5. metadata-evalN/A

        \[\leadsto y \cdot \frac{\color{blue}{\mathsf{neg}\left(100\right)}}{x} + 100 \]
      6. distribute-neg-fracN/A

        \[\leadsto y \cdot \color{blue}{\left(\mathsf{neg}\left(\frac{100}{x}\right)\right)} + 100 \]
      7. metadata-evalN/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\frac{\color{blue}{100 \cdot 1}}{x}\right)\right) + 100 \]
      8. associate-*r/N/A

        \[\leadsto y \cdot \left(\mathsf{neg}\left(\color{blue}{100 \cdot \frac{1}{x}}\right)\right) + 100 \]
      9. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \mathsf{neg}\left(100 \cdot \frac{1}{x}\right), 100\right)} \]
      10. associate-*r/N/A

        \[\leadsto \mathsf{fma}\left(y, \mathsf{neg}\left(\color{blue}{\frac{100 \cdot 1}{x}}\right), 100\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y, \mathsf{neg}\left(\frac{\color{blue}{100}}{x}\right), 100\right) \]
      12. distribute-neg-fracN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{\mathsf{neg}\left(100\right)}{x}}, 100\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(y, \frac{\color{blue}{-100}}{x}, 100\right) \]
      14. lower-/.f64100.0

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{-100}{x}}, 100\right) \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{-100}{x}, 100\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\ \;\;\;\;\frac{x \cdot 100}{y}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{-100}{x}, 100\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\ \;\;\;\;\frac{x \cdot 100}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= (/ (* x 100.0) (+ x y)) 0.0005) (/ (* x 100.0) y) 100.0))
double code(double x, double y) {
	double tmp;
	if (((x * 100.0) / (x + y)) <= 0.0005) {
		tmp = (x * 100.0) / y;
	} else {
		tmp = 100.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (((x * 100.0d0) / (x + y)) <= 0.0005d0) then
        tmp = (x * 100.0d0) / y
    else
        tmp = 100.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (((x * 100.0) / (x + y)) <= 0.0005) {
		tmp = (x * 100.0) / y;
	} else {
		tmp = 100.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if ((x * 100.0) / (x + y)) <= 0.0005:
		tmp = (x * 100.0) / y
	else:
		tmp = 100.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (Float64(Float64(x * 100.0) / Float64(x + y)) <= 0.0005)
		tmp = Float64(Float64(x * 100.0) / y);
	else
		tmp = 100.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (((x * 100.0) / (x + y)) <= 0.0005)
		tmp = (x * 100.0) / y;
	else
		tmp = 100.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[N[(N[(x * 100.0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], 0.0005], N[(N[(x * 100.0), $MachinePrecision] / y), $MachinePrecision], 100.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\
\;\;\;\;\frac{x \cdot 100}{y}\\

\mathbf{else}:\\
\;\;\;\;100\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x #s(literal 100 binary64)) (+.f64 x y)) < 5.0000000000000001e-4

    1. Initial program 99.7%

      \[\frac{x \cdot 100}{x + y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{100 \cdot \frac{x}{y}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{100 \cdot x}{y}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{100 \cdot x}{y}} \]
      3. lower-*.f6496.6

        \[\leadsto \frac{\color{blue}{100 \cdot x}}{y} \]
    5. Simplified96.6%

      \[\leadsto \color{blue}{\frac{100 \cdot x}{y}} \]

    if 5.0000000000000001e-4 < (/.f64 (*.f64 x #s(literal 100 binary64)) (+.f64 x y))

    1. Initial program 99.9%

      \[\frac{x \cdot 100}{x + y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{100} \]
    4. Step-by-step derivation
      1. Simplified99.7%

        \[\leadsto \color{blue}{100} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification98.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\ \;\;\;\;\frac{x \cdot 100}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \]
    7. Add Preprocessing

    Alternative 4: 97.9% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\ \;\;\;\;\frac{x}{y \cdot 0.01}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \end{array} \]
    (FPCore (x y)
     :precision binary64
     (if (<= (/ (* x 100.0) (+ x y)) 0.0005) (/ x (* y 0.01)) 100.0))
    double code(double x, double y) {
    	double tmp;
    	if (((x * 100.0) / (x + y)) <= 0.0005) {
    		tmp = x / (y * 0.01);
    	} else {
    		tmp = 100.0;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8) :: tmp
        if (((x * 100.0d0) / (x + y)) <= 0.0005d0) then
            tmp = x / (y * 0.01d0)
        else
            tmp = 100.0d0
        end if
        code = tmp
    end function
    
    public static double code(double x, double y) {
    	double tmp;
    	if (((x * 100.0) / (x + y)) <= 0.0005) {
    		tmp = x / (y * 0.01);
    	} else {
    		tmp = 100.0;
    	}
    	return tmp;
    }
    
    def code(x, y):
    	tmp = 0
    	if ((x * 100.0) / (x + y)) <= 0.0005:
    		tmp = x / (y * 0.01)
    	else:
    		tmp = 100.0
    	return tmp
    
    function code(x, y)
    	tmp = 0.0
    	if (Float64(Float64(x * 100.0) / Float64(x + y)) <= 0.0005)
    		tmp = Float64(x / Float64(y * 0.01));
    	else
    		tmp = 100.0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y)
    	tmp = 0.0;
    	if (((x * 100.0) / (x + y)) <= 0.0005)
    		tmp = x / (y * 0.01);
    	else
    		tmp = 100.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_] := If[LessEqual[N[(N[(x * 100.0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], 0.0005], N[(x / N[(y * 0.01), $MachinePrecision]), $MachinePrecision], 100.0]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\
    \;\;\;\;\frac{x}{y \cdot 0.01}\\
    
    \mathbf{else}:\\
    \;\;\;\;100\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (/.f64 (*.f64 x #s(literal 100 binary64)) (+.f64 x y)) < 5.0000000000000001e-4

      1. Initial program 99.7%

        \[\frac{x \cdot 100}{x + y} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \frac{x \cdot 100}{\color{blue}{x + y}} \]
        2. associate-/l*N/A

          \[\leadsto \color{blue}{x \cdot \frac{100}{x + y}} \]
        3. clear-numN/A

          \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{x + y}{100}}} \]
        4. un-div-invN/A

          \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
        5. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x}{\frac{x + y}{100}}} \]
        6. div-invN/A

          \[\leadsto \frac{x}{\color{blue}{\left(x + y\right) \cdot \frac{1}{100}}} \]
        7. metadata-evalN/A

          \[\leadsto \frac{x}{\left(x + y\right) \cdot \color{blue}{\frac{1}{100}}} \]
        8. metadata-evalN/A

          \[\leadsto \frac{x}{\left(x + y\right) \cdot \color{blue}{\frac{-1}{-100}}} \]
        9. metadata-evalN/A

          \[\leadsto \frac{x}{\left(x + y\right) \cdot \frac{-1}{\color{blue}{\mathsf{neg}\left(100\right)}}} \]
        10. lower-*.f64N/A

          \[\leadsto \frac{x}{\color{blue}{\left(x + y\right) \cdot \frac{-1}{\mathsf{neg}\left(100\right)}}} \]
        11. metadata-evalN/A

          \[\leadsto \frac{x}{\left(x + y\right) \cdot \frac{-1}{\color{blue}{-100}}} \]
        12. metadata-eval99.7

          \[\leadsto \frac{x}{\left(x + y\right) \cdot \color{blue}{0.01}} \]
      4. Applied egg-rr99.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot 0.01}} \]
      5. Taylor expanded in x around 0

        \[\leadsto \frac{x}{\color{blue}{\frac{1}{100} \cdot y}} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1}{100}}} \]
        2. lower-*.f6496.6

          \[\leadsto \frac{x}{\color{blue}{y \cdot 0.01}} \]
      7. Simplified96.6%

        \[\leadsto \frac{x}{\color{blue}{y \cdot 0.01}} \]

      if 5.0000000000000001e-4 < (/.f64 (*.f64 x #s(literal 100 binary64)) (+.f64 x y))

      1. Initial program 99.9%

        \[\frac{x \cdot 100}{x + y} \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

        \[\leadsto \color{blue}{100} \]
      4. Step-by-step derivation
        1. Simplified99.7%

          \[\leadsto \color{blue}{100} \]
      5. Recombined 2 regimes into one program.
      6. Add Preprocessing

      Alternative 5: 97.9% accurate, 0.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\ \;\;\;\;x \cdot \frac{100}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \end{array} \]
      (FPCore (x y)
       :precision binary64
       (if (<= (/ (* x 100.0) (+ x y)) 0.0005) (* x (/ 100.0 y)) 100.0))
      double code(double x, double y) {
      	double tmp;
      	if (((x * 100.0) / (x + y)) <= 0.0005) {
      		tmp = x * (100.0 / y);
      	} else {
      		tmp = 100.0;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if (((x * 100.0d0) / (x + y)) <= 0.0005d0) then
              tmp = x * (100.0d0 / y)
          else
              tmp = 100.0d0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y) {
      	double tmp;
      	if (((x * 100.0) / (x + y)) <= 0.0005) {
      		tmp = x * (100.0 / y);
      	} else {
      		tmp = 100.0;
      	}
      	return tmp;
      }
      
      def code(x, y):
      	tmp = 0
      	if ((x * 100.0) / (x + y)) <= 0.0005:
      		tmp = x * (100.0 / y)
      	else:
      		tmp = 100.0
      	return tmp
      
      function code(x, y)
      	tmp = 0.0
      	if (Float64(Float64(x * 100.0) / Float64(x + y)) <= 0.0005)
      		tmp = Float64(x * Float64(100.0 / y));
      	else
      		tmp = 100.0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y)
      	tmp = 0.0;
      	if (((x * 100.0) / (x + y)) <= 0.0005)
      		tmp = x * (100.0 / y);
      	else
      		tmp = 100.0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_] := If[LessEqual[N[(N[(x * 100.0), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], 0.0005], N[(x * N[(100.0 / y), $MachinePrecision]), $MachinePrecision], 100.0]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\
      \;\;\;\;x \cdot \frac{100}{y}\\
      
      \mathbf{else}:\\
      \;\;\;\;100\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (/.f64 (*.f64 x #s(literal 100 binary64)) (+.f64 x y)) < 5.0000000000000001e-4

        1. Initial program 99.7%

          \[\frac{x \cdot 100}{x + y} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{100 \cdot x}}{x + y} \]
          2. lift-+.f64N/A

            \[\leadsto \frac{100 \cdot x}{\color{blue}{x + y}} \]
          3. associate-/l*N/A

            \[\leadsto \color{blue}{100 \cdot \frac{x}{x + y}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot 100} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot 100} \]
          6. lower-/.f6499.5

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot 100 \]
        4. Applied egg-rr99.5%

          \[\leadsto \color{blue}{\frac{x}{x + y} \cdot 100} \]
        5. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{x}{y}} \cdot 100 \]
        6. Step-by-step derivation
          1. lower-/.f6496.4

            \[\leadsto \color{blue}{\frac{x}{y}} \cdot 100 \]
        7. Simplified96.4%

          \[\leadsto \color{blue}{\frac{x}{y}} \cdot 100 \]
        8. Step-by-step derivation
          1. metadata-evalN/A

            \[\leadsto \frac{x}{y} \cdot \color{blue}{\frac{1}{\frac{1}{100}}} \]
          2. times-fracN/A

            \[\leadsto \color{blue}{\frac{x \cdot 1}{y \cdot \frac{1}{100}}} \]
          3. lift-*.f64N/A

            \[\leadsto \frac{x \cdot 1}{\color{blue}{y \cdot \frac{1}{100}}} \]
          4. associate-*r/N/A

            \[\leadsto \color{blue}{x \cdot \frac{1}{y \cdot \frac{1}{100}}} \]
          5. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{1}{y \cdot \frac{1}{100}} \cdot x} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{1}{y \cdot \frac{1}{100}} \cdot x} \]
          7. lift-*.f64N/A

            \[\leadsto \frac{1}{\color{blue}{y \cdot \frac{1}{100}}} \cdot x \]
          8. *-commutativeN/A

            \[\leadsto \frac{1}{\color{blue}{\frac{1}{100} \cdot y}} \cdot x \]
          9. associate-/r*N/A

            \[\leadsto \color{blue}{\frac{\frac{1}{\frac{1}{100}}}{y}} \cdot x \]
          10. metadata-evalN/A

            \[\leadsto \frac{\color{blue}{100}}{y} \cdot x \]
          11. lower-/.f6496.5

            \[\leadsto \color{blue}{\frac{100}{y}} \cdot x \]
        9. Applied egg-rr96.5%

          \[\leadsto \color{blue}{\frac{100}{y} \cdot x} \]

        if 5.0000000000000001e-4 < (/.f64 (*.f64 x #s(literal 100 binary64)) (+.f64 x y))

        1. Initial program 99.9%

          \[\frac{x \cdot 100}{x + y} \]
        2. Add Preprocessing
        3. Taylor expanded in x around inf

          \[\leadsto \color{blue}{100} \]
        4. Step-by-step derivation
          1. Simplified99.7%

            \[\leadsto \color{blue}{100} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification98.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot 100}{x + y} \leq 0.0005:\\ \;\;\;\;x \cdot \frac{100}{y}\\ \mathbf{else}:\\ \;\;\;\;100\\ \end{array} \]
        7. Add Preprocessing

        Alternative 6: 99.7% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ 100 \cdot \frac{x}{x + y} \end{array} \]
        (FPCore (x y) :precision binary64 (* 100.0 (/ x (+ x y))))
        double code(double x, double y) {
        	return 100.0 * (x / (x + y));
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = 100.0d0 * (x / (x + y))
        end function
        
        public static double code(double x, double y) {
        	return 100.0 * (x / (x + y));
        }
        
        def code(x, y):
        	return 100.0 * (x / (x + y))
        
        function code(x, y)
        	return Float64(100.0 * Float64(x / Float64(x + y)))
        end
        
        function tmp = code(x, y)
        	tmp = 100.0 * (x / (x + y));
        end
        
        code[x_, y_] := N[(100.0 * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        100 \cdot \frac{x}{x + y}
        \end{array}
        
        Derivation
        1. Initial program 99.8%

          \[\frac{x \cdot 100}{x + y} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{100 \cdot x}}{x + y} \]
          2. lift-+.f64N/A

            \[\leadsto \frac{100 \cdot x}{\color{blue}{x + y}} \]
          3. associate-/l*N/A

            \[\leadsto \color{blue}{100 \cdot \frac{x}{x + y}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot 100} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{x}{x + y} \cdot 100} \]
          6. lower-/.f6499.7

            \[\leadsto \color{blue}{\frac{x}{x + y}} \cdot 100 \]
        4. Applied egg-rr99.7%

          \[\leadsto \color{blue}{\frac{x}{x + y} \cdot 100} \]
        5. Final simplification99.7%

          \[\leadsto 100 \cdot \frac{x}{x + y} \]
        6. Add Preprocessing

        Alternative 7: 99.8% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ x \cdot \frac{100}{x + y} \end{array} \]
        (FPCore (x y) :precision binary64 (* x (/ 100.0 (+ x y))))
        double code(double x, double y) {
        	return x * (100.0 / (x + y));
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = x * (100.0d0 / (x + y))
        end function
        
        public static double code(double x, double y) {
        	return x * (100.0 / (x + y));
        }
        
        def code(x, y):
        	return x * (100.0 / (x + y))
        
        function code(x, y)
        	return Float64(x * Float64(100.0 / Float64(x + y)))
        end
        
        function tmp = code(x, y)
        	tmp = x * (100.0 / (x + y));
        end
        
        code[x_, y_] := N[(x * N[(100.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        x \cdot \frac{100}{x + y}
        \end{array}
        
        Derivation
        1. Initial program 99.8%

          \[\frac{x \cdot 100}{x + y} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{100 \cdot x}}{x + y} \]
          2. lift-+.f64N/A

            \[\leadsto \frac{100 \cdot x}{\color{blue}{x + y}} \]
          3. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{100}{x + y} \cdot x} \]
          4. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{100}{x + y} \cdot x} \]
          5. lower-/.f6499.7

            \[\leadsto \color{blue}{\frac{100}{x + y}} \cdot x \]
        4. Applied egg-rr99.7%

          \[\leadsto \color{blue}{\frac{100}{x + y} \cdot x} \]
        5. Final simplification99.7%

          \[\leadsto x \cdot \frac{100}{x + y} \]
        6. Add Preprocessing

        Alternative 8: 50.8% accurate, 20.0× speedup?

        \[\begin{array}{l} \\ 100 \end{array} \]
        (FPCore (x y) :precision binary64 100.0)
        double code(double x, double y) {
        	return 100.0;
        }
        
        real(8) function code(x, y)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = 100.0d0
        end function
        
        public static double code(double x, double y) {
        	return 100.0;
        }
        
        def code(x, y):
        	return 100.0
        
        function code(x, y)
        	return 100.0
        end
        
        function tmp = code(x, y)
        	tmp = 100.0;
        end
        
        code[x_, y_] := 100.0
        
        \begin{array}{l}
        
        \\
        100
        \end{array}
        
        Derivation
        1. Initial program 99.8%

          \[\frac{x \cdot 100}{x + y} \]
        2. Add Preprocessing
        3. Taylor expanded in x around inf

          \[\leadsto \color{blue}{100} \]
        4. Step-by-step derivation
          1. Simplified49.2%

            \[\leadsto \color{blue}{100} \]
          2. Add Preprocessing

          Developer Target 1: 99.8% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \frac{x}{1} \cdot \frac{100}{x + y} \end{array} \]
          (FPCore (x y) :precision binary64 (* (/ x 1.0) (/ 100.0 (+ x y))))
          double code(double x, double y) {
          	return (x / 1.0) * (100.0 / (x + y));
          }
          
          real(8) function code(x, y)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              code = (x / 1.0d0) * (100.0d0 / (x + y))
          end function
          
          public static double code(double x, double y) {
          	return (x / 1.0) * (100.0 / (x + y));
          }
          
          def code(x, y):
          	return (x / 1.0) * (100.0 / (x + y))
          
          function code(x, y)
          	return Float64(Float64(x / 1.0) * Float64(100.0 / Float64(x + y)))
          end
          
          function tmp = code(x, y)
          	tmp = (x / 1.0) * (100.0 / (x + y));
          end
          
          code[x_, y_] := N[(N[(x / 1.0), $MachinePrecision] * N[(100.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \frac{x}{1} \cdot \frac{100}{x + y}
          \end{array}
          

          Reproduce

          ?
          herbie shell --seed 2024207 
          (FPCore (x y)
            :name "Development.Shake.Progress:message from shake-0.15.5"
            :precision binary64
          
            :alt
            (! :herbie-platform default (* (/ x 1) (/ 100 (+ x y))))
          
            (/ (* x 100.0) (+ x y)))