Numeric.SpecFunctions:choose from math-functions-0.1.5.2

Percentage Accurate: 84.5% → 97.2%
Time: 8.8s
Alternatives: 7
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

Alternative 1: 97.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2e19

    1. Initial program 91.4%

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. +-commutativeN/A

        \[\leadsto x \cdot \frac{\color{blue}{z + y}}{z} \]
      3. *-lft-identityN/A

        \[\leadsto x \cdot \frac{z + \color{blue}{1 \cdot y}}{z} \]
      4. metadata-evalN/A

        \[\leadsto x \cdot \frac{z + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot y}{z} \]
      5. cancel-sign-sub-invN/A

        \[\leadsto x \cdot \frac{\color{blue}{z - -1 \cdot y}}{z} \]
      6. div-subN/A

        \[\leadsto x \cdot \color{blue}{\left(\frac{z}{z} - \frac{-1 \cdot y}{z}\right)} \]
      7. *-inversesN/A

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

        \[\leadsto x \cdot \left(1 - \color{blue}{-1 \cdot \frac{y}{z}}\right) \]
      9. distribute-rgt-out--N/A

        \[\leadsto \color{blue}{1 \cdot x - \left(-1 \cdot \frac{y}{z}\right) \cdot x} \]
      10. *-lft-identityN/A

        \[\leadsto \color{blue}{x} - \left(-1 \cdot \frac{y}{z}\right) \cdot x \]
      11. mul-1-negN/A

        \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z}\right)\right)} \cdot x \]
      12. cancel-sign-subN/A

        \[\leadsto \color{blue}{x + \frac{y}{z} \cdot x} \]
      13. distribute-rgt1-inN/A

        \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right) \cdot x} \]
      14. distribute-lft1-inN/A

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} + x \]
      16. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{z}, x\right)} \]
      17. lower-/.f6489.9

        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\frac{y}{z}}, x\right) \]
    5. Applied rewrites89.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{z}, x\right)} \]
    6. Step-by-step derivation
      1. lift-/.f64N/A

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

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

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

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

        \[\leadsto \left(y \cdot \color{blue}{\frac{1}{z}}\right) \cdot x + x \]
      6. associate-*l*N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{1}{z} \cdot x, x\right)} \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{x \cdot \frac{1}{z}}, x\right) \]
      9. lift-/.f64N/A

        \[\leadsto \mathsf{fma}\left(y, x \cdot \color{blue}{\frac{1}{z}}, x\right) \]
      10. div-invN/A

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{x}{z}}, x\right) \]
      11. lower-/.f6499.8

        \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{x}{z}}, x\right) \]
    7. Applied rewrites99.8%

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

    if -2e19 < y

    1. Initial program 84.7%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
      6. lower-/.f6498.9

        \[\leadsto \frac{x}{\color{blue}{\frac{z}{y + z}}} \]
    4. Applied rewrites98.9%

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

