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

Percentage Accurate: 99.9% → 100.0%
Time: 2.1s
Alternatives: 9
Speedup: 1.3×

Specification

?
\[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ (+ (+ (+ (+ 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)
use fmin_fmax_functions
    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]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	((((x + y) + y) + x) + z) + x
END code
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x

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 9 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?

\[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ (+ (+ (+ (+ 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)
use fmin_fmax_functions
    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]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	((((x + y) + y) + x) + z) + x
END code
\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x

Alternative 1: 100.0% accurate, 1.3× speedup?

\[\mathsf{fma}\left(3, x, \mathsf{fma}\left(2, y, z\right)\right) \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (fma 3.0 x (fma 2.0 y z)))
double code(double x, double y, double z) {
	return fma(3.0, x, fma(2.0, y, z));
}
function code(x, y, z)
	return fma(3.0, x, fma(2.0, y, z))
end
code[x_, y_, z_] := N[(3.0 * x + N[(2.0 * y + z), $MachinePrecision]), $MachinePrecision]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	((3) * x) + (((2) * y) + z)
END code
\mathsf{fma}\left(3, x, \mathsf{fma}\left(2, y, z\right)\right)
Derivation
  1. Initial program 99.9%

    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
  2. Step-by-step derivation
    1. Applied rewrites100.0%

      \[\leadsto \mathsf{fma}\left(3, x, \mathsf{fma}\left(2, y, z\right)\right) \]
    2. Add Preprocessing

    Alternative 2: 85.2% accurate, 0.7× speedup?

    \[\begin{array}{l} \mathbf{if}\;y \leq -9.347049576480228 \cdot 10^{+176}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\ \mathbf{elif}\;y \leq -5.0259291606181536 \cdot 10^{+89}:\\ \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\ \mathbf{elif}\;y \leq 2.727325893764305 \cdot 10^{+120}:\\ \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right) + x\\ \end{array} \]
    (FPCore (x y z)
      :precision binary64
      :pre TRUE
      (if (<= y -9.347049576480228e+176)
      (fma 2.0 y z)
      (if (<= y -5.0259291606181536e+89)
        (fma 3.0 x (+ y y))
        (if (<= y 2.727325893764305e+120)
          (fma 3.0 x z)
          (+ (fma 2.0 y z) x)))))
    double code(double x, double y, double z) {
    	double tmp;
    	if (y <= -9.347049576480228e+176) {
    		tmp = fma(2.0, y, z);
    	} else if (y <= -5.0259291606181536e+89) {
    		tmp = fma(3.0, x, (y + y));
    	} else if (y <= 2.727325893764305e+120) {
    		tmp = fma(3.0, x, z);
    	} else {
    		tmp = fma(2.0, y, z) + x;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	tmp = 0.0
    	if (y <= -9.347049576480228e+176)
    		tmp = fma(2.0, y, z);
    	elseif (y <= -5.0259291606181536e+89)
    		tmp = fma(3.0, x, Float64(y + y));
    	elseif (y <= 2.727325893764305e+120)
    		tmp = fma(3.0, x, z);
    	else
    		tmp = Float64(fma(2.0, y, z) + x);
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := If[LessEqual[y, -9.347049576480228e+176], N[(2.0 * y + z), $MachinePrecision], If[LessEqual[y, -5.0259291606181536e+89], N[(3.0 * x + N[(y + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.727325893764305e+120], N[(3.0 * x + z), $MachinePrecision], N[(N[(2.0 * y + z), $MachinePrecision] + x), $MachinePrecision]]]]
    
    f(x, y, z):
    	x in [-inf, +inf],
    	y in [-inf, +inf],
    	z in [-inf, +inf]
    code: THEORY
    BEGIN
    f(x, y, z: real): real =
    	LET tmp_2 = IF (y <= (2727325893764304952337864284099369734672726102996935792482044238117505441831551720658621706644790338763370656773728894976)) THEN (((3) * x) + z) ELSE ((((2) * y) + z) + x) ENDIF IN
    	LET tmp_1 = IF (y <= (-502592916061815364220355662309812671850748000080195669440485458491963720211379317960081408)) THEN (((3) * x) + (y + y)) ELSE tmp_2 ENDIF IN
    	LET tmp = IF (y <= (-934704957648022813555763478197343727017170490318801816023977214808822551430660557024194914877671996663348408605159951181645061406426891512950258233780998583795230781840239362048)) THEN (((2) * y) + z) ELSE tmp_1 ENDIF IN
    	tmp
    END code
    \begin{array}{l}
    \mathbf{if}\;y \leq -9.347049576480228 \cdot 10^{+176}:\\
    \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\
    
    \mathbf{elif}\;y \leq -5.0259291606181536 \cdot 10^{+89}:\\
    \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\
    
    \mathbf{elif}\;y \leq 2.727325893764305 \cdot 10^{+120}:\\
    \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(2, y, z\right) + x\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if y < -9.3470495764802281e176

      1. Initial program 99.9%

        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
      2. Step-by-step derivation
        1. Applied rewrites100.0%

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

          \[\leadsto z + 3 \cdot x \]
        3. Step-by-step derivation
          1. Applied rewrites67.5%

            \[\leadsto z + 3 \cdot x \]
          2. Taylor expanded in x around 0

            \[\leadsto z + 2 \cdot y \]
          3. Step-by-step derivation
            1. Applied rewrites66.2%

              \[\leadsto z + 2 \cdot y \]
            2. Step-by-step derivation
              1. Applied rewrites66.2%

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

              if -9.3470495764802281e176 < y < -5.0259291606181536e89

              1. Initial program 99.9%

                \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
              2. Step-by-step derivation
                1. Applied rewrites100.0%

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

                  \[\leadsto 2 \cdot y + 3 \cdot x \]
                3. Step-by-step derivation
                  1. Applied rewrites66.6%

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

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

                    if -5.0259291606181536e89 < y < 2.727325893764305e120

                    1. Initial program 99.9%

                      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                    2. Step-by-step derivation
                      1. Applied rewrites100.0%

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

                        \[\leadsto z + 3 \cdot x \]
                      3. Step-by-step derivation
                        1. Applied rewrites67.5%

                          \[\leadsto z + 3 \cdot x \]
                        2. Step-by-step derivation
                          1. Applied rewrites67.5%

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

                          if 2.727325893764305e120 < y

                          1. Initial program 99.9%

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

                            \[\leadsto \left(z + 2 \cdot y\right) + x \]
                          3. Step-by-step derivation
                            1. Applied rewrites71.1%

                              \[\leadsto \left(z + 2 \cdot y\right) + x \]
                            2. Step-by-step derivation
                              1. Applied rewrites71.1%

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

                            Alternative 3: 84.9% accurate, 0.8× speedup?

                            \[\begin{array}{l} \mathbf{if}\;y \leq -9.347049576480228 \cdot 10^{+176}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\ \mathbf{elif}\;y \leq -5.0259291606181536 \cdot 10^{+89}:\\ \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\ \mathbf{elif}\;y \leq 2.727325893764305 \cdot 10^{+120}:\\ \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\ \end{array} \]
                            (FPCore (x y z)
                              :precision binary64
                              :pre TRUE
                              (if (<= y -9.347049576480228e+176)
                              (fma 2.0 y z)
                              (if (<= y -5.0259291606181536e+89)
                                (fma 3.0 x (+ y y))
                                (if (<= y 2.727325893764305e+120) (fma 3.0 x z) (fma 2.0 y z)))))
                            double code(double x, double y, double z) {
                            	double tmp;
                            	if (y <= -9.347049576480228e+176) {
                            		tmp = fma(2.0, y, z);
                            	} else if (y <= -5.0259291606181536e+89) {
                            		tmp = fma(3.0, x, (y + y));
                            	} else if (y <= 2.727325893764305e+120) {
                            		tmp = fma(3.0, x, z);
                            	} else {
                            		tmp = fma(2.0, y, z);
                            	}
                            	return tmp;
                            }
                            
                            function code(x, y, z)
                            	tmp = 0.0
                            	if (y <= -9.347049576480228e+176)
                            		tmp = fma(2.0, y, z);
                            	elseif (y <= -5.0259291606181536e+89)
                            		tmp = fma(3.0, x, Float64(y + y));
                            	elseif (y <= 2.727325893764305e+120)
                            		tmp = fma(3.0, x, z);
                            	else
                            		tmp = fma(2.0, y, z);
                            	end
                            	return tmp
                            end
                            
                            code[x_, y_, z_] := If[LessEqual[y, -9.347049576480228e+176], N[(2.0 * y + z), $MachinePrecision], If[LessEqual[y, -5.0259291606181536e+89], N[(3.0 * x + N[(y + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.727325893764305e+120], N[(3.0 * x + z), $MachinePrecision], N[(2.0 * y + z), $MachinePrecision]]]]
                            
                            f(x, y, z):
                            	x in [-inf, +inf],
                            	y in [-inf, +inf],
                            	z in [-inf, +inf]
                            code: THEORY
                            BEGIN
                            f(x, y, z: real): real =
                            	LET tmp_2 = IF (y <= (2727325893764304952337864284099369734672726102996935792482044238117505441831551720658621706644790338763370656773728894976)) THEN (((3) * x) + z) ELSE (((2) * y) + z) ENDIF IN
                            	LET tmp_1 = IF (y <= (-502592916061815364220355662309812671850748000080195669440485458491963720211379317960081408)) THEN (((3) * x) + (y + y)) ELSE tmp_2 ENDIF IN
                            	LET tmp = IF (y <= (-934704957648022813555763478197343727017170490318801816023977214808822551430660557024194914877671996663348408605159951181645061406426891512950258233780998583795230781840239362048)) THEN (((2) * y) + z) ELSE tmp_1 ENDIF IN
                            	tmp
                            END code
                            \begin{array}{l}
                            \mathbf{if}\;y \leq -9.347049576480228 \cdot 10^{+176}:\\
                            \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\
                            
                            \mathbf{elif}\;y \leq -5.0259291606181536 \cdot 10^{+89}:\\
                            \;\;\;\;\mathsf{fma}\left(3, x, y + y\right)\\
                            
                            \mathbf{elif}\;y \leq 2.727325893764305 \cdot 10^{+120}:\\
                            \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\
                            
                            
                            \end{array}
                            
                            Derivation
                            1. Split input into 3 regimes
                            2. if y < -9.3470495764802281e176 or 2.727325893764305e120 < y

                              1. Initial program 99.9%

                                \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                              2. Step-by-step derivation
                                1. Applied rewrites100.0%

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

                                  \[\leadsto z + 3 \cdot x \]
                                3. Step-by-step derivation
                                  1. Applied rewrites67.5%

                                    \[\leadsto z + 3 \cdot x \]
                                  2. Taylor expanded in x around 0

                                    \[\leadsto z + 2 \cdot y \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites66.2%

                                      \[\leadsto z + 2 \cdot y \]
                                    2. Step-by-step derivation
                                      1. Applied rewrites66.2%

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

                                      if -9.3470495764802281e176 < y < -5.0259291606181536e89

                                      1. Initial program 99.9%

                                        \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites100.0%

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

                                          \[\leadsto 2 \cdot y + 3 \cdot x \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites66.6%

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

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

                                            if -5.0259291606181536e89 < y < 2.727325893764305e120

                                            1. Initial program 99.9%

                                              \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites100.0%

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

                                                \[\leadsto z + 3 \cdot x \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites67.5%

                                                  \[\leadsto z + 3 \cdot x \]
                                                2. Step-by-step derivation
                                                  1. Applied rewrites67.5%

                                                    \[\leadsto \mathsf{fma}\left(3, x, z\right) \]
                                                3. Recombined 3 regimes into one program.
                                                4. Add Preprocessing

                                                Alternative 4: 84.0% accurate, 1.0× speedup?

                                                \[\begin{array}{l} \mathbf{if}\;y \leq -1.3553592856625129 \cdot 10^{-62}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\ \mathbf{elif}\;y \leq 2.727325893764305 \cdot 10^{+120}:\\ \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\ \end{array} \]
                                                (FPCore (x y z)
                                                  :precision binary64
                                                  :pre TRUE
                                                  (if (<= y -1.3553592856625129e-62)
                                                  (fma 2.0 y z)
                                                  (if (<= y 2.727325893764305e+120) (fma 3.0 x z) (fma 2.0 y z))))
                                                double code(double x, double y, double z) {
                                                	double tmp;
                                                	if (y <= -1.3553592856625129e-62) {
                                                		tmp = fma(2.0, y, z);
                                                	} else if (y <= 2.727325893764305e+120) {
                                                		tmp = fma(3.0, x, z);
                                                	} else {
                                                		tmp = fma(2.0, y, z);
                                                	}
                                                	return tmp;
                                                }
                                                
                                                function code(x, y, z)
                                                	tmp = 0.0
                                                	if (y <= -1.3553592856625129e-62)
                                                		tmp = fma(2.0, y, z);
                                                	elseif (y <= 2.727325893764305e+120)
                                                		tmp = fma(3.0, x, z);
                                                	else
                                                		tmp = fma(2.0, y, z);
                                                	end
                                                	return tmp
                                                end
                                                
                                                code[x_, y_, z_] := If[LessEqual[y, -1.3553592856625129e-62], N[(2.0 * y + z), $MachinePrecision], If[LessEqual[y, 2.727325893764305e+120], N[(3.0 * x + z), $MachinePrecision], N[(2.0 * y + z), $MachinePrecision]]]
                                                
                                                f(x, y, z):
                                                	x in [-inf, +inf],
                                                	y in [-inf, +inf],
                                                	z in [-inf, +inf]
                                                code: THEORY
                                                BEGIN
                                                f(x, y, z: real): real =
                                                	LET tmp_1 = IF (y <= (2727325893764304952337864284099369734672726102996935792482044238117505441831551720658621706644790338763370656773728894976)) THEN (((3) * x) + z) ELSE (((2) * y) + z) ENDIF IN
                                                	LET tmp = IF (y <= (-13553592856625128845767997192365836726238659583024223892525795493858178356593844982064028132221618381767715742852365027569051331475865871986381957741874698143702548946976094157434999942779541015625e-258)) THEN (((2) * y) + z) ELSE tmp_1 ENDIF IN
                                                	tmp
                                                END code
                                                \begin{array}{l}
                                                \mathbf{if}\;y \leq -1.3553592856625129 \cdot 10^{-62}:\\
                                                \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\
                                                
                                                \mathbf{elif}\;y \leq 2.727325893764305 \cdot 10^{+120}:\\
                                                \;\;\;\;\mathsf{fma}\left(3, x, z\right)\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\
                                                
                                                
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 2 regimes
                                                2. if y < -1.3553592856625129e-62 or 2.727325893764305e120 < y

                                                  1. Initial program 99.9%

                                                    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                                  2. Step-by-step derivation
                                                    1. Applied rewrites100.0%

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

                                                      \[\leadsto z + 3 \cdot x \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites67.5%

                                                        \[\leadsto z + 3 \cdot x \]
                                                      2. Taylor expanded in x around 0

                                                        \[\leadsto z + 2 \cdot y \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites66.2%

                                                          \[\leadsto z + 2 \cdot y \]
                                                        2. Step-by-step derivation
                                                          1. Applied rewrites66.2%

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

                                                          if -1.3553592856625129e-62 < y < 2.727325893764305e120

                                                          1. Initial program 99.9%

                                                            \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                                          2. Step-by-step derivation
                                                            1. Applied rewrites100.0%

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

                                                              \[\leadsto z + 3 \cdot x \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites67.5%

                                                                \[\leadsto z + 3 \cdot x \]
                                                              2. Step-by-step derivation
                                                                1. Applied rewrites67.5%

                                                                  \[\leadsto \mathsf{fma}\left(3, x, z\right) \]
                                                              3. Recombined 2 regimes into one program.
                                                              4. Add Preprocessing

                                                              Alternative 5: 81.0% accurate, 1.0× speedup?

                                                              \[\begin{array}{l} \mathbf{if}\;x \leq -5.92614486843435 \cdot 10^{+127}:\\ \;\;\;\;3 \cdot x\\ \mathbf{elif}\;x \leq 4.862572395154721 \cdot 10^{+105}:\\ \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\ \mathbf{else}:\\ \;\;\;\;3 \cdot x\\ \end{array} \]
                                                              (FPCore (x y z)
                                                                :precision binary64
                                                                :pre TRUE
                                                                (if (<= x -5.92614486843435e+127)
                                                                (* 3.0 x)
                                                                (if (<= x 4.862572395154721e+105) (fma 2.0 y z) (* 3.0 x))))
                                                              double code(double x, double y, double z) {
                                                              	double tmp;
                                                              	if (x <= -5.92614486843435e+127) {
                                                              		tmp = 3.0 * x;
                                                              	} else if (x <= 4.862572395154721e+105) {
                                                              		tmp = fma(2.0, y, z);
                                                              	} else {
                                                              		tmp = 3.0 * x;
                                                              	}
                                                              	return tmp;
                                                              }
                                                              
                                                              function code(x, y, z)
                                                              	tmp = 0.0
                                                              	if (x <= -5.92614486843435e+127)
                                                              		tmp = Float64(3.0 * x);
                                                              	elseif (x <= 4.862572395154721e+105)
                                                              		tmp = fma(2.0, y, z);
                                                              	else
                                                              		tmp = Float64(3.0 * x);
                                                              	end
                                                              	return tmp
                                                              end
                                                              
                                                              code[x_, y_, z_] := If[LessEqual[x, -5.92614486843435e+127], N[(3.0 * x), $MachinePrecision], If[LessEqual[x, 4.862572395154721e+105], N[(2.0 * y + z), $MachinePrecision], N[(3.0 * x), $MachinePrecision]]]
                                                              
                                                              f(x, y, z):
                                                              	x in [-inf, +inf],
                                                              	y in [-inf, +inf],
                                                              	z in [-inf, +inf]
                                                              code: THEORY
                                                              BEGIN
                                                              f(x, y, z: real): real =
                                                              	LET tmp_1 = IF (x <= (4862572395154720909680609020007221124713912223861370976327075846251908434588404152930301800998055001980928)) THEN (((2) * y) + z) ELSE ((3) * x) ENDIF IN
                                                              	LET tmp = IF (x <= (-59261448684343501494910739884867704025520233738209177292818186080281696972712302477772434990312385523938847599070226355805224960)) THEN ((3) * x) ELSE tmp_1 ENDIF IN
                                                              	tmp
                                                              END code
                                                              \begin{array}{l}
                                                              \mathbf{if}\;x \leq -5.92614486843435 \cdot 10^{+127}:\\
                                                              \;\;\;\;3 \cdot x\\
                                                              
                                                              \mathbf{elif}\;x \leq 4.862572395154721 \cdot 10^{+105}:\\
                                                              \;\;\;\;\mathsf{fma}\left(2, y, z\right)\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;3 \cdot x\\
                                                              
                                                              
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if x < -5.9261448684343501e127 or 4.8625723951547209e105 < x

                                                                1. Initial program 99.9%

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

                                                                  \[\leadsto 3 \cdot x \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites34.9%

                                                                    \[\leadsto 3 \cdot x \]

                                                                  if -5.9261448684343501e127 < x < 4.8625723951547209e105

                                                                  1. Initial program 99.9%

                                                                    \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                                                  2. Step-by-step derivation
                                                                    1. Applied rewrites100.0%

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

                                                                      \[\leadsto z + 3 \cdot x \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites67.5%

                                                                        \[\leadsto z + 3 \cdot x \]
                                                                      2. Taylor expanded in x around 0

                                                                        \[\leadsto z + 2 \cdot y \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites66.2%

                                                                          \[\leadsto z + 2 \cdot y \]
                                                                        2. Step-by-step derivation
                                                                          1. Applied rewrites66.2%

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

                                                                        Alternative 6: 55.9% accurate, 0.6× speedup?

                                                                        \[\begin{array}{l} \mathbf{if}\;y \leq -5.0259291606181536 \cdot 10^{+89}:\\ \;\;\;\;y + y\\ \mathbf{elif}\;y \leq -2.3817997342882146 \cdot 10^{-122}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;y \leq -1.243635170538334 \cdot 10^{-252}:\\ \;\;\;\;3 \cdot x\\ \mathbf{elif}\;y \leq 2.869542378003428 \cdot 10^{-161}:\\ \;\;\;\;z + x\\ \mathbf{elif}\;y \leq 2.727325893764305 \cdot 10^{+120}:\\ \;\;\;\;3 \cdot x\\ \mathbf{else}:\\ \;\;\;\;y + y\\ \end{array} \]
                                                                        (FPCore (x y z)
                                                                          :precision binary64
                                                                          :pre TRUE
                                                                          (if (<= y -5.0259291606181536e+89)
                                                                          (+ y y)
                                                                          (if (<= y -2.3817997342882146e-122)
                                                                            (+ z x)
                                                                            (if (<= y -1.243635170538334e-252)
                                                                              (* 3.0 x)
                                                                              (if (<= y 2.869542378003428e-161)
                                                                                (+ z x)
                                                                                (if (<= y 2.727325893764305e+120) (* 3.0 x) (+ y y)))))))
                                                                        double code(double x, double y, double z) {
                                                                        	double tmp;
                                                                        	if (y <= -5.0259291606181536e+89) {
                                                                        		tmp = y + y;
                                                                        	} else if (y <= -2.3817997342882146e-122) {
                                                                        		tmp = z + x;
                                                                        	} else if (y <= -1.243635170538334e-252) {
                                                                        		tmp = 3.0 * x;
                                                                        	} else if (y <= 2.869542378003428e-161) {
                                                                        		tmp = z + x;
                                                                        	} else if (y <= 2.727325893764305e+120) {
                                                                        		tmp = 3.0 * x;
                                                                        	} else {
                                                                        		tmp = y + y;
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        real(8) function code(x, y, z)
                                                                        use fmin_fmax_functions
                                                                            real(8), intent (in) :: x
                                                                            real(8), intent (in) :: y
                                                                            real(8), intent (in) :: z
                                                                            real(8) :: tmp
                                                                            if (y <= (-5.0259291606181536d+89)) then
                                                                                tmp = y + y
                                                                            else if (y <= (-2.3817997342882146d-122)) then
                                                                                tmp = z + x
                                                                            else if (y <= (-1.243635170538334d-252)) then
                                                                                tmp = 3.0d0 * x
                                                                            else if (y <= 2.869542378003428d-161) then
                                                                                tmp = z + x
                                                                            else if (y <= 2.727325893764305d+120) 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 <= -5.0259291606181536e+89) {
                                                                        		tmp = y + y;
                                                                        	} else if (y <= -2.3817997342882146e-122) {
                                                                        		tmp = z + x;
                                                                        	} else if (y <= -1.243635170538334e-252) {
                                                                        		tmp = 3.0 * x;
                                                                        	} else if (y <= 2.869542378003428e-161) {
                                                                        		tmp = z + x;
                                                                        	} else if (y <= 2.727325893764305e+120) {
                                                                        		tmp = 3.0 * x;
                                                                        	} else {
                                                                        		tmp = y + y;
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        def code(x, y, z):
                                                                        	tmp = 0
                                                                        	if y <= -5.0259291606181536e+89:
                                                                        		tmp = y + y
                                                                        	elif y <= -2.3817997342882146e-122:
                                                                        		tmp = z + x
                                                                        	elif y <= -1.243635170538334e-252:
                                                                        		tmp = 3.0 * x
                                                                        	elif y <= 2.869542378003428e-161:
                                                                        		tmp = z + x
                                                                        	elif y <= 2.727325893764305e+120:
                                                                        		tmp = 3.0 * x
                                                                        	else:
                                                                        		tmp = y + y
                                                                        	return tmp
                                                                        
                                                                        function code(x, y, z)
                                                                        	tmp = 0.0
                                                                        	if (y <= -5.0259291606181536e+89)
                                                                        		tmp = Float64(y + y);
                                                                        	elseif (y <= -2.3817997342882146e-122)
                                                                        		tmp = Float64(z + x);
                                                                        	elseif (y <= -1.243635170538334e-252)
                                                                        		tmp = Float64(3.0 * x);
                                                                        	elseif (y <= 2.869542378003428e-161)
                                                                        		tmp = Float64(z + x);
                                                                        	elseif (y <= 2.727325893764305e+120)
                                                                        		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 <= -5.0259291606181536e+89)
                                                                        		tmp = y + y;
                                                                        	elseif (y <= -2.3817997342882146e-122)
                                                                        		tmp = z + x;
                                                                        	elseif (y <= -1.243635170538334e-252)
                                                                        		tmp = 3.0 * x;
                                                                        	elseif (y <= 2.869542378003428e-161)
                                                                        		tmp = z + x;
                                                                        	elseif (y <= 2.727325893764305e+120)
                                                                        		tmp = 3.0 * x;
                                                                        	else
                                                                        		tmp = y + y;
                                                                        	end
                                                                        	tmp_2 = tmp;
                                                                        end
                                                                        
                                                                        code[x_, y_, z_] := If[LessEqual[y, -5.0259291606181536e+89], N[(y + y), $MachinePrecision], If[LessEqual[y, -2.3817997342882146e-122], N[(z + x), $MachinePrecision], If[LessEqual[y, -1.243635170538334e-252], N[(3.0 * x), $MachinePrecision], If[LessEqual[y, 2.869542378003428e-161], N[(z + x), $MachinePrecision], If[LessEqual[y, 2.727325893764305e+120], N[(3.0 * x), $MachinePrecision], N[(y + y), $MachinePrecision]]]]]]
                                                                        
                                                                        f(x, y, z):
                                                                        	x in [-inf, +inf],
                                                                        	y in [-inf, +inf],
                                                                        	z in [-inf, +inf]
                                                                        code: THEORY
                                                                        BEGIN
                                                                        f(x, y, z: real): real =
                                                                        	LET tmp_4 = IF (y <= (2727325893764304952337864284099369734672726102996935792482044238117505441831551720658621706644790338763370656773728894976)) THEN ((3) * x) ELSE (y + y) ENDIF IN
                                                                        	LET tmp_3 = IF (y <= (286954237800342786260056992597452894718726399955599946240503771880106966813212024715918224457463840275725355671150852118610288889475348275436638843131873858356289193891888831273235277752734742150200976888995107848354072395390161871849703088050765940327525758228065288874462644607874073861990474707549503805516065380937139149448829942486581552498889871904346139523994489667157132832173670189401804009321494959294795989990234375e-586)) THEN (z + x) ELSE tmp_4 ENDIF IN
                                                                        	LET tmp_2 = IF (y <= (-1243635170538334072242142531581489880884297080495175377058804436165721230801406394212306458161391109025024213470128436601983048073204202258515568024300162354159382181809045848661085901130192198158591231648058463961379490308000822671564204627180701957343103047153343381873202407651904993144187274574407032606155366661399459901643102342641543410818335491205110839453789756801205954651040298962168358033092306990446402046590261454962384608374177380925511031737978257962725375668614788638524506996965565514109338840047449121788912300323697256151524720304142228275225316540039304577718751796203890016938309326377520847017876803874969482421875e-888)) THEN ((3) * x) ELSE tmp_3 ENDIF IN
                                                                        	LET tmp_1 = IF (y <= (-23817997342882145541283175115138086415605674412780916275691454415381001598433026788315188897521008243636962641755089564964744487951516206563698103468017535178753815538258492485849988053987701801384000457171747640948851063664606237537024308693859387038534013661713256565803648265895797161010899629929316034804287482984364032745361328125e-456)) THEN (z + x) ELSE tmp_2 ENDIF IN
                                                                        	LET tmp = IF (y <= (-502592916061815364220355662309812671850748000080195669440485458491963720211379317960081408)) THEN (y + y) ELSE tmp_1 ENDIF IN
                                                                        	tmp
                                                                        END code
                                                                        \begin{array}{l}
                                                                        \mathbf{if}\;y \leq -5.0259291606181536 \cdot 10^{+89}:\\
                                                                        \;\;\;\;y + y\\
                                                                        
                                                                        \mathbf{elif}\;y \leq -2.3817997342882146 \cdot 10^{-122}:\\
                                                                        \;\;\;\;z + x\\
                                                                        
                                                                        \mathbf{elif}\;y \leq -1.243635170538334 \cdot 10^{-252}:\\
                                                                        \;\;\;\;3 \cdot x\\
                                                                        
                                                                        \mathbf{elif}\;y \leq 2.869542378003428 \cdot 10^{-161}:\\
                                                                        \;\;\;\;z + x\\
                                                                        
                                                                        \mathbf{elif}\;y \leq 2.727325893764305 \cdot 10^{+120}:\\
                                                                        \;\;\;\;3 \cdot x\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;y + y\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 3 regimes
                                                                        2. if y < -5.0259291606181536e89 or 2.727325893764305e120 < y

                                                                          1. Initial program 99.9%

                                                                            \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                                                          2. Step-by-step derivation
                                                                            1. Applied rewrites100.0%

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

                                                                              \[\leadsto 2 \cdot y + 3 \cdot x \]
                                                                            3. Step-by-step derivation
                                                                              1. Applied rewrites66.6%

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

                                                                                \[\leadsto 2 \cdot y \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites33.7%

                                                                                  \[\leadsto 2 \cdot y \]
                                                                                2. Step-by-step derivation
                                                                                  1. Applied rewrites33.7%

                                                                                    \[\leadsto y + y \]

                                                                                  if -5.0259291606181536e89 < y < -2.3817997342882146e-122 or -1.2436351705383341e-252 < y < 2.8695423780034279e-161

                                                                                  1. Initial program 99.9%

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

                                                                                    \[\leadsto \left(z + 2 \cdot y\right) + x \]
                                                                                  3. Step-by-step derivation
                                                                                    1. Applied rewrites71.1%

                                                                                      \[\leadsto \left(z + 2 \cdot y\right) + x \]
                                                                                    2. Taylor expanded in y around 0

                                                                                      \[\leadsto z + x \]
                                                                                    3. Step-by-step derivation
                                                                                      1. Applied rewrites39.5%

                                                                                        \[\leadsto z + x \]

                                                                                      if -2.3817997342882146e-122 < y < -1.2436351705383341e-252 or 2.8695423780034279e-161 < y < 2.727325893764305e120

                                                                                      1. Initial program 99.9%

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

                                                                                        \[\leadsto 3 \cdot x \]
                                                                                      3. Step-by-step derivation
                                                                                        1. Applied rewrites34.9%

                                                                                          \[\leadsto 3 \cdot x \]
                                                                                      4. Recombined 3 regimes into one program.
                                                                                      5. Add Preprocessing

                                                                                      Alternative 7: 54.5% accurate, 1.3× speedup?

                                                                                      \[\begin{array}{l} \mathbf{if}\;y \leq -5.0259291606181536 \cdot 10^{+89}:\\ \;\;\;\;y + y\\ \mathbf{elif}\;y \leq 6.850874518106612 \cdot 10^{+112}:\\ \;\;\;\;z + x\\ \mathbf{else}:\\ \;\;\;\;y + y\\ \end{array} \]
                                                                                      (FPCore (x y z)
                                                                                        :precision binary64
                                                                                        :pre TRUE
                                                                                        (if (<= y -5.0259291606181536e+89)
                                                                                        (+ y y)
                                                                                        (if (<= y 6.850874518106612e+112) (+ z x) (+ y y))))
                                                                                      double code(double x, double y, double z) {
                                                                                      	double tmp;
                                                                                      	if (y <= -5.0259291606181536e+89) {
                                                                                      		tmp = y + y;
                                                                                      	} else if (y <= 6.850874518106612e+112) {
                                                                                      		tmp = z + x;
                                                                                      	} else {
                                                                                      		tmp = y + y;
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      real(8) function code(x, y, z)
                                                                                      use fmin_fmax_functions
                                                                                          real(8), intent (in) :: x
                                                                                          real(8), intent (in) :: y
                                                                                          real(8), intent (in) :: z
                                                                                          real(8) :: tmp
                                                                                          if (y <= (-5.0259291606181536d+89)) then
                                                                                              tmp = y + y
                                                                                          else if (y <= 6.850874518106612d+112) then
                                                                                              tmp = z + 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 <= -5.0259291606181536e+89) {
                                                                                      		tmp = y + y;
                                                                                      	} else if (y <= 6.850874518106612e+112) {
                                                                                      		tmp = z + x;
                                                                                      	} else {
                                                                                      		tmp = y + y;
                                                                                      	}
                                                                                      	return tmp;
                                                                                      }
                                                                                      
                                                                                      def code(x, y, z):
                                                                                      	tmp = 0
                                                                                      	if y <= -5.0259291606181536e+89:
                                                                                      		tmp = y + y
                                                                                      	elif y <= 6.850874518106612e+112:
                                                                                      		tmp = z + x
                                                                                      	else:
                                                                                      		tmp = y + y
                                                                                      	return tmp
                                                                                      
                                                                                      function code(x, y, z)
                                                                                      	tmp = 0.0
                                                                                      	if (y <= -5.0259291606181536e+89)
                                                                                      		tmp = Float64(y + y);
                                                                                      	elseif (y <= 6.850874518106612e+112)
                                                                                      		tmp = Float64(z + x);
                                                                                      	else
                                                                                      		tmp = Float64(y + y);
                                                                                      	end
                                                                                      	return tmp
                                                                                      end
                                                                                      
                                                                                      function tmp_2 = code(x, y, z)
                                                                                      	tmp = 0.0;
                                                                                      	if (y <= -5.0259291606181536e+89)
                                                                                      		tmp = y + y;
                                                                                      	elseif (y <= 6.850874518106612e+112)
                                                                                      		tmp = z + x;
                                                                                      	else
                                                                                      		tmp = y + y;
                                                                                      	end
                                                                                      	tmp_2 = tmp;
                                                                                      end
                                                                                      
                                                                                      code[x_, y_, z_] := If[LessEqual[y, -5.0259291606181536e+89], N[(y + y), $MachinePrecision], If[LessEqual[y, 6.850874518106612e+112], N[(z + x), $MachinePrecision], N[(y + y), $MachinePrecision]]]
                                                                                      
                                                                                      f(x, y, z):
                                                                                      	x in [-inf, +inf],
                                                                                      	y in [-inf, +inf],
                                                                                      	z in [-inf, +inf]
                                                                                      code: THEORY
                                                                                      BEGIN
                                                                                      f(x, y, z: real): real =
                                                                                      	LET tmp_1 = IF (y <= (68508745181066123989082494598625973818159535974472370974181792568369187592370785732721671702670460623062078324736)) THEN (z + x) ELSE (y + y) ENDIF IN
                                                                                      	LET tmp = IF (y <= (-502592916061815364220355662309812671850748000080195669440485458491963720211379317960081408)) THEN (y + y) ELSE tmp_1 ENDIF IN
                                                                                      	tmp
                                                                                      END code
                                                                                      \begin{array}{l}
                                                                                      \mathbf{if}\;y \leq -5.0259291606181536 \cdot 10^{+89}:\\
                                                                                      \;\;\;\;y + y\\
                                                                                      
                                                                                      \mathbf{elif}\;y \leq 6.850874518106612 \cdot 10^{+112}:\\
                                                                                      \;\;\;\;z + x\\
                                                                                      
                                                                                      \mathbf{else}:\\
                                                                                      \;\;\;\;y + y\\
                                                                                      
                                                                                      
                                                                                      \end{array}
                                                                                      
                                                                                      Derivation
                                                                                      1. Split input into 2 regimes
                                                                                      2. if y < -5.0259291606181536e89 or 6.8508745181066124e112 < y

                                                                                        1. Initial program 99.9%

                                                                                          \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                                                                        2. Step-by-step derivation
                                                                                          1. Applied rewrites100.0%

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

                                                                                            \[\leadsto 2 \cdot y + 3 \cdot x \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites66.6%

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

                                                                                              \[\leadsto 2 \cdot y \]
                                                                                            3. Step-by-step derivation
                                                                                              1. Applied rewrites33.7%

                                                                                                \[\leadsto 2 \cdot y \]
                                                                                              2. Step-by-step derivation
                                                                                                1. Applied rewrites33.7%

                                                                                                  \[\leadsto y + y \]

                                                                                                if -5.0259291606181536e89 < y < 6.8508745181066124e112

                                                                                                1. Initial program 99.9%

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

                                                                                                  \[\leadsto \left(z + 2 \cdot y\right) + x \]
                                                                                                3. Step-by-step derivation
                                                                                                  1. Applied rewrites71.1%

                                                                                                    \[\leadsto \left(z + 2 \cdot y\right) + x \]
                                                                                                  2. Taylor expanded in y around 0

                                                                                                    \[\leadsto z + x \]
                                                                                                  3. Step-by-step derivation
                                                                                                    1. Applied rewrites39.5%

                                                                                                      \[\leadsto z + x \]
                                                                                                  4. Recombined 2 regimes into one program.
                                                                                                  5. Add Preprocessing

                                                                                                  Alternative 8: 51.7% accurate, 1.3× speedup?

                                                                                                  \[\begin{array}{l} \mathbf{if}\;y \leq -6.742668220036118 \cdot 10^{+82}:\\ \;\;\;\;y + y\\ \mathbf{elif}\;y \leq 6.850874518106612 \cdot 10^{+112}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;y + y\\ \end{array} \]
                                                                                                  (FPCore (x y z)
                                                                                                    :precision binary64
                                                                                                    :pre TRUE
                                                                                                    (if (<= y -6.742668220036118e+82)
                                                                                                    (+ y y)
                                                                                                    (if (<= y 6.850874518106612e+112) z (+ y y))))
                                                                                                  double code(double x, double y, double z) {
                                                                                                  	double tmp;
                                                                                                  	if (y <= -6.742668220036118e+82) {
                                                                                                  		tmp = y + y;
                                                                                                  	} else if (y <= 6.850874518106612e+112) {
                                                                                                  		tmp = z;
                                                                                                  	} else {
                                                                                                  		tmp = y + y;
                                                                                                  	}
                                                                                                  	return tmp;
                                                                                                  }
                                                                                                  
                                                                                                  real(8) function code(x, y, z)
                                                                                                  use fmin_fmax_functions
                                                                                                      real(8), intent (in) :: x
                                                                                                      real(8), intent (in) :: y
                                                                                                      real(8), intent (in) :: z
                                                                                                      real(8) :: tmp
                                                                                                      if (y <= (-6.742668220036118d+82)) then
                                                                                                          tmp = y + y
                                                                                                      else if (y <= 6.850874518106612d+112) then
                                                                                                          tmp = z
                                                                                                      else
                                                                                                          tmp = y + y
                                                                                                      end if
                                                                                                      code = tmp
                                                                                                  end function
                                                                                                  
                                                                                                  public static double code(double x, double y, double z) {
                                                                                                  	double tmp;
                                                                                                  	if (y <= -6.742668220036118e+82) {
                                                                                                  		tmp = y + y;
                                                                                                  	} else if (y <= 6.850874518106612e+112) {
                                                                                                  		tmp = z;
                                                                                                  	} else {
                                                                                                  		tmp = y + y;
                                                                                                  	}
                                                                                                  	return tmp;
                                                                                                  }
                                                                                                  
                                                                                                  def code(x, y, z):
                                                                                                  	tmp = 0
                                                                                                  	if y <= -6.742668220036118e+82:
                                                                                                  		tmp = y + y
                                                                                                  	elif y <= 6.850874518106612e+112:
                                                                                                  		tmp = z
                                                                                                  	else:
                                                                                                  		tmp = y + y
                                                                                                  	return tmp
                                                                                                  
                                                                                                  function code(x, y, z)
                                                                                                  	tmp = 0.0
                                                                                                  	if (y <= -6.742668220036118e+82)
                                                                                                  		tmp = Float64(y + y);
                                                                                                  	elseif (y <= 6.850874518106612e+112)
                                                                                                  		tmp = z;
                                                                                                  	else
                                                                                                  		tmp = Float64(y + y);
                                                                                                  	end
                                                                                                  	return tmp
                                                                                                  end
                                                                                                  
                                                                                                  function tmp_2 = code(x, y, z)
                                                                                                  	tmp = 0.0;
                                                                                                  	if (y <= -6.742668220036118e+82)
                                                                                                  		tmp = y + y;
                                                                                                  	elseif (y <= 6.850874518106612e+112)
                                                                                                  		tmp = z;
                                                                                                  	else
                                                                                                  		tmp = y + y;
                                                                                                  	end
                                                                                                  	tmp_2 = tmp;
                                                                                                  end
                                                                                                  
                                                                                                  code[x_, y_, z_] := If[LessEqual[y, -6.742668220036118e+82], N[(y + y), $MachinePrecision], If[LessEqual[y, 6.850874518106612e+112], z, N[(y + y), $MachinePrecision]]]
                                                                                                  
                                                                                                  f(x, y, z):
                                                                                                  	x in [-inf, +inf],
                                                                                                  	y in [-inf, +inf],
                                                                                                  	z in [-inf, +inf]
                                                                                                  code: THEORY
                                                                                                  BEGIN
                                                                                                  f(x, y, z: real): real =
                                                                                                  	LET tmp_1 = IF (y <= (68508745181066123989082494598625973818159535974472370974181792568369187592370785732721671702670460623062078324736)) THEN z ELSE (y + y) ENDIF IN
                                                                                                  	LET tmp = IF (y <= (-67426682200361176120268859113156867640057346737471876670647569701482367024229253120)) THEN (y + y) ELSE tmp_1 ENDIF IN
                                                                                                  	tmp
                                                                                                  END code
                                                                                                  \begin{array}{l}
                                                                                                  \mathbf{if}\;y \leq -6.742668220036118 \cdot 10^{+82}:\\
                                                                                                  \;\;\;\;y + y\\
                                                                                                  
                                                                                                  \mathbf{elif}\;y \leq 6.850874518106612 \cdot 10^{+112}:\\
                                                                                                  \;\;\;\;z\\
                                                                                                  
                                                                                                  \mathbf{else}:\\
                                                                                                  \;\;\;\;y + y\\
                                                                                                  
                                                                                                  
                                                                                                  \end{array}
                                                                                                  
                                                                                                  Derivation
                                                                                                  1. Split input into 2 regimes
                                                                                                  2. if y < -6.7426682200361176e82 or 6.8508745181066124e112 < y

                                                                                                    1. Initial program 99.9%

                                                                                                      \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                                                                                    2. Step-by-step derivation
                                                                                                      1. Applied rewrites100.0%

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

                                                                                                        \[\leadsto 2 \cdot y + 3 \cdot x \]
                                                                                                      3. Step-by-step derivation
                                                                                                        1. Applied rewrites66.6%

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

                                                                                                          \[\leadsto 2 \cdot y \]
                                                                                                        3. Step-by-step derivation
                                                                                                          1. Applied rewrites33.7%

                                                                                                            \[\leadsto 2 \cdot y \]
                                                                                                          2. Step-by-step derivation
                                                                                                            1. Applied rewrites33.7%

                                                                                                              \[\leadsto y + y \]

                                                                                                            if -6.7426682200361176e82 < y < 6.8508745181066124e112

                                                                                                            1. Initial program 99.9%

                                                                                                              \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                                                                                            2. Step-by-step derivation
                                                                                                              1. Applied rewrites100.0%

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

                                                                                                                \[\leadsto z + 3 \cdot x \]
                                                                                                              3. Step-by-step derivation
                                                                                                                1. Applied rewrites67.5%

                                                                                                                  \[\leadsto z + 3 \cdot x \]
                                                                                                                2. Taylor expanded in x around 0

                                                                                                                  \[\leadsto z \]
                                                                                                                3. Step-by-step derivation
                                                                                                                  1. Applied rewrites34.4%

                                                                                                                    \[\leadsto z \]
                                                                                                                4. Recombined 2 regimes into one program.
                                                                                                                5. Add Preprocessing

                                                                                                                Alternative 9: 34.4% accurate, 14.0× speedup?

                                                                                                                \[z \]
                                                                                                                (FPCore (x y z)
                                                                                                                  :precision binary64
                                                                                                                  :pre TRUE
                                                                                                                  z)
                                                                                                                double code(double x, double y, double z) {
                                                                                                                	return z;
                                                                                                                }
                                                                                                                
                                                                                                                real(8) function code(x, y, z)
                                                                                                                use fmin_fmax_functions
                                                                                                                    real(8), intent (in) :: x
                                                                                                                    real(8), intent (in) :: y
                                                                                                                    real(8), intent (in) :: z
                                                                                                                    code = z
                                                                                                                end function
                                                                                                                
                                                                                                                public static double code(double x, double y, double z) {
                                                                                                                	return z;
                                                                                                                }
                                                                                                                
                                                                                                                def code(x, y, z):
                                                                                                                	return z
                                                                                                                
                                                                                                                function code(x, y, z)
                                                                                                                	return z
                                                                                                                end
                                                                                                                
                                                                                                                function tmp = code(x, y, z)
                                                                                                                	tmp = z;
                                                                                                                end
                                                                                                                
                                                                                                                code[x_, y_, z_] := z
                                                                                                                
                                                                                                                f(x, y, z):
                                                                                                                	x in [-inf, +inf],
                                                                                                                	y in [-inf, +inf],
                                                                                                                	z in [-inf, +inf]
                                                                                                                code: THEORY
                                                                                                                BEGIN
                                                                                                                f(x, y, z: real): real =
                                                                                                                	z
                                                                                                                END code
                                                                                                                z
                                                                                                                
                                                                                                                Derivation
                                                                                                                1. Initial program 99.9%

                                                                                                                  \[\left(\left(\left(\left(x + y\right) + y\right) + x\right) + z\right) + x \]
                                                                                                                2. Step-by-step derivation
                                                                                                                  1. Applied rewrites100.0%

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

                                                                                                                    \[\leadsto z + 3 \cdot x \]
                                                                                                                  3. Step-by-step derivation
                                                                                                                    1. Applied rewrites67.5%

                                                                                                                      \[\leadsto z + 3 \cdot x \]
                                                                                                                    2. Taylor expanded in x around 0

                                                                                                                      \[\leadsto z \]
                                                                                                                    3. Step-by-step derivation
                                                                                                                      1. Applied rewrites34.4%

                                                                                                                        \[\leadsto z \]
                                                                                                                      2. Add Preprocessing

                                                                                                                      Reproduce

                                                                                                                      ?
                                                                                                                      herbie shell --seed 2026092 
                                                                                                                      (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))