Numeric.SpecFunctions:choose from math-functions-0.1.5.2

Percentage Accurate: 84.6% → 95.9%
Time: 5.0s
Alternatives: 7
Speedup: 1.0×

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.6% 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: 95.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(x, \frac{y}{z}, x\right) \end{array} \]
(FPCore (x y z) :precision binary64 (fma x (/ y z) x))
double code(double x, double y, double z) {
	return fma(x, (y / z), x);
}
function code(x, y, z)
	return fma(x, Float64(y / z), x)
end
code[x_, y_, z_] := N[(x * N[(y / z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(x, \frac{y}{z}, x\right)
\end{array}
Derivation
  1. Initial program 84.0%

    \[\frac{x \cdot \left(y + z\right)}{z} \]
  2. Step-by-step derivation
    1. associate-*l/84.3%

      \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(y + z\right)} \]
    2. remove-double-neg84.3%

      \[\leadsto \frac{x}{z} \cdot \left(y + \color{blue}{\left(-\left(-z\right)\right)}\right) \]
    3. unsub-neg84.3%

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\left(y - \left(-z\right)\right)} \]
    4. distribute-rgt-out--80.6%

      \[\leadsto \color{blue}{y \cdot \frac{x}{z} - \left(-z\right) \cdot \frac{x}{z}} \]
    5. associate-*r/74.5%

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}} - \left(-z\right) \cdot \frac{x}{z} \]
    6. *-commutative74.5%

      \[\leadsto \frac{\color{blue}{x \cdot y}}{z} - \left(-z\right) \cdot \frac{x}{z} \]
    7. associate-*r/78.5%

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

      \[\leadsto x \cdot \frac{y}{z} - \color{blue}{\frac{\left(-z\right) \cdot x}{z}} \]
    9. distribute-lft-neg-out83.3%

      \[\leadsto x \cdot \frac{y}{z} - \frac{\color{blue}{-z \cdot x}}{z} \]
    10. distribute-frac-neg83.3%

      \[\leadsto x \cdot \frac{y}{z} - \color{blue}{\left(-\frac{z \cdot x}{z}\right)} \]
    11. distribute-frac-neg283.3%

      \[\leadsto x \cdot \frac{y}{z} - \color{blue}{\frac{z \cdot x}{-z}} \]
    12. fma-neg83.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{z}, -\frac{z \cdot x}{-z}\right)} \]
    13. distribute-frac-neg83.3%

      \[\leadsto \mathsf{fma}\left(x, \frac{y}{z}, \color{blue}{\frac{-z \cdot x}{-z}}\right) \]
    14. distribute-lft-neg-out83.3%

      \[\leadsto \mathsf{fma}\left(x, \frac{y}{z}, \frac{\color{blue}{\left(-z\right) \cdot x}}{-z}\right) \]
    15. *-commutative83.3%

      \[\leadsto \mathsf{fma}\left(x, \frac{y}{z}, \frac{\color{blue}{x \cdot \left(-z\right)}}{-z}\right) \]
    16. associate-/l*96.2%

      \[\leadsto \mathsf{fma}\left(x, \frac{y}{z}, \color{blue}{x \cdot \frac{-z}{-z}}\right) \]
    17. *-inverses96.2%

      \[\leadsto \mathsf{fma}\left(x, \frac{y}{z}, x \cdot \color{blue}{1}\right) \]
    18. *-rgt-identity96.2%

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, \frac{y}{z}, x\right)} \]
  4. Add Preprocessing
  5. Final simplification96.2%

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