Alternative 2: 73.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-8}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -2.1e-8) (* y (/ x z)) (if (<= y 1.06e+26) x (/ (* y x) z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.1e-8) {
		tmp = y * (x / z);
	} else if (y <= 1.06e+26) {
		tmp = x;
	} else {
		tmp = (y * x) / z;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (y <= (-2.1d-8)) then
        tmp = y * (x / z)
    else if (y <= 1.06d+26) then
        tmp = x
    else
        tmp = (y * x) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.1e-8) {
		tmp = y * (x / z);
	} else if (y <= 1.06e+26) {
		tmp = x;
	} else {
		tmp = (y * x) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -2.1e-8:
		tmp = y * (x / z)
	elif y <= 1.06e+26:
		tmp = x
	else:
		tmp = (y * x) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -2.1e-8)
		tmp = Float64(y * Float64(x / z));
	elseif (y <= 1.06e+26)
		tmp = x;
	else
		tmp = Float64(Float64(y * x) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -2.1e-8)
		tmp = y * (x / z);
	elseif (y <= 1.06e+26)
		tmp = x;
	else
		tmp = (y * x) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -2.1e-8], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.06e+26], x, N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.1 \cdot 10^{-8}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{elif}\;y \leq 1.06 \cdot 10^{+26}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.09999999999999994e-8

    1. Initial program 92.6%

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      2. lower-*.f6476.7

        \[\leadsto \frac{\color{blue}{x \cdot y}}{z} \]
    5. Applied rewrites76.7%

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

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

        \[\leadsto \color{blue}{\frac{y}{z} \cdot x} \]
      3. div-invN/A

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

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

        \[\leadsto \color{blue}{y \cdot \left(\frac{1}{z} \cdot x\right)} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{y \cdot \left(\frac{1}{z} \cdot x\right)} \]
      7. *-commutativeN/A

        \[\leadsto y \cdot \color{blue}{\left(x \cdot \frac{1}{z}\right)} \]
      8. lift-/.f64N/A

        \[\leadsto y \cdot \left(x \cdot \color{blue}{\frac{1}{z}}\right) \]
      9. div-invN/A

        \[\leadsto y \cdot \color{blue}{\frac{x}{z}} \]
      10. lower-/.f6478.0

        \[\leadsto y \cdot \color{blue}{\frac{x}{z}} \]
    7. Applied rewrites78.0%

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

    if -2.09999999999999994e-8 < y < 1.05999999999999997e26

    1. Initial program 80.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
      6. lower-/.f6499.9

        \[\leadsto \frac{x}{\color{blue}{\frac{z}{y + z}}} \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
    5. Taylor expanded in z around inf

      \[\leadsto \frac{x}{\color{blue}{1}} \]
    6. Step-by-step derivation
      1. Applied rewrites78.7%

        \[\leadsto \frac{x}{\color{blue}{1}} \]
      2. Step-by-step derivation
        1. /-rgt-identity78.7

          \[\leadsto \color{blue}{x} \]
      3. Applied rewrites78.7%

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

      if 1.05999999999999997e26 < y

      1. Initial program 90.6%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
        2. lower-*.f6477.5

          \[\leadsto \frac{\color{blue}{x \cdot y}}{z} \]
      5. Applied rewrites77.5%

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
    7. Recombined 3 regimes into one program.
    8. Final simplification78.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-8}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 3: 72.9% accurate, 0.7× speedup?

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

      1. Initial program 92.6%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
        2. lower-*.f6476.7

          \[\leadsto \frac{\color{blue}{x \cdot y}}{z} \]
      5. Applied rewrites76.7%

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

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

          \[\leadsto \color{blue}{\frac{y}{z} \cdot x} \]
        3. div-invN/A

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

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

          \[\leadsto \color{blue}{y \cdot \left(\frac{1}{z} \cdot x\right)} \]
        6. lower-*.f64N/A

          \[\leadsto \color{blue}{y \cdot \left(\frac{1}{z} \cdot x\right)} \]
        7. *-commutativeN/A

          \[\leadsto y \cdot \color{blue}{\left(x \cdot \frac{1}{z}\right)} \]
        8. lift-/.f64N/A

          \[\leadsto y \cdot \left(x \cdot \color{blue}{\frac{1}{z}}\right) \]
        9. div-invN/A

          \[\leadsto y \cdot \color{blue}{\frac{x}{z}} \]
        10. lower-/.f6478.0

          \[\leadsto y \cdot \color{blue}{\frac{x}{z}} \]
      7. Applied rewrites78.0%

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

      if -2.09999999999999994e-8 < y < 1.05999999999999997e26

      1. Initial program 80.9%

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
        6. lower-/.f6499.9

          \[\leadsto \frac{x}{\color{blue}{\frac{z}{y + z}}} \]
      4. Applied rewrites99.9%

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
      5. Taylor expanded in z around inf

        \[\leadsto \frac{x}{\color{blue}{1}} \]
      6. Step-by-step derivation
        1. Applied rewrites78.7%

          \[\leadsto \frac{x}{\color{blue}{1}} \]
        2. Step-by-step derivation
          1. /-rgt-identity78.7

            \[\leadsto \color{blue}{x} \]
        3. Applied rewrites78.7%

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

        if 1.05999999999999997e26 < y

        1. Initial program 90.6%

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

          \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
          2. lower-*.f6477.5

            \[\leadsto \frac{\color{blue}{x \cdot y}}{z} \]
        5. Applied rewrites77.5%

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

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

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

            \[\leadsto \color{blue}{\frac{y}{z} \cdot x} \]
          4. lower-*.f6475.9

            \[\leadsto \color{blue}{\frac{y}{z} \cdot x} \]
        7. Applied rewrites75.9%

          \[\leadsto \color{blue}{\frac{y}{z} \cdot x} \]
      7. Recombined 3 regimes into one program.
      8. Final simplification77.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-8}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 4: 73.8% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;y \leq -2.1 \cdot 10^{-8}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.06 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (x y z)
       :precision binary64
       (let* ((t_0 (* y (/ x z))))
         (if (<= y -2.1e-8) t_0 (if (<= y 1.06e+26) x t_0))))
      double code(double x, double y, double z) {
      	double t_0 = y * (x / z);
      	double tmp;
      	if (y <= -2.1e-8) {
      		tmp = t_0;
      	} else if (y <= 1.06e+26) {
      		tmp = x;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      real(8) function code(x, y, z)
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8), intent (in) :: z
          real(8) :: t_0
          real(8) :: tmp
          t_0 = y * (x / z)
          if (y <= (-2.1d-8)) then
              tmp = t_0
          else if (y <= 1.06d+26) then
              tmp = x
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = y * (x / z);
      	double tmp;
      	if (y <= -2.1e-8) {
      		tmp = t_0;
      	} else if (y <= 1.06e+26) {
      		tmp = x;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = y * (x / z)
      	tmp = 0
      	if y <= -2.1e-8:
      		tmp = t_0
      	elif y <= 1.06e+26:
      		tmp = x
      	else:
      		tmp = t_0
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(y * Float64(x / z))
      	tmp = 0.0
      	if (y <= -2.1e-8)
      		tmp = t_0;
      	elseif (y <= 1.06e+26)
      		tmp = x;
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = y * (x / z);
      	tmp = 0.0;
      	if (y <= -2.1e-8)
      		tmp = t_0;
      	elseif (y <= 1.06e+26)
      		tmp = x;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.1e-8], t$95$0, If[LessEqual[y, 1.06e+26], x, t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := y \cdot \frac{x}{z}\\
      \mathbf{if}\;y \leq -2.1 \cdot 10^{-8}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y \leq 1.06 \cdot 10^{+26}:\\
      \;\;\;\;x\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -2.09999999999999994e-8 or 1.05999999999999997e26 < y

        1. Initial program 91.6%

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

          \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
          2. lower-*.f6477.1

            \[\leadsto \frac{\color{blue}{x \cdot y}}{z} \]
        5. Applied rewrites77.1%

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

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

            \[\leadsto \color{blue}{\frac{y}{z} \cdot x} \]
          3. div-invN/A

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

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

            \[\leadsto \color{blue}{y \cdot \left(\frac{1}{z} \cdot x\right)} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{y \cdot \left(\frac{1}{z} \cdot x\right)} \]
          7. *-commutativeN/A

            \[\leadsto y \cdot \color{blue}{\left(x \cdot \frac{1}{z}\right)} \]
          8. lift-/.f64N/A

            \[\leadsto y \cdot \left(x \cdot \color{blue}{\frac{1}{z}}\right) \]
          9. div-invN/A

            \[\leadsto y \cdot \color{blue}{\frac{x}{z}} \]
          10. lower-/.f6476.5

            \[\leadsto y \cdot \color{blue}{\frac{x}{z}} \]
        7. Applied rewrites76.5%

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

        if -2.09999999999999994e-8 < y < 1.05999999999999997e26

        1. Initial program 80.9%

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
          6. lower-/.f6499.9

            \[\leadsto \frac{x}{\color{blue}{\frac{z}{y + z}}} \]
        4. Applied rewrites99.9%

          \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
        5. Taylor expanded in z around inf

          \[\leadsto \frac{x}{\color{blue}{1}} \]
        6. Step-by-step derivation
          1. Applied rewrites78.7%

            \[\leadsto \frac{x}{\color{blue}{1}} \]
          2. Step-by-step derivation
            1. /-rgt-identity78.7

              \[\leadsto \color{blue}{x} \]
          3. Applied rewrites78.7%

            \[\leadsto \color{blue}{x} \]
        7. Recombined 2 regimes into one program.
        8. Add Preprocessing

        Alternative 5: 97.1% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -500000000:\\ \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -500000000.0) (fma y (/ x z) x) (fma x (/ y z) x)))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -500000000.0) {
        		tmp = fma(y, (x / z), x);
        	} else {
        		tmp = fma(x, (y / z), x);
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -500000000.0)
        		tmp = fma(y, Float64(x / z), x);
        	else
        		tmp = fma(x, Float64(y / z), x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -500000000.0], N[(y * N[(x / z), $MachinePrecision] + x), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -500000000:\\
        \;\;\;\;\mathsf{fma}\left(y, \frac{x}{z}, x\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -5e8

          1. Initial program 92.1%

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

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

              \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
            2. +-commutativeN/A

              \[\leadsto x \cdot \frac{\color{blue}{z + y}}{z} \]
            3. *-lft-identityN/A

              \[\leadsto x \cdot \frac{z + \color{blue}{1 \cdot y}}{z} \]
            4. metadata-evalN/A

              \[\leadsto x \cdot \frac{z + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot y}{z} \]
            5. cancel-sign-sub-invN/A

              \[\leadsto x \cdot \frac{\color{blue}{z - -1 \cdot y}}{z} \]
            6. div-subN/A

              \[\leadsto x \cdot \color{blue}{\left(\frac{z}{z} - \frac{-1 \cdot y}{z}\right)} \]
            7. *-inversesN/A

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

              \[\leadsto x \cdot \left(1 - \color{blue}{-1 \cdot \frac{y}{z}}\right) \]
            9. distribute-rgt-out--N/A

              \[\leadsto \color{blue}{1 \cdot x - \left(-1 \cdot \frac{y}{z}\right) \cdot x} \]
            10. *-lft-identityN/A

              \[\leadsto \color{blue}{x} - \left(-1 \cdot \frac{y}{z}\right) \cdot x \]
            11. mul-1-negN/A

              \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z}\right)\right)} \cdot x \]
            12. cancel-sign-subN/A

              \[\leadsto \color{blue}{x + \frac{y}{z} \cdot x} \]
            13. distribute-rgt1-inN/A

              \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right) \cdot x} \]
            14. distribute-lft1-inN/A

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

              \[\leadsto \color{blue}{x \cdot \frac{y}{z}} + x \]
            16. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{z}, x\right)} \]
            17. lower-/.f6490.7

              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\frac{y}{z}}, x\right) \]
          5. Applied rewrites90.7%

            \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{z}, x\right)} \]
          6. Step-by-step derivation
            1. lift-/.f64N/A

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

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

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

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

              \[\leadsto \left(y \cdot \color{blue}{\frac{1}{z}}\right) \cdot x + x \]
            6. associate-*l*N/A

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

              \[\leadsto \color{blue}{\mathsf{fma}\left(y, \frac{1}{z} \cdot x, x\right)} \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{fma}\left(y, \color{blue}{x \cdot \frac{1}{z}}, x\right) \]
            9. lift-/.f64N/A

              \[\leadsto \mathsf{fma}\left(y, x \cdot \color{blue}{\frac{1}{z}}, x\right) \]
            10. div-invN/A

              \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{x}{z}}, x\right) \]
            11. lower-/.f6499.8

              \[\leadsto \mathsf{fma}\left(y, \color{blue}{\frac{x}{z}}, x\right) \]
          7. Applied rewrites99.8%

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

          if -5e8 < y

          1. Initial program 84.3%

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

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

              \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
            2. +-commutativeN/A

              \[\leadsto x \cdot \frac{\color{blue}{z + y}}{z} \]
            3. *-lft-identityN/A

              \[\leadsto x \cdot \frac{z + \color{blue}{1 \cdot y}}{z} \]
            4. metadata-evalN/A

              \[\leadsto x \cdot \frac{z + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot y}{z} \]
            5. cancel-sign-sub-invN/A

              \[\leadsto x \cdot \frac{\color{blue}{z - -1 \cdot y}}{z} \]
            6. div-subN/A

              \[\leadsto x \cdot \color{blue}{\left(\frac{z}{z} - \frac{-1 \cdot y}{z}\right)} \]
            7. *-inversesN/A

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

              \[\leadsto x \cdot \left(1 - \color{blue}{-1 \cdot \frac{y}{z}}\right) \]
            9. distribute-rgt-out--N/A

              \[\leadsto \color{blue}{1 \cdot x - \left(-1 \cdot \frac{y}{z}\right) \cdot x} \]
            10. *-lft-identityN/A

              \[\leadsto \color{blue}{x} - \left(-1 \cdot \frac{y}{z}\right) \cdot x \]
            11. mul-1-negN/A

              \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z}\right)\right)} \cdot x \]
            12. cancel-sign-subN/A

              \[\leadsto \color{blue}{x + \frac{y}{z} \cdot x} \]
            13. distribute-rgt1-inN/A

              \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right) \cdot x} \]
            14. distribute-lft1-inN/A

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

              \[\leadsto \color{blue}{x \cdot \frac{y}{z}} + x \]
            16. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{z}, x\right)} \]
            17. lower-/.f6498.4

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

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

        Alternative 6: 95.8% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+197}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\ \end{array} \end{array} \]
        (FPCore (x y z)
         :precision binary64
         (if (<= y -3.2e+197) (* y (/ x z)) (fma x (/ y z) x)))
        double code(double x, double y, double z) {
        	double tmp;
        	if (y <= -3.2e+197) {
        		tmp = y * (x / z);
        	} else {
        		tmp = fma(x, (y / z), x);
        	}
        	return tmp;
        }
        
        function code(x, y, z)
        	tmp = 0.0
        	if (y <= -3.2e+197)
        		tmp = Float64(y * Float64(x / z));
        	else
        		tmp = fma(x, Float64(y / z), x);
        	end
        	return tmp
        end
        
        code[x_, y_, z_] := If[LessEqual[y, -3.2e+197], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision] + x), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -3.2 \cdot 10^{+197}:\\
        \;\;\;\;y \cdot \frac{x}{z}\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -3.1999999999999998e197

          1. Initial program 91.1%

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

            \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
            2. lower-*.f6491.1

              \[\leadsto \frac{\color{blue}{x \cdot y}}{z} \]
          5. Applied rewrites91.1%

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

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

              \[\leadsto \color{blue}{\frac{y}{z} \cdot x} \]
            3. div-invN/A

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

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

              \[\leadsto \color{blue}{y \cdot \left(\frac{1}{z} \cdot x\right)} \]
            6. lower-*.f64N/A

              \[\leadsto \color{blue}{y \cdot \left(\frac{1}{z} \cdot x\right)} \]
            7. *-commutativeN/A

              \[\leadsto y \cdot \color{blue}{\left(x \cdot \frac{1}{z}\right)} \]
            8. lift-/.f64N/A

              \[\leadsto y \cdot \left(x \cdot \color{blue}{\frac{1}{z}}\right) \]
            9. div-invN/A

              \[\leadsto y \cdot \color{blue}{\frac{x}{z}} \]
            10. lower-/.f6499.3

              \[\leadsto y \cdot \color{blue}{\frac{x}{z}} \]
          7. Applied rewrites99.3%

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

          if -3.1999999999999998e197 < y

          1. Initial program 85.8%

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

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

              \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
            2. +-commutativeN/A

              \[\leadsto x \cdot \frac{\color{blue}{z + y}}{z} \]
            3. *-lft-identityN/A

              \[\leadsto x \cdot \frac{z + \color{blue}{1 \cdot y}}{z} \]
            4. metadata-evalN/A

              \[\leadsto x \cdot \frac{z + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot y}{z} \]
            5. cancel-sign-sub-invN/A

              \[\leadsto x \cdot \frac{\color{blue}{z - -1 \cdot y}}{z} \]
            6. div-subN/A

              \[\leadsto x \cdot \color{blue}{\left(\frac{z}{z} - \frac{-1 \cdot y}{z}\right)} \]
            7. *-inversesN/A

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

              \[\leadsto x \cdot \left(1 - \color{blue}{-1 \cdot \frac{y}{z}}\right) \]
            9. distribute-rgt-out--N/A

              \[\leadsto \color{blue}{1 \cdot x - \left(-1 \cdot \frac{y}{z}\right) \cdot x} \]
            10. *-lft-identityN/A

              \[\leadsto \color{blue}{x} - \left(-1 \cdot \frac{y}{z}\right) \cdot x \]
            11. mul-1-negN/A

              \[\leadsto x - \color{blue}{\left(\mathsf{neg}\left(\frac{y}{z}\right)\right)} \cdot x \]
            12. cancel-sign-subN/A

              \[\leadsto \color{blue}{x + \frac{y}{z} \cdot x} \]
            13. distribute-rgt1-inN/A

              \[\leadsto \color{blue}{\left(\frac{y}{z} + 1\right) \cdot x} \]
            14. distribute-lft1-inN/A

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

              \[\leadsto \color{blue}{x \cdot \frac{y}{z}} + x \]
            16. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{z}, x\right)} \]
            17. lower-/.f6498.2

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

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

        Alternative 7: 51.9% accurate, 20.0× speedup?

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

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

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

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

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

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

            \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
          6. lower-/.f6497.2

            \[\leadsto \frac{x}{\color{blue}{\frac{z}{y + z}}} \]
        4. Applied rewrites97.2%

          \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
        5. Taylor expanded in z around inf

          \[\leadsto \frac{x}{\color{blue}{1}} \]
        6. Step-by-step derivation
          1. Applied rewrites50.9%

            \[\leadsto \frac{x}{\color{blue}{1}} \]
          2. Step-by-step derivation
            1. /-rgt-identity50.9

              \[\leadsto \color{blue}{x} \]
          3. Applied rewrites50.9%

            \[\leadsto \color{blue}{x} \]
          4. Add Preprocessing

          Developer Target 1: 96.6% accurate, 0.8× speedup?

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

          Reproduce

          ?
          herbie shell --seed 2024214 
          (FPCore (x y z)
            :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
            :precision binary64
          
            :alt
            (! :herbie-platform default (/ x (/ z (+ y z))))
          
            (/ (* x (+ y z)) z))