Numeric.SpecFunctions:choose from math-functions-0.1.5.2

Percentage Accurate: 84.9% → 96.1%
Time: 4.5s
Alternatives: 5
Speedup: 0.5×

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 5 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.9% 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: 96.1% accurate, 0.5× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;x\_m \leq 9000000:\\ \;\;\;\;y \cdot \left(\frac{x\_m}{y} + \frac{x\_m}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(\frac{y}{z} - -1\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (<= x_m 9000000.0)
    (* y (+ (/ x_m y) (/ x_m z)))
    (* x_m (- (/ y z) -1.0)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (x_m <= 9000000.0) {
		tmp = y * ((x_m / y) + (x_m / z));
	} else {
		tmp = x_m * ((y / z) - -1.0);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x_m <= 9000000.0d0) then
        tmp = y * ((x_m / y) + (x_m / z))
    else
        tmp = x_m * ((y / z) - (-1.0d0))
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (x_m <= 9000000.0) {
		tmp = y * ((x_m / y) + (x_m / z));
	} else {
		tmp = x_m * ((y / z) - -1.0);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if x_m <= 9000000.0:
		tmp = y * ((x_m / y) + (x_m / z))
	else:
		tmp = x_m * ((y / z) - -1.0)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (x_m <= 9000000.0)
		tmp = Float64(y * Float64(Float64(x_m / y) + Float64(x_m / z)));
	else
		tmp = Float64(x_m * Float64(Float64(y / z) - -1.0));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (x_m <= 9000000.0)
		tmp = y * ((x_m / y) + (x_m / z));
	else
		tmp = x_m * ((y / z) - -1.0);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[x$95$m, 9000000.0], N[(y * N[(N[(x$95$m / y), $MachinePrecision] + N[(x$95$m / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;x\_m \leq 9000000:\\
\;\;\;\;y \cdot \left(\frac{x\_m}{y} + \frac{x\_m}{z}\right)\\

\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} - -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 9e6

    1. Initial program 84.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \left(\frac{x}{y} + \frac{x}{z}\right)} \]

    if 9e6 < x

    1. Initial program 76.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
  3. Recombined 2 regimes into one program.
  4. Final simplification89.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 9000000:\\ \;\;\;\;y \cdot \left(\frac{x}{y} + \frac{x}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 72.7% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+84} \lor \neg \left(y \leq -6.4 \cdot 10^{+75}\right) \land \left(y \leq -48 \lor \neg \left(y \leq 7 \cdot 10^{-59}\right)\right):\\ \;\;\;\;y \cdot \frac{x\_m}{z}\\ \mathbf{else}:\\ \;\;\;\;x\_m\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= y -2.2e+84)
          (and (not (<= y -6.4e+75)) (or (<= y -48.0) (not (<= y 7e-59)))))
    (* y (/ x_m z))
    x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((y <= -2.2e+84) || (!(y <= -6.4e+75) && ((y <= -48.0) || !(y <= 7e-59)))) {
		tmp = y * (x_m / z);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-2.2d+84)) .or. (.not. (y <= (-6.4d+75))) .and. (y <= (-48.0d0)) .or. (.not. (y <= 7d-59))) then
        tmp = y * (x_m / z)
    else
        tmp = x_m
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((y <= -2.2e+84) || (!(y <= -6.4e+75) && ((y <= -48.0) || !(y <= 7e-59)))) {
		tmp = y * (x_m / z);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (y <= -2.2e+84) or (not (y <= -6.4e+75) and ((y <= -48.0) or not (y <= 7e-59))):
		tmp = y * (x_m / z)
	else:
		tmp = x_m
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((y <= -2.2e+84) || (!(y <= -6.4e+75) && ((y <= -48.0) || !(y <= 7e-59))))
		tmp = Float64(y * Float64(x_m / z));
	else
		tmp = x_m;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((y <= -2.2e+84) || (~((y <= -6.4e+75)) && ((y <= -48.0) || ~((y <= 7e-59)))))
		tmp = y * (x_m / z);
	else
		tmp = x_m;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[y, -2.2e+84], And[N[Not[LessEqual[y, -6.4e+75]], $MachinePrecision], Or[LessEqual[y, -48.0], N[Not[LessEqual[y, 7e-59]], $MachinePrecision]]]], N[(y * N[(x$95$m / z), $MachinePrecision]), $MachinePrecision], x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+84} \lor \neg \left(y \leq -6.4 \cdot 10^{+75}\right) \land \left(y \leq -48 \lor \neg \left(y \leq 7 \cdot 10^{-59}\right)\right):\\
\;\;\;\;y \cdot \frac{x\_m}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.1999999999999998e84 or -6.39999999999999969e75 < y < -48 or 7.0000000000000002e-59 < y

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1999999999999998e84 < y < -6.39999999999999969e75 or -48 < y < 7.0000000000000002e-59

    1. Initial program 73.1%

      \[\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 82.9%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+84} \lor \neg \left(y \leq -6.4 \cdot 10^{+75}\right) \land \left(y \leq -48 \lor \neg \left(y \leq 7 \cdot 10^{-59}\right)\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 72.5% accurate, 0.3× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{+84} \lor \neg \left(y \leq -6.4 \cdot 10^{+75} \lor \neg \left(y \leq -100\right) \land y \leq 1.25 \cdot 10^{-57}\right):\\ \;\;\;\;\frac{y}{\frac{z}{x\_m}}\\ \mathbf{else}:\\ \;\;\;\;x\_m\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (or (<= y -7.6e+84)
          (not (or (<= y -6.4e+75) (and (not (<= y -100.0)) (<= y 1.25e-57)))))
    (/ y (/ z x_m))
    x_m)))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((y <= -7.6e+84) || !((y <= -6.4e+75) || (!(y <= -100.0) && (y <= 1.25e-57)))) {
		tmp = y / (z / x_m);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if ((y <= (-7.6d+84)) .or. (.not. (y <= (-6.4d+75)) .or. (.not. (y <= (-100.0d0))) .and. (y <= 1.25d-57))) then
        tmp = y / (z / x_m)
    else
        tmp = x_m
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if ((y <= -7.6e+84) || !((y <= -6.4e+75) || (!(y <= -100.0) && (y <= 1.25e-57)))) {
		tmp = y / (z / x_m);
	} else {
		tmp = x_m;
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if (y <= -7.6e+84) or not ((y <= -6.4e+75) or (not (y <= -100.0) and (y <= 1.25e-57))):
		tmp = y / (z / x_m)
	else:
		tmp = x_m
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if ((y <= -7.6e+84) || !((y <= -6.4e+75) || (!(y <= -100.0) && (y <= 1.25e-57))))
		tmp = Float64(y / Float64(z / x_m));
	else
		tmp = x_m;
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if ((y <= -7.6e+84) || ~(((y <= -6.4e+75) || (~((y <= -100.0)) && (y <= 1.25e-57)))))
		tmp = y / (z / x_m);
	else
		tmp = x_m;
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[Or[LessEqual[y, -7.6e+84], N[Not[Or[LessEqual[y, -6.4e+75], And[N[Not[LessEqual[y, -100.0]], $MachinePrecision], LessEqual[y, 1.25e-57]]]], $MachinePrecision]], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], x$95$m]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+84} \lor \neg \left(y \leq -6.4 \cdot 10^{+75} \lor \neg \left(y \leq -100\right) \land y \leq 1.25 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.6000000000000002e84 or -6.39999999999999969e75 < y < -100 or 1.25e-57 < y

    1. Initial program 89.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
    8. Step-by-step derivation
      1. clear-num78.1%

        \[\leadsto y \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      2. un-div-inv78.2%

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

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

    if -7.6000000000000002e84 < y < -6.39999999999999969e75 or -100 < y < 1.25e-57

    1. Initial program 73.1%

      \[\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 82.9%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{+84} \lor \neg \left(y \leq -6.4 \cdot 10^{+75} \lor \neg \left(y \leq -100\right) \land y \leq 1.25 \cdot 10^{-57}\right):\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 96.3% accurate, 0.4× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot \begin{array}{l} \mathbf{if}\;\frac{x\_m \cdot \left(y + z\right)}{z} \leq -1 \cdot 10^{+108}:\\ \;\;\;\;\frac{y}{\frac{z}{x\_m}}\\ \mathbf{else}:\\ \;\;\;\;x\_m \cdot \left(\frac{y}{z} - -1\right)\\ \end{array} \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z)
 :precision binary64
 (*
  x_s
  (if (<= (/ (* x_m (+ y z)) z) -1e+108)
    (/ y (/ z x_m))
    (* x_m (- (/ y z) -1.0)))))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (((x_m * (y + z)) / z) <= -1e+108) {
		tmp = y / (z / x_m);
	} else {
		tmp = x_m * ((y / z) - -1.0);
	}
	return x_s * tmp;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (((x_m * (y + z)) / z) <= (-1d+108)) then
        tmp = y / (z / x_m)
    else
        tmp = x_m * ((y / z) - (-1.0d0))
    end if
    code = x_s * tmp
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	double tmp;
	if (((x_m * (y + z)) / z) <= -1e+108) {
		tmp = y / (z / x_m);
	} else {
		tmp = x_m * ((y / z) - -1.0);
	}
	return x_s * tmp;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	tmp = 0
	if ((x_m * (y + z)) / z) <= -1e+108:
		tmp = y / (z / x_m)
	else:
		tmp = x_m * ((y / z) - -1.0)
	return x_s * tmp
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	tmp = 0.0
	if (Float64(Float64(x_m * Float64(y + z)) / z) <= -1e+108)
		tmp = Float64(y / Float64(z / x_m));
	else
		tmp = Float64(x_m * Float64(Float64(y / z) - -1.0));
	end
	return Float64(x_s * tmp)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp_2 = code(x_s, x_m, y, z)
	tmp = 0.0;
	if (((x_m * (y + z)) / z) <= -1e+108)
		tmp = y / (z / x_m);
	else
		tmp = x_m * ((y / z) - -1.0);
	end
	tmp_2 = x_s * tmp;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * If[LessEqual[N[(N[(x$95$m * N[(y + z), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], -1e+108], N[(y / N[(z / x$95$m), $MachinePrecision]), $MachinePrecision], N[(x$95$m * N[(N[(y / z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot \begin{array}{l}
\mathbf{if}\;\frac{x\_m \cdot \left(y + z\right)}{z} \leq -1 \cdot 10^{+108}:\\
\;\;\;\;\frac{y}{\frac{z}{x\_m}}\\

\mathbf{else}:\\
\;\;\;\;x\_m \cdot \left(\frac{y}{z} - -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x (+.f64 y z)) z) < -1e108

    1. Initial program 74.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
    8. Step-by-step derivation
      1. clear-num58.0%

        \[\leadsto y \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      2. un-div-inv58.7%

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

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

    if -1e108 < (/.f64 (*.f64 x (+.f64 y z)) z)

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(\frac{y}{z} - -1\right)} \]
    4. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification86.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} \leq -1 \cdot 10^{+108}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 50.6% accurate, 7.0× speedup?

\[\begin{array}{l} x\_m = \left|x\right| \\ x\_s = \mathsf{copysign}\left(1, x\right) \\ x\_s \cdot x\_m \end{array} \]
x\_m = (fabs.f64 x)
x\_s = (copysign.f64 #s(literal 1 binary64) x)
(FPCore (x_s x_m y z) :precision binary64 (* x_s x_m))
x\_m = fabs(x);
x\_s = copysign(1.0, x);
double code(double x_s, double x_m, double y, double z) {
	return x_s * x_m;
}
x\_m = abs(x)
x\_s = copysign(1.0d0, x)
real(8) function code(x_s, x_m, y, z)
    real(8), intent (in) :: x_s
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x_s * x_m
end function
x\_m = Math.abs(x);
x\_s = Math.copySign(1.0, x);
public static double code(double x_s, double x_m, double y, double z) {
	return x_s * x_m;
}
x\_m = math.fabs(x)
x\_s = math.copysign(1.0, x)
def code(x_s, x_m, y, z):
	return x_s * x_m
x\_m = abs(x)
x\_s = copysign(1.0, x)
function code(x_s, x_m, y, z)
	return Float64(x_s * x_m)
end
x\_m = abs(x);
x\_s = sign(x) * abs(1.0);
function tmp = code(x_s, x_m, y, z)
	tmp = x_s * x_m;
end
x\_m = N[Abs[x], $MachinePrecision]
x\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$95$s_, x$95$m_, y_, z_] := N[(x$95$s * x$95$m), $MachinePrecision]
\begin{array}{l}
x\_m = \left|x\right|
\\
x\_s = \mathsf{copysign}\left(1, x\right)

\\
x\_s \cdot x\_m
\end{array}
Derivation
  1. Initial program 82.5%

    \[\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 48.6%

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

    \[\leadsto x \]
  7. Add Preprocessing

Developer target: 96.1% 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 2024085 
(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))