Alternative 2: 70.7% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-71}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 24000:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.4999999999999994e-71 or 24000 < z

    1. Initial program 75.3%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. remove-double-neg99.9%

        \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
      3. distribute-frac-neg299.9%

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
      4. neg-sub099.9%

        \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
      5. remove-double-neg99.9%

        \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
      6. unsub-neg99.9%

        \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
      7. div-sub99.9%

        \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
      8. *-inverses99.9%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
      9. metadata-eval99.9%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
      10. associate--r-99.9%

        \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
      11. neg-sub099.9%

        \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
      12. distribute-frac-neg299.9%

        \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
      13. remove-double-neg99.9%

        \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
      14. sub-neg99.9%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 80.1%

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

    if -9.4999999999999994e-71 < z < 24000

    1. Initial program 93.1%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*92.3%

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. remove-double-neg92.3%

        \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
      3. distribute-frac-neg292.3%

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
      4. neg-sub092.3%

        \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
      5. remove-double-neg92.3%

        \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
      6. unsub-neg92.3%

        \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
      7. div-sub92.3%

        \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
      8. *-inverses92.3%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
      9. metadata-eval92.3%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
      10. associate--r-92.3%

        \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
      11. neg-sub092.3%

        \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
      12. distribute-frac-neg292.3%

        \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
      13. remove-double-neg92.3%

        \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
      14. sub-neg92.3%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
    3. Simplified92.3%

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 76.3%

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    7. Simplified72.1%

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{-71}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 24000:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-71}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 34000:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.4999999999999994e-71 or 34000 < z

    1. Initial program 75.3%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. remove-double-neg99.9%

        \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
      3. distribute-frac-neg299.9%

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
      4. neg-sub099.9%

        \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
      5. remove-double-neg99.9%

        \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
      6. unsub-neg99.9%

        \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
      7. div-sub99.9%

        \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
      8. *-inverses99.9%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
      9. metadata-eval99.9%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
      10. associate--r-99.9%

        \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
      11. neg-sub099.9%

        \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
      12. distribute-frac-neg299.9%

        \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
      13. remove-double-neg99.9%

        \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
      14. sub-neg99.9%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 80.1%

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

    if -9.4999999999999994e-71 < z < 34000

    1. Initial program 93.1%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*92.3%

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. remove-double-neg92.3%

        \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
      3. distribute-frac-neg292.3%

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
      4. neg-sub092.3%

        \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
      5. remove-double-neg92.3%

        \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
      6. unsub-neg92.3%

        \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
      7. div-sub92.3%

        \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
      8. *-inverses92.3%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
      9. metadata-eval92.3%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
      10. associate--r-92.3%

        \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
      11. neg-sub092.3%

        \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
      12. distribute-frac-neg292.3%

        \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
      13. remove-double-neg92.3%

        \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
      14. sub-neg92.3%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
    3. Simplified92.3%

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 76.3%

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

        \[\leadsto \color{blue}{\frac{x}{z} \cdot y} \]
      2. *-commutative75.2%

        \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
    7. Simplified75.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{-71}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 34000:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 73.1% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-71}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 24000:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.4999999999999994e-71 or 24000 < z

    1. Initial program 75.3%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. remove-double-neg99.9%

        \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
      3. distribute-frac-neg299.9%

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
      4. neg-sub099.9%

        \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
      5. remove-double-neg99.9%

        \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
      6. unsub-neg99.9%

        \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
      7. div-sub99.9%

        \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
      8. *-inverses99.9%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
      9. metadata-eval99.9%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
      10. associate--r-99.9%

        \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
      11. neg-sub099.9%

        \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
      12. distribute-frac-neg299.9%

        \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
      13. remove-double-neg99.9%

        \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
      14. sub-neg99.9%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 80.1%

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

    if -9.4999999999999994e-71 < z < 24000

    1. Initial program 93.1%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*92.3%

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. remove-double-neg92.3%

        \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
      3. distribute-frac-neg292.3%

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
      4. neg-sub092.3%

        \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
      5. remove-double-neg92.3%

        \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
      6. unsub-neg92.3%

        \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
      7. div-sub92.3%

        \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
      8. *-inverses92.3%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
      9. metadata-eval92.3%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
      10. associate--r-92.3%

        \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
      11. neg-sub092.3%

        \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
      12. distribute-frac-neg292.3%

        \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
      13. remove-double-neg92.3%

        \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
      14. sub-neg92.3%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
    3. Simplified92.3%

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 76.3%

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} \]
    7. Simplified72.1%

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

        \[\leadsto \color{blue}{\frac{x \cdot y}{z}} \]
      2. *-commutative76.3%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{z} \]
      3. associate-*r/75.2%

        \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
      4. clear-num75.2%

        \[\leadsto y \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      5. un-div-inv75.3%

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    9. Applied egg-rr75.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -9.5 \cdot 10^{-71}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 24000:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 72.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{-71}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 40000:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.32e-71 or 4e4 < z

    1. Initial program 75.3%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. remove-double-neg99.9%

        \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
      3. distribute-frac-neg299.9%

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
      4. neg-sub099.9%

        \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
      5. remove-double-neg99.9%

        \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
      6. unsub-neg99.9%

        \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
      7. div-sub99.9%

        \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
      8. *-inverses99.9%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
      9. metadata-eval99.9%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
      10. associate--r-99.9%

        \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
      11. neg-sub099.9%

        \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
      12. distribute-frac-neg299.9%

        \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
      13. remove-double-neg99.9%

        \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
      14. sub-neg99.9%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 80.1%

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

    if -1.32e-71 < z < 4e4

    1. Initial program 93.1%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Step-by-step derivation
      1. associate-/l*92.3%

        \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      2. remove-double-neg92.3%

        \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
      3. distribute-frac-neg292.3%

        \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
      4. neg-sub092.3%

        \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
      5. remove-double-neg92.3%

        \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
      6. unsub-neg92.3%

        \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
      7. div-sub92.3%

        \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
      8. *-inverses92.3%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
      9. metadata-eval92.3%

        \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
      10. associate--r-92.3%

        \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
      11. neg-sub092.3%

        \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
      12. distribute-frac-neg292.3%

        \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
      13. remove-double-neg92.3%

        \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
      14. sub-neg92.3%

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
    3. Simplified92.3%

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
    5. Taylor expanded in y around inf 76.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.32 \cdot 10^{-71}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 40000:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 95.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x \cdot \left(\frac{y}{z} - -1\right) \end{array} \]
