Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4

Percentage Accurate: 99.9% → 99.9%
Time: 5.6s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
	return ((((x + y) + y) + x) + z) + x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((((x + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
	return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z):
	return ((((x + y) + y) + x) + z) + x
function code(x, y, z)
	return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x)
end
function tmp = code(x, y, z)
	tmp = ((((x + y) + y) + x) + z) + x;
end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\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 10 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.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ (+ (+ (+ x y) y) x) z) x))
double code(double x, double y, double z) {
	return ((((x + y) + y) + x) + z) + x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((((x + y) + y) + x) + z) + x
end function
public static double code(double x, double y, double z) {
	return ((((x + y) + y) + x) + z) + x;
}
def code(x, y, z):
	return ((((x + y) + y) + x) + z) + x
function code(x, y, z)
	return Float64(Float64(Float64(Float64(Float64(x + y) + y) + x) + z) + x)
end
function tmp = code(x, y, z)
	tmp = ((((x + y) + y) + x) + z) + x;
end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision] + z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(z + \left(\left(\left(y + x\right) + y\right) + x\right)\right) + x \end{array} \]
(FPCore (x y z) :precision binary64 (+ (+ z (+ (+ (+ y x) y) x)) x))
double code(double x, double y, double z) {
	return (z + (((y + x) + y) + x)) + x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = (z + (((y + x) + y) + x)) + x
end function
public static double code(double x, double y, double z) {
	return (z + (((y + x) + y) + x)) + x;
}
def code(x, y, z):
	return (z + (((y + x) + y) + x)) + x
function code(x, y, z)
	return Float64(Float64(z + Float64(Float64(Float64(y + x) + y) + x)) + x)
end
function tmp = code(x, y, z)
	tmp = (z + (((y + x) + y) + x)) + x;
end
code[x_, y_, z_] := N[(N[(z + N[(N[(N[(y + x), $MachinePrecision] + y), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\left(z + \left(\left(\left(y + x\right) + y\right) + x\right)\right) + x
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
  2. Add Preprocessing
  3. Final simplification99.9%

    \[\leadsto \left(z + \left(\left(\left(y + x\right) + y\right) + x\right)\right) + x \]
  4. Add Preprocessing

Alternative 2: 85.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+55}:\\ \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-30}:\\ \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z + y\right) + \left(y + x\right)\right) + x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -4.1e+55)
   (fma 3.0 x z)
   (if (<= z 2.65e-30) (fma 3.0 x (+ y y)) (+ (+ (+ z y) (+ y x)) x))))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -4.1e+55) {
		tmp = fma(3.0, x, z);
	} else if (z <= 2.65e-30) {
		tmp = fma(3.0, x, (y + y));
	} else {
		tmp = ((z + y) + (y + x)) + x;
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (z <= -4.1e+55)
		tmp = fma(3.0, x, z);
	elseif (z <= 2.65e-30)
		tmp = fma(3.0, x, Float64(y + y));
	else
		tmp = Float64(Float64(Float64(z + y) + Float64(y + x)) + x);
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[z, -4.1e+55], N[(3.0 * x + z), $MachinePrecision], If[LessEqual[z, 2.65e-30], N[(3.0 * x + N[(y + y), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z + y), $MachinePrecision] + N[(y + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+55}:\\
\;\;\;\;\mathsf{fma}\left(3, x, z\right)\\

\mathbf{elif}\;z \leq 2.65 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(z + y\right) + \left(y + x\right)\right) + x\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.09999999999999981e55

    1. Initial program 100.0%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{x + \left(z + 2 \cdot x\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto x + \color{blue}{\left(2 \cdot x + z\right)} \]
      2. associate-+r+N/A

        \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + z} \]
      3. distribute-rgt1-inN/A

        \[\leadsto \color{blue}{\left(2 + 1\right) \cdot x} + z \]
      4. metadata-evalN/A

        \[\leadsto \color{blue}{3} \cdot x + z \]
      5. lower-fma.f6486.1

        \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, z\right)} \]
    5. Applied rewrites86.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, z\right)} \]

    if -4.09999999999999981e55 < z < 2.64999999999999987e-30

    1. Initial program 99.8%

      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
    4. Step-by-step derivation
      1. associate-+r+N/A

        \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
      2. distribute-rgt1-inN/A

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

        \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
      4. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
      5. lower-*.f6493.6

        \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
    5. Applied rewrites93.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites93.6%

        \[\leadsto \mathsf{fma}\left(3, x, y + y\right) \]

      if 2.64999999999999987e-30 < z

      1. Initial program 100.0%

        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-+.f64N/A

          \[\leadsto \color{blue}{\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right)} + x \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
        3. lift-+.f64N/A

          \[\leadsto \left(z + \color{blue}{\left(\left(\left(x + y\right) + y\right) + x\right)}\right) + x \]
        4. lift-+.f64N/A

          \[\leadsto \left(z + \left(\color{blue}{\left(\left(x + y\right) + y\right)} + x\right)\right) + x \]
        5. associate-+l+N/A

          \[\leadsto \left(z + \color{blue}{\left(\left(x + y\right) + \left(y + x\right)\right)}\right) + x \]
        6. +-commutativeN/A

          \[\leadsto \left(z + \left(\left(x + y\right) + \color{blue}{\left(x + y\right)}\right)\right) + x \]
        7. lift-+.f64N/A

          \[\leadsto \left(z + \left(\left(x + y\right) + \color{blue}{\left(x + y\right)}\right)\right) + x \]
        8. associate-+r+N/A

          \[\leadsto \color{blue}{\left(\left(z + \left(x + y\right)\right) + \left(x + y\right)\right)} + x \]
        9. lower-+.f64N/A

          \[\leadsto \color{blue}{\left(\left(z + \left(x + y\right)\right) + \left(x + y\right)\right)} + x \]
        10. lower-+.f64100.0

          \[\leadsto \left(\color{blue}{\left(z + \left(x + y\right)\right)} + \left(x + y\right)\right) + x \]
        11. lift-+.f64N/A

          \[\leadsto \left(\left(z + \color{blue}{\left(x + y\right)}\right) + \left(x + y\right)\right) + x \]
        12. +-commutativeN/A

          \[\leadsto \left(\left(z + \color{blue}{\left(y + x\right)}\right) + \left(x + y\right)\right) + x \]
        13. lower-+.f64100.0

          \[\leadsto \left(\left(z + \color{blue}{\left(y + x\right)}\right) + \left(x + y\right)\right) + x \]
        14. lift-+.f64N/A

          \[\leadsto \left(\left(z + \left(y + x\right)\right) + \color{blue}{\left(x + y\right)}\right) + x \]
        15. +-commutativeN/A

          \[\leadsto \left(\left(z + \left(y + x\right)\right) + \color{blue}{\left(y + x\right)}\right) + x \]
        16. lower-+.f64100.0

          \[\leadsto \left(\left(z + \left(y + x\right)\right) + \color{blue}{\left(y + x\right)}\right) + x \]
      4. Applied rewrites100.0%

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

        \[\leadsto \left(\color{blue}{\left(y + z\right)} + \left(y + x\right)\right) + x \]
      6. Step-by-step derivation
        1. lower-+.f6495.4

          \[\leadsto \left(\color{blue}{\left(y + z\right)} + \left(y + x\right)\right) + x \]
      7. Applied rewrites95.4%

        \[\leadsto \left(\color{blue}{\left(y + z\right)} + \left(y + x\right)\right) + x \]
    7. Recombined 3 regimes into one program.
    8. Final simplification92.6%

      \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+55}:\\ \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\ \mathbf{elif}\;z \leq 2.65 \cdot 10^{-30}:\\ \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(z + y\right) + \left(y + x\right)\right) + x\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 85.5% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+55}:\\ \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-30}:\\ \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right) + x\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (if (<= z -4.1e+55)
       (fma 3.0 x z)
       (if (<= z 6e-30) (fma 3.0 x (+ y y)) (+ (fma 2.0 y z) x))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (z <= -4.1e+55) {
    		tmp = fma(3.0, x, z);
    	} else if (z <= 6e-30) {
    		tmp = fma(3.0, x, (y + y));
    	} else {
    		tmp = fma(2.0, y, z) + x;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (z <= -4.1e+55)
    		tmp = fma(3.0, x, z);
    	elseif (z <= 6e-30)
    		tmp = fma(3.0, x, Float64(y + y));
    	else
    		tmp = Float64(fma(2.0, y, z) + x);
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[z, -4.1e+55], N[(3.0 * x + z), $MachinePrecision], If[LessEqual[z, 6e-30], N[(3.0 * x + N[(y + y), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * y + z), $MachinePrecision] + x), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;z \leq -4.1 \cdot 10^{+55}:\\
    \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\
    
    \mathbf{elif}\;z \leq 6 \cdot 10^{-30}:\\
    \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(2, y, z\right) + x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if z < -4.09999999999999981e55

      1. Initial program 100.0%

        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{x + \left(z + 2 \cdot x\right)} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto x + \color{blue}{\left(2 \cdot x + z\right)} \]
        2. associate-+r+N/A

          \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + z} \]
        3. distribute-rgt1-inN/A

          \[\leadsto \color{blue}{\left(2 + 1\right) \cdot x} + z \]
        4. metadata-evalN/A

          \[\leadsto \color{blue}{3} \cdot x + z \]
        5. lower-fma.f6486.1

          \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, z\right)} \]
      5. Applied rewrites86.1%

        \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, z\right)} \]

      if -4.09999999999999981e55 < z < 5.9999999999999998e-30

      1. Initial program 99.8%

        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
      2. Add Preprocessing
      3. Taylor expanded in z around 0

        \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
      4. Step-by-step derivation
        1. associate-+r+N/A

          \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
        2. distribute-rgt1-inN/A

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

          \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
        4. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
        5. lower-*.f6493.6

          \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
      5. Applied rewrites93.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
      6. Step-by-step derivation
        1. Applied rewrites93.6%

          \[\leadsto \mathsf{fma}\left(3, x, y + y\right) \]

        if 5.9999999999999998e-30 < z

        1. Initial program 100.0%

          \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\left(z + 2 \cdot y\right)} + x \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{\left(2 \cdot y + z\right)} + x \]
          2. lower-fma.f6495.3

            \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} + x \]
        5. Applied rewrites95.3%

          \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} + x \]
      7. Recombined 3 regimes into one program.
      8. Add Preprocessing

      Alternative 4: 84.6% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -4.1 \cdot 10^{+55}:\\ \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-30}:\\ \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z + y\right) + y\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (if (<= z -4.1e+55)
         (fma 3.0 x z)
         (if (<= z 6e-30) (fma 3.0 x (+ y y)) (+ (+ z y) y))))
      double code(double x, double y, double z) {
      	double tmp;
      	if (z <= -4.1e+55) {
      		tmp = fma(3.0, x, z);
      	} else if (z <= 6e-30) {
      		tmp = fma(3.0, x, (y + y));
      	} else {
      		tmp = (z + y) + y;
      	}
      	return tmp;
      }
      
      function code(x, y, z)
      	tmp = 0.0
      	if (z <= -4.1e+55)
      		tmp = fma(3.0, x, z);
      	elseif (z <= 6e-30)
      		tmp = fma(3.0, x, Float64(y + y));
      	else
      		tmp = Float64(Float64(z + y) + y);
      	end
      	return tmp
      end
      
      code[x_, y_, z_] := If[LessEqual[z, -4.1e+55], N[(3.0 * x + z), $MachinePrecision], If[LessEqual[z, 6e-30], N[(3.0 * x + N[(y + y), $MachinePrecision]), $MachinePrecision], N[(N[(z + y), $MachinePrecision] + y), $MachinePrecision]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;z \leq -4.1 \cdot 10^{+55}:\\
      \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\
      
      \mathbf{elif}\;z \leq 6 \cdot 10^{-30}:\\
      \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(z + y\right) + y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if z < -4.09999999999999981e55

        1. Initial program 100.0%

          \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
        2. Add Preprocessing
        3. Taylor expanded in y around 0

          \[\leadsto \color{blue}{x + \left(z + 2 \cdot x\right)} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto x + \color{blue}{\left(2 \cdot x + z\right)} \]
          2. associate-+r+N/A

            \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + z} \]
          3. distribute-rgt1-inN/A

            \[\leadsto \color{blue}{\left(2 + 1\right) \cdot x} + z \]
          4. metadata-evalN/A

            \[\leadsto \color{blue}{3} \cdot x + z \]
          5. lower-fma.f6486.1

            \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, z\right)} \]
        5. Applied rewrites86.1%

          \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, z\right)} \]

        if -4.09999999999999981e55 < z < 5.9999999999999998e-30

        1. Initial program 99.8%

          \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
        2. Add Preprocessing
        3. Taylor expanded in z around 0

          \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
        4. Step-by-step derivation
          1. associate-+r+N/A

            \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
          2. distribute-rgt1-inN/A

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

            \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
          4. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
          5. lower-*.f6493.6

            \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
        5. Applied rewrites93.6%

          \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
        6. Step-by-step derivation
          1. Applied rewrites93.6%

            \[\leadsto \mathsf{fma}\left(3, x, y + y\right) \]

          if 5.9999999999999998e-30 < z

          1. Initial program 100.0%

            \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
          2. Add Preprocessing
          3. Taylor expanded in z around 0

            \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
          4. Step-by-step derivation
            1. associate-+r+N/A

              \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
            2. distribute-rgt1-inN/A

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

              \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
            4. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
            5. lower-*.f6429.0

              \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
          5. Applied rewrites29.0%

            \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
          6. Taylor expanded in x around 0

            \[\leadsto 2 \cdot \color{blue}{y} \]
          7. Step-by-step derivation
            1. Applied rewrites24.3%

              \[\leadsto 2 \cdot \color{blue}{y} \]
            2. Taylor expanded in x around 0

              \[\leadsto \color{blue}{z + 2 \cdot y} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \color{blue}{2 \cdot y + z} \]
              2. lower-fma.f6494.6

                \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
            4. Applied rewrites94.6%

              \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
            5. Step-by-step derivation
              1. Applied rewrites94.6%

                \[\leadsto \left(z + y\right) + \color{blue}{y} \]
            6. Recombined 3 regimes into one program.
            7. Add Preprocessing

            Alternative 5: 85.8% accurate, 0.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.4 \cdot 10^{+56}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\ \mathbf{elif}\;y \leq 2.95 \cdot 10^{+54}:\\ \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\ \mathbf{else}:\\ \;\;\;\;\left(z + y\right) + y\\ \end{array} \end{array} \]
            (FPCore (x y z)
             :precision binary64
             (if (<= y -7.4e+56)
               (fma 2.0 y z)
               (if (<= y 2.95e+54) (fma 3.0 x z) (+ (+ z y) y))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= -7.4e+56) {
            		tmp = fma(2.0, y, z);
            	} else if (y <= 2.95e+54) {
            		tmp = fma(3.0, x, z);
            	} else {
            		tmp = (z + y) + y;
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= -7.4e+56)
            		tmp = fma(2.0, y, z);
            	elseif (y <= 2.95e+54)
            		tmp = fma(3.0, x, z);
            	else
            		tmp = Float64(Float64(z + y) + y);
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[y, -7.4e+56], N[(2.0 * y + z), $MachinePrecision], If[LessEqual[y, 2.95e+54], N[(3.0 * x + z), $MachinePrecision], N[(N[(z + y), $MachinePrecision] + y), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;y \leq -7.4 \cdot 10^{+56}:\\
            \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\
            
            \mathbf{elif}\;y \leq 2.95 \cdot 10^{+54}:\\
            \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(z + y\right) + y\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if y < -7.39999999999999994e56

              1. Initial program 99.9%

                \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
              2. Add Preprocessing
              3. Taylor expanded in z around 0

                \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
              4. Step-by-step derivation
                1. associate-+r+N/A

                  \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
                2. distribute-rgt1-inN/A

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

                  \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
                4. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                5. lower-*.f6482.5

                  \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
              5. Applied rewrites82.5%

                \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
              6. Taylor expanded in x around 0

                \[\leadsto 2 \cdot \color{blue}{y} \]
              7. Step-by-step derivation
                1. Applied rewrites72.1%

                  \[\leadsto 2 \cdot \color{blue}{y} \]
                2. Taylor expanded in x around 0

                  \[\leadsto \color{blue}{z + 2 \cdot y} \]
                3. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \color{blue}{2 \cdot y + z} \]
                  2. lower-fma.f6489.6

                    \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
                4. Applied rewrites89.6%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]

                if -7.39999999999999994e56 < y < 2.9499999999999999e54

                1. Initial program 99.9%

                  \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                2. Add Preprocessing
                3. Taylor expanded in y around 0

                  \[\leadsto \color{blue}{x + \left(z + 2 \cdot x\right)} \]
                4. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto x + \color{blue}{\left(2 \cdot x + z\right)} \]
                  2. associate-+r+N/A

                    \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + z} \]
                  3. distribute-rgt1-inN/A

                    \[\leadsto \color{blue}{\left(2 + 1\right) \cdot x} + z \]
                  4. metadata-evalN/A

                    \[\leadsto \color{blue}{3} \cdot x + z \]
                  5. lower-fma.f6492.1

                    \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, z\right)} \]
                5. Applied rewrites92.1%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, z\right)} \]

                if 2.9499999999999999e54 < y

                1. Initial program 99.9%

                  \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                2. Add Preprocessing
                3. Taylor expanded in z around 0

                  \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
                4. Step-by-step derivation
                  1. associate-+r+N/A

                    \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
                  2. distribute-rgt1-inN/A

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

                    \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
                  4. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                  5. lower-*.f6486.1

                    \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
                5. Applied rewrites86.1%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                6. Taylor expanded in x around 0

                  \[\leadsto 2 \cdot \color{blue}{y} \]
                7. Step-by-step derivation
                  1. Applied rewrites69.3%

                    \[\leadsto 2 \cdot \color{blue}{y} \]
                  2. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{z + 2 \cdot y} \]
                  3. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{2 \cdot y + z} \]
                    2. lower-fma.f6483.1

                      \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
                  4. Applied rewrites83.1%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
                  5. Step-by-step derivation
                    1. Applied rewrites83.1%

                      \[\leadsto \left(z + y\right) + \color{blue}{y} \]
                  6. Recombined 3 regimes into one program.
                  7. Add Preprocessing

                  Alternative 6: 79.7% accurate, 0.8× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+139}:\\ \;\;\;\;3 \cdot x\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{+91}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\ \mathbf{else}:\\ \;\;\;\;3 \cdot x\\ \end{array} \end{array} \]
                  (FPCore (x y z)
                   :precision binary64
                   (if (<= x -5.5e+139) (* 3.0 x) (if (<= x 1.55e+91) (fma 2.0 y z) (* 3.0 x))))
                  double code(double x, double y, double z) {
                  	double tmp;
                  	if (x <= -5.5e+139) {
                  		tmp = 3.0 * x;
                  	} else if (x <= 1.55e+91) {
                  		tmp = fma(2.0, y, z);
                  	} else {
                  		tmp = 3.0 * x;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, y, z)
                  	tmp = 0.0
                  	if (x <= -5.5e+139)
                  		tmp = Float64(3.0 * x);
                  	elseif (x <= 1.55e+91)
                  		tmp = fma(2.0, y, z);
                  	else
                  		tmp = Float64(3.0 * x);
                  	end
                  	return tmp
                  end
                  
                  code[x_, y_, z_] := If[LessEqual[x, -5.5e+139], N[(3.0 * x), $MachinePrecision], If[LessEqual[x, 1.55e+91], N[(2.0 * y + z), $MachinePrecision], N[(3.0 * x), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -5.5 \cdot 10^{+139}:\\
                  \;\;\;\;3 \cdot x\\
                  
                  \mathbf{elif}\;x \leq 1.55 \cdot 10^{+91}:\\
                  \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;3 \cdot x\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if x < -5.4999999999999996e139 or 1.54999999999999999e91 < x

                    1. Initial program 99.7%

                      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                    2. Add Preprocessing
                    3. Taylor expanded in x around inf

                      \[\leadsto \color{blue}{3 \cdot x} \]
                    4. Step-by-step derivation
                      1. lower-*.f6473.6

                        \[\leadsto \color{blue}{3 \cdot x} \]
                    5. Applied rewrites73.6%

                      \[\leadsto \color{blue}{3 \cdot x} \]

                    if -5.4999999999999996e139 < x < 1.54999999999999999e91

                    1. Initial program 100.0%

                      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                    2. Add Preprocessing
                    3. Taylor expanded in z around 0

                      \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
                    4. Step-by-step derivation
                      1. associate-+r+N/A

                        \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
                      2. distribute-rgt1-inN/A

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

                        \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
                      4. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                      5. lower-*.f6452.3

                        \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
                    5. Applied rewrites52.3%

                      \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                    6. Taylor expanded in x around 0

                      \[\leadsto 2 \cdot \color{blue}{y} \]
                    7. Step-by-step derivation
                      1. Applied rewrites39.8%

                        \[\leadsto 2 \cdot \color{blue}{y} \]
                      2. Taylor expanded in x around 0

                        \[\leadsto \color{blue}{z + 2 \cdot y} \]
                      3. Step-by-step derivation
                        1. +-commutativeN/A

                          \[\leadsto \color{blue}{2 \cdot y + z} \]
                        2. lower-fma.f6487.5

                          \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
                      4. Applied rewrites87.5%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
                    8. Recombined 2 regimes into one program.
                    9. Add Preprocessing

                    Alternative 7: 79.7% accurate, 0.8× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.5 \cdot 10^{+139}:\\ \;\;\;\;3 \cdot x\\ \mathbf{elif}\;x \leq 1.55 \cdot 10^{+91}:\\ \;\;\;\;\left(z + y\right) + y\\ \mathbf{else}:\\ \;\;\;\;3 \cdot x\\ \end{array} \end{array} \]
                    (FPCore (x y z)
                     :precision binary64
                     (if (<= x -5.5e+139) (* 3.0 x) (if (<= x 1.55e+91) (+ (+ z y) y) (* 3.0 x))))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (x <= -5.5e+139) {
                    		tmp = 3.0 * x;
                    	} else if (x <= 1.55e+91) {
                    		tmp = (z + y) + y;
                    	} else {
                    		tmp = 3.0 * x;
                    	}
                    	return tmp;
                    }
                    
                    real(8) function code(x, y, z)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        real(8), intent (in) :: z
                        real(8) :: tmp
                        if (x <= (-5.5d+139)) then
                            tmp = 3.0d0 * x
                        else if (x <= 1.55d+91) then
                            tmp = (z + y) + y
                        else
                            tmp = 3.0d0 * x
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double x, double y, double z) {
                    	double tmp;
                    	if (x <= -5.5e+139) {
                    		tmp = 3.0 * x;
                    	} else if (x <= 1.55e+91) {
                    		tmp = (z + y) + y;
                    	} else {
                    		tmp = 3.0 * x;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z):
                    	tmp = 0
                    	if x <= -5.5e+139:
                    		tmp = 3.0 * x
                    	elif x <= 1.55e+91:
                    		tmp = (z + y) + y
                    	else:
                    		tmp = 3.0 * x
                    	return tmp
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (x <= -5.5e+139)
                    		tmp = Float64(3.0 * x);
                    	elseif (x <= 1.55e+91)
                    		tmp = Float64(Float64(z + y) + y);
                    	else
                    		tmp = Float64(3.0 * x);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z)
                    	tmp = 0.0;
                    	if (x <= -5.5e+139)
                    		tmp = 3.0 * x;
                    	elseif (x <= 1.55e+91)
                    		tmp = (z + y) + y;
                    	else
                    		tmp = 3.0 * x;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[x, -5.5e+139], N[(3.0 * x), $MachinePrecision], If[LessEqual[x, 1.55e+91], N[(N[(z + y), $MachinePrecision] + y), $MachinePrecision], N[(3.0 * x), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;x \leq -5.5 \cdot 10^{+139}:\\
                    \;\;\;\;3 \cdot x\\
                    
                    \mathbf{elif}\;x \leq 1.55 \cdot 10^{+91}:\\
                    \;\;\;\;\left(z + y\right) + y\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;3 \cdot x\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if x < -5.4999999999999996e139 or 1.54999999999999999e91 < x

                      1. Initial program 99.7%

                        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                      2. Add Preprocessing
                      3. Taylor expanded in x around inf

                        \[\leadsto \color{blue}{3 \cdot x} \]
                      4. Step-by-step derivation
                        1. lower-*.f6473.6

                          \[\leadsto \color{blue}{3 \cdot x} \]
                      5. Applied rewrites73.6%

                        \[\leadsto \color{blue}{3 \cdot x} \]

                      if -5.4999999999999996e139 < x < 1.54999999999999999e91

                      1. Initial program 100.0%

                        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                      2. Add Preprocessing
                      3. Taylor expanded in z around 0

                        \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
                      4. Step-by-step derivation
                        1. associate-+r+N/A

                          \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
                        2. distribute-rgt1-inN/A

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

                          \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
                        4. lower-fma.f64N/A

                          \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                        5. lower-*.f6452.3

                          \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
                      5. Applied rewrites52.3%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                      6. Taylor expanded in x around 0

                        \[\leadsto 2 \cdot \color{blue}{y} \]
                      7. Step-by-step derivation
                        1. Applied rewrites39.8%

                          \[\leadsto 2 \cdot \color{blue}{y} \]
                        2. Taylor expanded in x around 0

                          \[\leadsto \color{blue}{z + 2 \cdot y} \]
                        3. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto \color{blue}{2 \cdot y + z} \]
                          2. lower-fma.f6487.5

                            \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
                        4. Applied rewrites87.5%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(2, y, z\right)} \]
                        5. Step-by-step derivation
                          1. Applied rewrites87.5%

                            \[\leadsto \left(z + y\right) + \color{blue}{y} \]
                        6. Recombined 2 regimes into one program.
                        7. Add Preprocessing

                        Alternative 8: 54.0% accurate, 0.9× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -7.4 \cdot 10^{+56}:\\ \;\;\;\;y + y\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+57}:\\ \;\;\;\;3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;y + y\\ \end{array} \end{array} \]
                        (FPCore (x y z)
                         :precision binary64
                         (if (<= y -7.4e+56) (+ y y) (if (<= y 3.2e+57) (* 3.0 x) (+ y y))))
                        double code(double x, double y, double z) {
                        	double tmp;
                        	if (y <= -7.4e+56) {
                        		tmp = y + y;
                        	} else if (y <= 3.2e+57) {
                        		tmp = 3.0 * x;
                        	} else {
                        		tmp = y + y;
                        	}
                        	return tmp;
                        }
                        
                        real(8) function code(x, y, z)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            real(8), intent (in) :: z
                            real(8) :: tmp
                            if (y <= (-7.4d+56)) then
                                tmp = y + y
                            else if (y <= 3.2d+57) then
                                tmp = 3.0d0 * x
                            else
                                tmp = y + y
                            end if
                            code = tmp
                        end function
                        
                        public static double code(double x, double y, double z) {
                        	double tmp;
                        	if (y <= -7.4e+56) {
                        		tmp = y + y;
                        	} else if (y <= 3.2e+57) {
                        		tmp = 3.0 * x;
                        	} else {
                        		tmp = y + y;
                        	}
                        	return tmp;
                        }
                        
                        def code(x, y, z):
                        	tmp = 0
                        	if y <= -7.4e+56:
                        		tmp = y + y
                        	elif y <= 3.2e+57:
                        		tmp = 3.0 * x
                        	else:
                        		tmp = y + y
                        	return tmp
                        
                        function code(x, y, z)
                        	tmp = 0.0
                        	if (y <= -7.4e+56)
                        		tmp = Float64(y + y);
                        	elseif (y <= 3.2e+57)
                        		tmp = Float64(3.0 * x);
                        	else
                        		tmp = Float64(y + y);
                        	end
                        	return tmp
                        end
                        
                        function tmp_2 = code(x, y, z)
                        	tmp = 0.0;
                        	if (y <= -7.4e+56)
                        		tmp = y + y;
                        	elseif (y <= 3.2e+57)
                        		tmp = 3.0 * x;
                        	else
                        		tmp = y + y;
                        	end
                        	tmp_2 = tmp;
                        end
                        
                        code[x_, y_, z_] := If[LessEqual[y, -7.4e+56], N[(y + y), $MachinePrecision], If[LessEqual[y, 3.2e+57], N[(3.0 * x), $MachinePrecision], N[(y + y), $MachinePrecision]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;y \leq -7.4 \cdot 10^{+56}:\\
                        \;\;\;\;y + y\\
                        
                        \mathbf{elif}\;y \leq 3.2 \cdot 10^{+57}:\\
                        \;\;\;\;3 \cdot x\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;y + y\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 2 regimes
                        2. if y < -7.39999999999999994e56 or 3.20000000000000029e57 < y

                          1. Initial program 99.9%

                            \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                          2. Add Preprocessing
                          3. Taylor expanded in z around 0

                            \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
                          4. Step-by-step derivation
                            1. associate-+r+N/A

                              \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
                            2. distribute-rgt1-inN/A

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

                              \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
                            4. lower-fma.f64N/A

                              \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                            5. lower-*.f6485.0

                              \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
                          5. Applied rewrites85.0%

                            \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                          6. Taylor expanded in x around 0

                            \[\leadsto 2 \cdot \color{blue}{y} \]
                          7. Step-by-step derivation
                            1. Applied rewrites71.6%

                              \[\leadsto 2 \cdot \color{blue}{y} \]
                            2. Step-by-step derivation
                              1. Applied rewrites71.6%

                                \[\leadsto y + y \]

                              if -7.39999999999999994e56 < y < 3.20000000000000029e57

                              1. Initial program 99.9%

                                \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                              2. Add Preprocessing
                              3. Taylor expanded in x around inf

                                \[\leadsto \color{blue}{3 \cdot x} \]
                              4. Step-by-step derivation
                                1. lower-*.f6444.2

                                  \[\leadsto \color{blue}{3 \cdot x} \]
                              5. Applied rewrites44.2%

                                \[\leadsto \color{blue}{3 \cdot x} \]
                            3. Recombined 2 regimes into one program.
                            4. Add Preprocessing

                            Alternative 9: 99.9% accurate, 1.0× speedup?

                            \[\begin{array}{l} \\ \left(\left(\left(y + x\right) + z\right) + \left(y + x\right)\right) + x \end{array} \]
                            (FPCore (x y z) :precision binary64 (+ (+ (+ (+ y x) z) (+ y x)) x))
                            double code(double x, double y, double z) {
                            	return (((y + x) + z) + (y + x)) + x;
                            }
                            
                            real(8) function code(x, y, z)
                                real(8), intent (in) :: x
                                real(8), intent (in) :: y
                                real(8), intent (in) :: z
                                code = (((y + x) + z) + (y + x)) + x
                            end function
                            
                            public static double code(double x, double y, double z) {
                            	return (((y + x) + z) + (y + x)) + x;
                            }
                            
                            def code(x, y, z):
                            	return (((y + x) + z) + (y + x)) + x
                            
                            function code(x, y, z)
                            	return Float64(Float64(Float64(Float64(y + x) + z) + Float64(y + x)) + x)
                            end
                            
                            function tmp = code(x, y, z)
                            	tmp = (((y + x) + z) + (y + x)) + x;
                            end
                            
                            code[x_, y_, z_] := N[(N[(N[(N[(y + x), $MachinePrecision] + z), $MachinePrecision] + N[(y + x), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
                            
                            \begin{array}{l}
                            
                            \\
                            \left(\left(\left(y + x\right) + z\right) + \left(y + x\right)\right) + x
                            \end{array}
                            
                            Derivation
                            1. Initial program 99.9%

                              \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                            2. Add Preprocessing
                            3. Step-by-step derivation
                              1. lift-+.f64N/A

                                \[\leadsto \color{blue}{\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right)} + x \]
                              2. +-commutativeN/A

                                \[\leadsto \color{blue}{\left(z + \left(\left(\left(x + y\right) + y\right) + x\right)\right)} + x \]
                              3. lift-+.f64N/A

                                \[\leadsto \left(z + \color{blue}{\left(\left(\left(x + y\right) + y\right) + x\right)}\right) + x \]
                              4. lift-+.f64N/A

                                \[\leadsto \left(z + \left(\color{blue}{\left(\left(x + y\right) + y\right)} + x\right)\right) + x \]
                              5. associate-+l+N/A

                                \[\leadsto \left(z + \color{blue}{\left(\left(x + y\right) + \left(y + x\right)\right)}\right) + x \]
                              6. +-commutativeN/A

                                \[\leadsto \left(z + \left(\left(x + y\right) + \color{blue}{\left(x + y\right)}\right)\right) + x \]
                              7. lift-+.f64N/A

                                \[\leadsto \left(z + \left(\left(x + y\right) + \color{blue}{\left(x + y\right)}\right)\right) + x \]
                              8. associate-+r+N/A

                                \[\leadsto \color{blue}{\left(\left(z + \left(x + y\right)\right) + \left(x + y\right)\right)} + x \]
                              9. lower-+.f64N/A

                                \[\leadsto \color{blue}{\left(\left(z + \left(x + y\right)\right) + \left(x + y\right)\right)} + x \]
                              10. lower-+.f6499.9

                                \[\leadsto \left(\color{blue}{\left(z + \left(x + y\right)\right)} + \left(x + y\right)\right) + x \]
                              11. lift-+.f64N/A

                                \[\leadsto \left(\left(z + \color{blue}{\left(x + y\right)}\right) + \left(x + y\right)\right) + x \]
                              12. +-commutativeN/A

                                \[\leadsto \left(\left(z + \color{blue}{\left(y + x\right)}\right) + \left(x + y\right)\right) + x \]
                              13. lower-+.f6499.9

                                \[\leadsto \left(\left(z + \color{blue}{\left(y + x\right)}\right) + \left(x + y\right)\right) + x \]
                              14. lift-+.f64N/A

                                \[\leadsto \left(\left(z + \left(y + x\right)\right) + \color{blue}{\left(x + y\right)}\right) + x \]
                              15. +-commutativeN/A

                                \[\leadsto \left(\left(z + \left(y + x\right)\right) + \color{blue}{\left(y + x\right)}\right) + x \]
                              16. lower-+.f6499.9

                                \[\leadsto \left(\left(z + \left(y + x\right)\right) + \color{blue}{\left(y + x\right)}\right) + x \]
                            4. Applied rewrites99.9%

                              \[\leadsto \color{blue}{\left(\left(z + \left(y + x\right)\right) + \left(y + x\right)\right)} + x \]
                            5. Final simplification99.9%

                              \[\leadsto \left(\left(\left(y + x\right) + z\right) + \left(y + x\right)\right) + x \]
                            6. Add Preprocessing

                            Alternative 10: 34.5% accurate, 4.0× speedup?

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

                              \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                            2. Add Preprocessing
                            3. Taylor expanded in z around 0

                              \[\leadsto \color{blue}{x + \left(2 \cdot x + 2 \cdot y\right)} \]
                            4. Step-by-step derivation
                              1. associate-+r+N/A

                                \[\leadsto \color{blue}{\left(x + 2 \cdot x\right) + 2 \cdot y} \]
                              2. distribute-rgt1-inN/A

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

                                \[\leadsto \color{blue}{3} \cdot x + 2 \cdot y \]
                              4. lower-fma.f64N/A

                                \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                              5. lower-*.f6463.6

                                \[\leadsto \mathsf{fma}\left(3, x, \color{blue}{2 \cdot y}\right) \]
                            5. Applied rewrites63.6%

                              \[\leadsto \color{blue}{\mathsf{fma}\left(3, x, 2 \cdot y\right)} \]
                            6. Taylor expanded in x around 0

                              \[\leadsto 2 \cdot \color{blue}{y} \]
                            7. Step-by-step derivation
                              1. Applied rewrites32.3%

                                \[\leadsto 2 \cdot \color{blue}{y} \]
                              2. Step-by-step derivation
                                1. Applied rewrites32.3%

                                  \[\leadsto y + y \]
                                2. Add Preprocessing

                                Reproduce

                                ?
                                herbie shell --seed 2024296 
                                (FPCore (x y z)
                                  :name "Graphics.Rendering.Plot.Render.Plot.Legend:renderLegendInside from plot-0.2.3.4"
                                  :precision binary64
                                  (+ (+ (+ (+ (+ x y) y) x) z) x))