Main:bigenough2 from A

Percentage Accurate: 100.0% → 100.0%
Time: 1.4s
Alternatives: 7
Speedup: 1.1×

Specification

?
\[x + y \cdot \left(z + x\right) \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ x (* y (+ z x))))
double code(double x, double y, double z) {
	return x + (y * (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 * (z + x))
end function
public static double code(double x, double y, double z) {
	return x + (y * (z + x));
}
def code(x, y, z):
	return x + (y * (z + x))
function code(x, y, z)
	return Float64(x + Float64(y * Float64(z + x)))
end
function tmp = code(x, y, z)
	tmp = x + (y * (z + x));
end
code[x_, y_, z_] := N[(x + N[(y * N[(z + x), $MachinePrecision]), $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 =
	x + (y * (z + x))
END code
x + y \cdot \left(z + x\right)

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 7 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: 100.0% accurate, 1.0× speedup?

\[x + y \cdot \left(z + x\right) \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ x (* y (+ z x))))
double code(double x, double y, double z) {
	return x + (y * (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 * (z + x))
end function
public static double code(double x, double y, double z) {
	return x + (y * (z + x));
}
def code(x, y, z):
	return x + (y * (z + x))
function code(x, y, z)
	return Float64(x + Float64(y * Float64(z + x)))
end
function tmp = code(x, y, z)
	tmp = x + (y * (z + x));
end
code[x_, y_, z_] := N[(x + N[(y * N[(z + x), $MachinePrecision]), $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 =
	x + (y * (z + x))
END code
x + y \cdot \left(z + x\right)

Alternative 1: 100.0% accurate, 1.1× speedup?

\[\mathsf{fma}\left(y, z + x, x\right) \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (fma y (+ z x) x))
double code(double x, double y, double z) {
	return fma(y, (z + x), x);
}
function code(x, y, z)
	return fma(y, Float64(z + x), x)
end
code[x_, y_, z_] := N[(y * N[(z + x), $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 =
	(y * (z + x)) + x
END code
\mathsf{fma}\left(y, z + x, x\right)
Derivation
  1. Initial program 100.0%

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

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

    Alternative 2: 98.9% accurate, 0.6× speedup?

    \[\begin{array}{l} t_0 := y \cdot \left(x + z\right)\\ \mathbf{if}\;y \leq -1.3910059451961023:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 0.0036597640836557375:\\ \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \]
    (FPCore (x y z)
      :precision binary64
      :pre TRUE
      (let* ((t_0 (* y (+ x z))))
      (if (<= y -1.3910059451961023)
        t_0
        (if (<= y 0.0036597640836557375) (fma y z x) t_0))))
    double code(double x, double y, double z) {
    	double t_0 = y * (x + z);
    	double tmp;
    	if (y <= -1.3910059451961023) {
    		tmp = t_0;
    	} else if (y <= 0.0036597640836557375) {
    		tmp = fma(y, z, x);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(y * Float64(x + z))
    	tmp = 0.0
    	if (y <= -1.3910059451961023)
    		tmp = t_0;
    	elseif (y <= 0.0036597640836557375)
    		tmp = fma(y, z, x);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x + z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3910059451961023], t$95$0, If[LessEqual[y, 0.0036597640836557375], N[(y * z + x), $MachinePrecision], t$95$0]]]
    
    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 t_0 = (y * (x + z)) IN
    		LET tmp_1 = IF (y <= (36597640836557375314253004461306773009710013866424560546875e-61)) THEN ((y * z) + x) ELSE t_0 ENDIF IN
    		LET tmp = IF (y <= (-13910059451961023224697555633611045777797698974609375e-52)) THEN t_0 ELSE tmp_1 ENDIF IN
    	tmp
    END code
    \begin{array}{l}
    t_0 := y \cdot \left(x + z\right)\\
    \mathbf{if}\;y \leq -1.3910059451961023:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y \leq 0.0036597640836557375:\\
    \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -1.3910059451961023 or 0.0036597640836557375 < y

      1. Initial program 100.0%

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

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

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

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

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

              \[\leadsto y \cdot \left(x + z\right) \]

            if -1.3910059451961023 < y < 0.0036597640836557375

            1. Initial program 100.0%

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

              \[\leadsto x + y \cdot z \]
            3. Step-by-step derivation
              1. Applied rewrites76.4%

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

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

              Alternative 3: 85.4% accurate, 0.7× speedup?

              \[\begin{array}{l} \mathbf{if}\;x \leq -4.420245809256181 \cdot 10^{-50}:\\ \;\;\;\;\mathsf{fma}\left(y, x, x\right)\\ \mathbf{elif}\;x \leq 456191841.59206736:\\ \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, x, x\right)\\ \end{array} \]
              (FPCore (x y z)
                :precision binary64
                :pre TRUE
                (if (<= x -4.420245809256181e-50)
                (fma y x x)
                (if (<= x 456191841.59206736) (fma y z x) (fma y x x))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -4.420245809256181e-50) {
              		tmp = fma(y, x, x);
              	} else if (x <= 456191841.59206736) {
              		tmp = fma(y, z, x);
              	} else {
              		tmp = fma(y, x, x);
              	}
              	return tmp;
              }
              
              function code(x, y, z)
              	tmp = 0.0
              	if (x <= -4.420245809256181e-50)
              		tmp = fma(y, x, x);
              	elseif (x <= 456191841.59206736)
              		tmp = fma(y, z, x);
              	else
              		tmp = fma(y, x, x);
              	end
              	return tmp
              end
              
              code[x_, y_, z_] := If[LessEqual[x, -4.420245809256181e-50], N[(y * x + x), $MachinePrecision], If[LessEqual[x, 456191841.59206736], N[(y * z + x), $MachinePrecision], N[(y * x + 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 <= (45619184159206736087799072265625e-23)) THEN ((y * z) + x) ELSE ((y * x) + x) ENDIF IN
              	LET tmp = IF (x <= (-44202458092561807173146183805990310442416852708706562951185861630934021423055811815087956022190442979509568437286867776620587384972527189574975636787712574005126953125e-216)) THEN ((y * x) + x) ELSE tmp_1 ENDIF IN
              	tmp
              END code
              \begin{array}{l}
              \mathbf{if}\;x \leq -4.420245809256181 \cdot 10^{-50}:\\
              \;\;\;\;\mathsf{fma}\left(y, x, x\right)\\
              
              \mathbf{elif}\;x \leq 456191841.59206736:\\
              \;\;\;\;\mathsf{fma}\left(y, z, x\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\mathsf{fma}\left(y, x, x\right)\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if x < -4.4202458092561807e-50 or 456191841.59206736 < x

                1. Initial program 100.0%

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

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

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

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

                    if -4.4202458092561807e-50 < x < 456191841.59206736

                    1. Initial program 100.0%

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

                      \[\leadsto x + y \cdot z \]
                    3. Step-by-step derivation
                      1. Applied rewrites76.4%

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

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

                      Alternative 4: 74.6% accurate, 0.7× speedup?

                      \[\begin{array}{l} \mathbf{if}\;x \leq -1.2014353339475216 \cdot 10^{-53}:\\ \;\;\;\;\mathsf{fma}\left(y, x, x\right)\\ \mathbf{elif}\;x \leq 1.3907246641268288 \cdot 10^{-133}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, x, x\right)\\ \end{array} \]
                      (FPCore (x y z)
                        :precision binary64
                        :pre TRUE
                        (if (<= x -1.2014353339475216e-53)
                        (fma y x x)
                        (if (<= x 1.3907246641268288e-133) (* y z) (fma y x x))))
                      double code(double x, double y, double z) {
                      	double tmp;
                      	if (x <= -1.2014353339475216e-53) {
                      		tmp = fma(y, x, x);
                      	} else if (x <= 1.3907246641268288e-133) {
                      		tmp = y * z;
                      	} else {
                      		tmp = fma(y, x, x);
                      	}
                      	return tmp;
                      }
                      
                      function code(x, y, z)
                      	tmp = 0.0
                      	if (x <= -1.2014353339475216e-53)
                      		tmp = fma(y, x, x);
                      	elseif (x <= 1.3907246641268288e-133)
                      		tmp = Float64(y * z);
                      	else
                      		tmp = fma(y, x, x);
                      	end
                      	return tmp
                      end
                      
                      code[x_, y_, z_] := If[LessEqual[x, -1.2014353339475216e-53], N[(y * x + x), $MachinePrecision], If[LessEqual[x, 1.3907246641268288e-133], N[(y * z), $MachinePrecision], N[(y * x + 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 <= (13907246641268287719553288589367698732274009277678938853341083963550402305825730272558285284260707557226592286720658421468340914383077588215032524302117800378662076704866440675793204111827833749549383931163536547600078549247750976353053708772891633938598045310131695191357079148094045872458853184477607279647119117250357415993544663024295005016028881072998046875e-494)) THEN (y * z) ELSE ((y * x) + x) ENDIF IN
                      	LET tmp = IF (x <= (-1201435333947521567179383940228922831410793169252770766996959593329040310462231836384689301534482831918011668944531164721304996863097958037513990348088555037975311279296875e-224)) THEN ((y * x) + x) ELSE tmp_1 ENDIF IN
                      	tmp
                      END code
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -1.2014353339475216 \cdot 10^{-53}:\\
                      \;\;\;\;\mathsf{fma}\left(y, x, x\right)\\
                      
                      \mathbf{elif}\;x \leq 1.3907246641268288 \cdot 10^{-133}:\\
                      \;\;\;\;y \cdot z\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\mathsf{fma}\left(y, x, x\right)\\
                      
                      
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if x < -1.2014353339475216e-53 or 1.3907246641268288e-133 < x

                        1. Initial program 100.0%

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

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

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

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

                            if -1.2014353339475216e-53 < x < 1.3907246641268288e-133

                            1. Initial program 100.0%

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

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

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

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

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

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

                                Alternative 5: 62.2% accurate, 0.5× speedup?

                                \[\begin{array}{l} \mathbf{if}\;y \leq -1.7369450345442874 \cdot 10^{+177}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq -1.6957869950355719 \cdot 10^{+109}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -1.9567418453105813 \cdot 10^{-16}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;y \leq 2.3080107308185876 \cdot 10^{-32}:\\ \;\;\;\;x \cdot 1\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
                                (FPCore (x y z)
                                  :precision binary64
                                  :pre TRUE
                                  (if (<= y -1.7369450345442874e+177)
                                  (* y z)
                                  (if (<= y -1.6957869950355719e+109)
                                    (* x y)
                                    (if (<= y -1.9567418453105813e-16)
                                      (* y z)
                                      (if (<= y 2.3080107308185876e-32) (* x 1.0) (* y z))))))
                                double code(double x, double y, double z) {
                                	double tmp;
                                	if (y <= -1.7369450345442874e+177) {
                                		tmp = y * z;
                                	} else if (y <= -1.6957869950355719e+109) {
                                		tmp = x * y;
                                	} else if (y <= -1.9567418453105813e-16) {
                                		tmp = y * z;
                                	} else if (y <= 2.3080107308185876e-32) {
                                		tmp = x * 1.0;
                                	} else {
                                		tmp = y * z;
                                	}
                                	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 <= (-1.7369450345442874d+177)) then
                                        tmp = y * z
                                    else if (y <= (-1.6957869950355719d+109)) then
                                        tmp = x * y
                                    else if (y <= (-1.9567418453105813d-16)) then
                                        tmp = y * z
                                    else if (y <= 2.3080107308185876d-32) then
                                        tmp = x * 1.0d0
                                    else
                                        tmp = y * z
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double x, double y, double z) {
                                	double tmp;
                                	if (y <= -1.7369450345442874e+177) {
                                		tmp = y * z;
                                	} else if (y <= -1.6957869950355719e+109) {
                                		tmp = x * y;
                                	} else if (y <= -1.9567418453105813e-16) {
                                		tmp = y * z;
                                	} else if (y <= 2.3080107308185876e-32) {
                                		tmp = x * 1.0;
                                	} else {
                                		tmp = y * z;
                                	}
                                	return tmp;
                                }
                                
                                def code(x, y, z):
                                	tmp = 0
                                	if y <= -1.7369450345442874e+177:
                                		tmp = y * z
                                	elif y <= -1.6957869950355719e+109:
                                		tmp = x * y
                                	elif y <= -1.9567418453105813e-16:
                                		tmp = y * z
                                	elif y <= 2.3080107308185876e-32:
                                		tmp = x * 1.0
                                	else:
                                		tmp = y * z
                                	return tmp
                                
                                function code(x, y, z)
                                	tmp = 0.0
                                	if (y <= -1.7369450345442874e+177)
                                		tmp = Float64(y * z);
                                	elseif (y <= -1.6957869950355719e+109)
                                		tmp = Float64(x * y);
                                	elseif (y <= -1.9567418453105813e-16)
                                		tmp = Float64(y * z);
                                	elseif (y <= 2.3080107308185876e-32)
                                		tmp = Float64(x * 1.0);
                                	else
                                		tmp = Float64(y * z);
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(x, y, z)
                                	tmp = 0.0;
                                	if (y <= -1.7369450345442874e+177)
                                		tmp = y * z;
                                	elseif (y <= -1.6957869950355719e+109)
                                		tmp = x * y;
                                	elseif (y <= -1.9567418453105813e-16)
                                		tmp = y * z;
                                	elseif (y <= 2.3080107308185876e-32)
                                		tmp = x * 1.0;
                                	else
                                		tmp = y * z;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[x_, y_, z_] := If[LessEqual[y, -1.7369450345442874e+177], N[(y * z), $MachinePrecision], If[LessEqual[y, -1.6957869950355719e+109], N[(x * y), $MachinePrecision], If[LessEqual[y, -1.9567418453105813e-16], N[(y * z), $MachinePrecision], If[LessEqual[y, 2.3080107308185876e-32], N[(x * 1.0), $MachinePrecision], N[(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_3 = IF (y <= (2308010730818587590762110147375810142062287416606639275854782999805688643013554654814280253649627638878882862627506256103515625e-158)) THEN (x * (1)) ELSE (y * z) ENDIF IN
                                	LET tmp_2 = IF (y <= (-195674184531058127709734167246648549435989266850367818140199460685835219919681549072265625e-105)) THEN (y * z) ELSE tmp_3 ENDIF IN
                                	LET tmp_1 = IF (y <= (-16957869950355718931465531247763550139979082796806578673657974316572747102086548313566244811727926991247114240)) THEN (x * y) ELSE tmp_2 ENDIF IN
                                	LET tmp = IF (y <= (-1736945034544287412347033863073873456965503088732749302439491853026289663537555191881741523762841739547105102182173562149034075232772331190135807316162207859763136650384978739200)) THEN (y * z) ELSE tmp_1 ENDIF IN
                                	tmp
                                END code
                                \begin{array}{l}
                                \mathbf{if}\;y \leq -1.7369450345442874 \cdot 10^{+177}:\\
                                \;\;\;\;y \cdot z\\
                                
                                \mathbf{elif}\;y \leq -1.6957869950355719 \cdot 10^{+109}:\\
                                \;\;\;\;x \cdot y\\
                                
                                \mathbf{elif}\;y \leq -1.9567418453105813 \cdot 10^{-16}:\\
                                \;\;\;\;y \cdot z\\
                                
                                \mathbf{elif}\;y \leq 2.3080107308185876 \cdot 10^{-32}:\\
                                \;\;\;\;x \cdot 1\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;y \cdot z\\
                                
                                
                                \end{array}
                                
                                Derivation
                                1. Split input into 3 regimes
                                2. if y < -1.7369450345442874e177 or -1.6957869950355719e109 < y < -1.9567418453105813e-16 or 2.3080107308185876e-32 < y

                                  1. Initial program 100.0%

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

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

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

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

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

                                          \[\leadsto y \cdot z \]

                                        if -1.7369450345442874e177 < y < -1.6957869950355719e109

                                        1. Initial program 100.0%

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

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

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

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

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

                                                \[\leadsto x \cdot y \]

                                              if -1.9567418453105813e-16 < y < 2.3080107308185876e-32

                                              1. Initial program 100.0%

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

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

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

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

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

                                                Alternative 6: 61.0% accurate, 0.8× speedup?

                                                \[\begin{array}{l} \mathbf{if}\;y \leq -1.3910059451961023:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 0.0036597640836557375:\\ \;\;\;\;x \cdot 1\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
                                                (FPCore (x y z)
                                                  :precision binary64
                                                  :pre TRUE
                                                  (if (<= y -1.3910059451961023)
                                                  (* x y)
                                                  (if (<= y 0.0036597640836557375) (* x 1.0) (* x y))))
                                                double code(double x, double y, double z) {
                                                	double tmp;
                                                	if (y <= -1.3910059451961023) {
                                                		tmp = x * y;
                                                	} else if (y <= 0.0036597640836557375) {
                                                		tmp = x * 1.0;
                                                	} else {
                                                		tmp = x * 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 <= (-1.3910059451961023d0)) then
                                                        tmp = x * y
                                                    else if (y <= 0.0036597640836557375d0) then
                                                        tmp = x * 1.0d0
                                                    else
                                                        tmp = x * y
                                                    end if
                                                    code = tmp
                                                end function
                                                
                                                public static double code(double x, double y, double z) {
                                                	double tmp;
                                                	if (y <= -1.3910059451961023) {
                                                		tmp = x * y;
                                                	} else if (y <= 0.0036597640836557375) {
                                                		tmp = x * 1.0;
                                                	} else {
                                                		tmp = x * y;
                                                	}
                                                	return tmp;
                                                }
                                                
                                                def code(x, y, z):
                                                	tmp = 0
                                                	if y <= -1.3910059451961023:
                                                		tmp = x * y
                                                	elif y <= 0.0036597640836557375:
                                                		tmp = x * 1.0
                                                	else:
                                                		tmp = x * y
                                                	return tmp
                                                
                                                function code(x, y, z)
                                                	tmp = 0.0
                                                	if (y <= -1.3910059451961023)
                                                		tmp = Float64(x * y);
                                                	elseif (y <= 0.0036597640836557375)
                                                		tmp = Float64(x * 1.0);
                                                	else
                                                		tmp = Float64(x * y);
                                                	end
                                                	return tmp
                                                end
                                                
                                                function tmp_2 = code(x, y, z)
                                                	tmp = 0.0;
                                                	if (y <= -1.3910059451961023)
                                                		tmp = x * y;
                                                	elseif (y <= 0.0036597640836557375)
                                                		tmp = x * 1.0;
                                                	else
                                                		tmp = x * y;
                                                	end
                                                	tmp_2 = tmp;
                                                end
                                                
                                                code[x_, y_, z_] := If[LessEqual[y, -1.3910059451961023], N[(x * y), $MachinePrecision], If[LessEqual[y, 0.0036597640836557375], N[(x * 1.0), $MachinePrecision], N[(x * 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 <= (36597640836557375314253004461306773009710013866424560546875e-61)) THEN (x * (1)) ELSE (x * y) ENDIF IN
                                                	LET tmp = IF (y <= (-13910059451961023224697555633611045777797698974609375e-52)) THEN (x * y) ELSE tmp_1 ENDIF IN
                                                	tmp
                                                END code
                                                \begin{array}{l}
                                                \mathbf{if}\;y \leq -1.3910059451961023:\\
                                                \;\;\;\;x \cdot y\\
                                                
                                                \mathbf{elif}\;y \leq 0.0036597640836557375:\\
                                                \;\;\;\;x \cdot 1\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;x \cdot y\\
                                                
                                                
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 2 regimes
                                                2. if y < -1.3910059451961023 or 0.0036597640836557375 < y

                                                  1. Initial program 100.0%

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

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

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

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

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

                                                          \[\leadsto x \cdot y \]

                                                        if -1.3910059451961023 < y < 0.0036597640836557375

                                                        1. Initial program 100.0%

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

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

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

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

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

                                                          Alternative 7: 37.3% accurate, 2.3× speedup?

                                                          \[x \cdot 1 \]
                                                          (FPCore (x y z)
                                                            :precision binary64
                                                            :pre TRUE
                                                            (* x 1.0))
                                                          double code(double x, double y, double z) {
                                                          	return x * 1.0;
                                                          }
                                                          
                                                          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 * 1.0d0
                                                          end function
                                                          
                                                          public static double code(double x, double y, double z) {
                                                          	return x * 1.0;
                                                          }
                                                          
                                                          def code(x, y, z):
                                                          	return x * 1.0
                                                          
                                                          function code(x, y, z)
                                                          	return Float64(x * 1.0)
                                                          end
                                                          
                                                          function tmp = code(x, y, z)
                                                          	tmp = x * 1.0;
                                                          end
                                                          
                                                          code[x_, y_, z_] := N[(x * 1.0), $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 * (1)
                                                          END code
                                                          x \cdot 1
                                                          
                                                          Derivation
                                                          1. Initial program 100.0%

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

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

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

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

                                                                \[\leadsto x \cdot 1 \]
                                                              2. Add Preprocessing

                                                              Reproduce

                                                              ?
                                                              herbie shell --seed 2026092 
                                                              (FPCore (x y z)
                                                                :name "Main:bigenough2 from A"
                                                                :precision binary64
                                                                (+ x (* y (+ z x))))