(FPCore (x y z) :precision binary64 (* x (- (/ y z) -1.0)))
double code(double x, double y, double z) {
	return x * ((y / z) - -1.0);
}
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) - (-1.0d0))
end function
public static double code(double x, double y, double z) {
	return x * ((y / z) - -1.0);
}
def code(x, y, z):
	return x * ((y / z) - -1.0)
function code(x, y, z)
	return Float64(x * Float64(Float64(y / z) - -1.0))
end
function tmp = code(x, y, z)
	tmp = x * ((y / z) - -1.0);
end
code[x_, y_, z_] := N[(x * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x \cdot \left(\frac{y}{z} - -1\right)
\end{array}
Derivation
  1. Initial program 84.0%

    \[\frac{x \cdot \left(y + z\right)}{z} \]
  2. Step-by-step derivation
    1. associate-/l*96.2%

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    2. remove-double-neg96.2%

      \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
    3. distribute-frac-neg296.2%

      \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
    4. neg-sub096.2%

      \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
    5. remove-double-neg96.2%

      \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
    6. unsub-neg96.2%

      \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
    7. div-sub96.2%

      \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
    8. *-inverses96.2%

      \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
    9. metadata-eval96.2%

      \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
    10. associate--r-96.2%

      \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
    11. neg-sub096.2%

      \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
    12. distribute-frac-neg296.2%

      \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
    13. remove-double-neg96.2%

      \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
    14. sub-neg96.2%

      \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
  3. Simplified96.2%

    \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
  4. Add Preprocessing
  5. Final simplification96.2%

    \[\leadsto x \cdot \left(\frac{y}{z} - -1\right) \]
  6. Add Preprocessing

Alternative 7: 51.2% accurate, 7.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 84.0%

    \[\frac{x \cdot \left(y + z\right)}{z} \]
  2. Step-by-step derivation
    1. associate-/l*96.2%

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
    2. remove-double-neg96.2%

      \[\leadsto x \cdot \frac{y + z}{\color{blue}{-\left(-z\right)}} \]
    3. distribute-frac-neg296.2%

      \[\leadsto x \cdot \color{blue}{\left(-\frac{y + z}{-z}\right)} \]
    4. neg-sub096.2%

      \[\leadsto x \cdot \color{blue}{\left(0 - \frac{y + z}{-z}\right)} \]
    5. remove-double-neg96.2%

      \[\leadsto x \cdot \left(0 - \frac{y + \color{blue}{\left(-\left(-z\right)\right)}}{-z}\right) \]
    6. unsub-neg96.2%

      \[\leadsto x \cdot \left(0 - \frac{\color{blue}{y - \left(-z\right)}}{-z}\right) \]
    7. div-sub96.2%

      \[\leadsto x \cdot \left(0 - \color{blue}{\left(\frac{y}{-z} - \frac{-z}{-z}\right)}\right) \]
    8. *-inverses96.2%

      \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{1}\right)\right) \]
    9. metadata-eval96.2%

      \[\leadsto x \cdot \left(0 - \left(\frac{y}{-z} - \color{blue}{\left(--1\right)}\right)\right) \]
    10. associate--r-96.2%

      \[\leadsto x \cdot \color{blue}{\left(\left(0 - \frac{y}{-z}\right) + \left(--1\right)\right)} \]
    11. neg-sub096.2%

      \[\leadsto x \cdot \left(\color{blue}{\left(-\frac{y}{-z}\right)} + \left(--1\right)\right) \]
    12. distribute-frac-neg296.2%

      \[\leadsto x \cdot \left(\color{blue}{\frac{y}{-\left(-z\right)}} + \left(--1\right)\right) \]
    13. remove-double-neg96.2%

      \[\leadsto x \cdot \left(\frac{y}{\color{blue}{z}} + \left(--1\right)\right) \]
    14. sub-neg96.2%

      \[\leadsto x \cdot \color{blue}{\left(\frac{y}{z} - -1\right)} \]
  3. Simplified96.2%

    \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 51.4%

    \[\leadsto \color{blue}{x} \]
  6. Final simplification51.4%

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 96.2% accurate, 1.0× 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 2024078 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
  :precision binary64

  :alt
  (/ x (/ z (+ y z)))

  (/ (* x (+ y z)) z))