Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3

Percentage Accurate: 88.8% → 99.5%
Time: 8.2s
Alternatives: 11
Speedup: 0.8×

Specification

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

\\
\frac{x + y \cdot \left(z - x\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 11 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: 88.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+122} \lor \neg \left(x \leq 10^{-40}\right):\\ \;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} + y \cdot \left(1 - \frac{x}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -8e+122) (not (<= x 1e-40)))
   (- y (/ x (/ z (+ y -1.0))))
   (+ (/ x z) (* y (- 1.0 (/ x z))))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -8e+122) || !(x <= 1e-40)) {
		tmp = y - (x / (z / (y + -1.0)));
	} else {
		tmp = (x / z) + (y * (1.0 - (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 ((x <= (-8d+122)) .or. (.not. (x <= 1d-40))) then
        tmp = y - (x / (z / (y + (-1.0d0))))
    else
        tmp = (x / z) + (y * (1.0d0 - (x / z)))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -8e+122) || !(x <= 1e-40)) {
		tmp = y - (x / (z / (y + -1.0)));
	} else {
		tmp = (x / z) + (y * (1.0 - (x / z)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -8e+122) or not (x <= 1e-40):
		tmp = y - (x / (z / (y + -1.0)))
	else:
		tmp = (x / z) + (y * (1.0 - (x / z)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -8e+122) || !(x <= 1e-40))
		tmp = Float64(y - Float64(x / Float64(z / Float64(y + -1.0))));
	else
		tmp = Float64(Float64(x / z) + Float64(y * Float64(1.0 - Float64(x / z))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -8e+122) || ~((x <= 1e-40)))
		tmp = y - (x / (z / (y + -1.0)));
	else
		tmp = (x / z) + (y * (1.0 - (x / z)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -8e+122], N[Not[LessEqual[x, 1e-40]], $MachinePrecision]], N[(y - N[(x / N[(z / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] + N[(y * N[(1.0 - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{+122} \lor \neg \left(x \leq 10^{-40}\right):\\
\;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.00000000000000012e122 or 9.9999999999999993e-41 < x

    1. Initial program 90.7%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 78.0%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 94.5%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg94.5%

        \[\leadsto y + \color{blue}{\left(-\frac{y \cdot x + -1 \cdot x}{z}\right)} \]
      2. unsub-neg94.5%

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out94.5%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified99.9%

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

    if -8.00000000000000012e122 < x < 9.9999999999999993e-41

    1. Initial program 91.5%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{+122} \lor \neg \left(x \leq 10^{-40}\right):\\ \;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} + y \cdot \left(1 - \frac{x}{z}\right)\\ \end{array} \]

Alternative 2: 99.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{+23} \lor \neg \left(y \leq 10^{+43}\right):\\ \;\;\;\;\frac{y}{\frac{z}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -1.2e+23) (not (<= y 1e+43)))
   (/ y (/ z (- z x)))
   (- y (/ x (/ z (+ y -1.0))))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.2e+23) || !(y <= 1e+43)) {
		tmp = y / (z / (z - x));
	} else {
		tmp = y - (x / (z / (y + -1.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) :: tmp
    if ((y <= (-1.2d+23)) .or. (.not. (y <= 1d+43))) then
        tmp = y / (z / (z - x))
    else
        tmp = y - (x / (z / (y + (-1.0d0))))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.2e+23) || !(y <= 1e+43)) {
		tmp = y / (z / (z - x));
	} else {
		tmp = y - (x / (z / (y + -1.0)));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -1.2e+23) or not (y <= 1e+43):
		tmp = y / (z / (z - x))
	else:
		tmp = y - (x / (z / (y + -1.0)))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.2e+23) || !(y <= 1e+43))
		tmp = Float64(y / Float64(z / Float64(z - x)));
	else
		tmp = Float64(y - Float64(x / Float64(z / Float64(y + -1.0))));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -1.2e+23) || ~((y <= 1e+43)))
		tmp = y / (z / (z - x));
	else
		tmp = y - (x / (z / (y + -1.0)));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.2e+23], N[Not[LessEqual[y, 1e+43]], $MachinePrecision]], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / N[(z / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+23} \lor \neg \left(y \leq 10^{+43}\right):\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.2e23 or 1.00000000000000001e43 < y

    1. Initial program 80.4%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around inf 80.4%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - x}}} \]
    4. Simplified99.9%

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

    if -1.2e23 < y < 1.00000000000000001e43

    1. Initial program 99.3%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 93.1%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 99.3%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg99.3%

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

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out99.4%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{y - \frac{x}{\frac{z}{y + -1}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{+23} \lor \neg \left(y \leq 10^{+43}\right):\\ \;\;\;\;\frac{y}{\frac{z}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\ \end{array} \]

Alternative 3: 99.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -2 \cdot 10^{+50} \lor \neg \left(z \leq 2 \cdot 10^{-161}\right):\\ \;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= z -2e+50) (not (<= z 2e-161)))
   (- y (/ x (/ z (+ y -1.0))))
   (/ (+ x (* y (- z x))) z)))
double code(double x, double y, double z) {
	double tmp;
	if ((z <= -2e+50) || !(z <= 2e-161)) {
		tmp = y - (x / (z / (y + -1.0)));
	} else {
		tmp = (x + (y * (z - 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 ((z <= (-2d+50)) .or. (.not. (z <= 2d-161))) then
        tmp = y - (x / (z / (y + (-1.0d0))))
    else
        tmp = (x + (y * (z - x))) / z
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((z <= -2e+50) || !(z <= 2e-161)) {
		tmp = y - (x / (z / (y + -1.0)));
	} else {
		tmp = (x + (y * (z - x))) / z;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (z <= -2e+50) or not (z <= 2e-161):
		tmp = y - (x / (z / (y + -1.0)))
	else:
		tmp = (x + (y * (z - x))) / z
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((z <= -2e+50) || !(z <= 2e-161))
		tmp = Float64(y - Float64(x / Float64(z / Float64(y + -1.0))));
	else
		tmp = Float64(Float64(x + Float64(y * Float64(z - x))) / z);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((z <= -2e+50) || ~((z <= 2e-161)))
		tmp = y - (x / (z / (y + -1.0)));
	else
		tmp = (x + (y * (z - x))) / z;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[z, -2e+50], N[Not[LessEqual[z, 2e-161]], $MachinePrecision]], N[(y - N[(x / N[(z / N[(y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+50} \lor \neg \left(z \leq 2 \cdot 10^{-161}\right):\\
\;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.0000000000000002e50 or 2.00000000000000006e-161 < z

    1. Initial program 83.3%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 99.2%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 95.9%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg95.9%

        \[\leadsto y + \color{blue}{\left(-\frac{y \cdot x + -1 \cdot x}{z}\right)} \]
      2. unsub-neg95.9%

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out95.9%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified99.9%

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

    if -2.0000000000000002e50 < z < 2.00000000000000006e-161

    1. Initial program 100.0%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification100.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2 \cdot 10^{+50} \lor \neg \left(z \leq 2 \cdot 10^{-161}\right):\\ \;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \left(z - x\right)}{z}\\ \end{array} \]

Alternative 4: 76.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{+196} \lor \neg \left(y \leq -950000\right) \land y \leq 3.5 \cdot 10^{+87}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -1.75e+196) (and (not (<= y -950000.0)) (<= y 3.5e+87)))
   (+ y (/ x z))
   (* (/ x z) (- y))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.75e+196) || (!(y <= -950000.0) && (y <= 3.5e+87))) {
		tmp = y + (x / z);
	} else {
		tmp = (x / z) * -y;
	}
	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 <= (-1.75d+196)) .or. (.not. (y <= (-950000.0d0))) .and. (y <= 3.5d+87)) then
        tmp = y + (x / z)
    else
        tmp = (x / z) * -y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.75e+196) || (!(y <= -950000.0) && (y <= 3.5e+87))) {
		tmp = y + (x / z);
	} else {
		tmp = (x / z) * -y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -1.75e+196) or (not (y <= -950000.0) and (y <= 3.5e+87)):
		tmp = y + (x / z)
	else:
		tmp = (x / z) * -y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.75e+196) || (!(y <= -950000.0) && (y <= 3.5e+87)))
		tmp = Float64(y + Float64(x / z));
	else
		tmp = Float64(Float64(x / z) * Float64(-y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -1.75e+196) || (~((y <= -950000.0)) && (y <= 3.5e+87)))
		tmp = y + (x / z);
	else
		tmp = (x / z) * -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.75e+196], And[N[Not[LessEqual[y, -950000.0]], $MachinePrecision], LessEqual[y, 3.5e+87]]], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+196} \lor \neg \left(y \leq -950000\right) \land y \leq 3.5 \cdot 10^{+87}:\\
\;\;\;\;y + \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.7499999999999999e196 or -9.5e5 < y < 3.49999999999999986e87

    1. Initial program 93.7%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 94.4%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 97.9%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg97.9%

        \[\leadsto y + \color{blue}{\left(-\frac{y \cdot x + -1 \cdot x}{z}\right)} \]
      2. unsub-neg97.9%

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out97.9%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified97.3%

      \[\leadsto \color{blue}{y - \frac{x}{\frac{z}{y + -1}}} \]
    6. Taylor expanded in y around 0 90.7%

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

        \[\leadsto y - \color{blue}{\frac{-1 \cdot x}{z}} \]
      2. neg-mul-190.7%

        \[\leadsto y - \frac{\color{blue}{-x}}{z} \]
    8. Simplified90.7%

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Taylor expanded in y around 0 90.7%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    10. Step-by-step derivation
      1. +-commutative90.7%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Simplified90.7%

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

    if -1.7499999999999999e196 < y < -9.5e5 or 3.49999999999999986e87 < y

    1. Initial program 85.5%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around inf 84.8%

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - x}}} \]
    5. Taylor expanded in z around 0 66.7%

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

        \[\leadsto \frac{y}{\color{blue}{\frac{-1 \cdot z}{x}}} \]
      2. neg-mul-166.7%

        \[\leadsto \frac{y}{\frac{\color{blue}{-z}}{x}} \]
    7. Simplified66.7%

      \[\leadsto \frac{y}{\color{blue}{\frac{-z}{x}}} \]
    8. Taylor expanded in y around 0 65.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot x}{z}} \]
    9. Step-by-step derivation
      1. mul-1-neg65.7%

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

        \[\leadsto -\color{blue}{y \cdot \frac{x}{z}} \]
      3. distribute-rgt-neg-in66.8%

        \[\leadsto \color{blue}{y \cdot \left(-\frac{x}{z}\right)} \]
      4. mul-1-neg66.8%

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

        \[\leadsto y \cdot \color{blue}{\frac{-1 \cdot x}{z}} \]
      6. neg-mul-166.8%

        \[\leadsto y \cdot \frac{\color{blue}{-x}}{z} \]
    10. Simplified66.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.75 \cdot 10^{+196} \lor \neg \left(y \leq -950000\right) \land y \leq 3.5 \cdot 10^{+87}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \end{array} \]

Alternative 5: 75.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y + \frac{x}{z}\\ \mathbf{if}\;y \leq -4.3 \cdot 10^{+191}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -950000:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{z}\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{+86}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ y (/ x z))))
   (if (<= y -4.3e+191)
     t_0
     (if (<= y -950000.0)
       (/ (* x (- y)) z)
       (if (<= y 4.4e+86) t_0 (* (/ x z) (- y)))))))
double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double tmp;
	if (y <= -4.3e+191) {
		tmp = t_0;
	} else if (y <= -950000.0) {
		tmp = (x * -y) / z;
	} else if (y <= 4.4e+86) {
		tmp = t_0;
	} else {
		tmp = (x / z) * -y;
	}
	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 <= (-4.3d+191)) then
        tmp = t_0
    else if (y <= (-950000.0d0)) then
        tmp = (x * -y) / z
    else if (y <= 4.4d+86) then
        tmp = t_0
    else
        tmp = (x / z) * -y
    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 <= -4.3e+191) {
		tmp = t_0;
	} else if (y <= -950000.0) {
		tmp = (x * -y) / z;
	} else if (y <= 4.4e+86) {
		tmp = t_0;
	} else {
		tmp = (x / z) * -y;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y + (x / z)
	tmp = 0
	if y <= -4.3e+191:
		tmp = t_0
	elif y <= -950000.0:
		tmp = (x * -y) / z
	elif y <= 4.4e+86:
		tmp = t_0
	else:
		tmp = (x / z) * -y
	return tmp
function code(x, y, z)
	t_0 = Float64(y + Float64(x / z))
	tmp = 0.0
	if (y <= -4.3e+191)
		tmp = t_0;
	elseif (y <= -950000.0)
		tmp = Float64(Float64(x * Float64(-y)) / z);
	elseif (y <= 4.4e+86)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / z) * Float64(-y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y + (x / z);
	tmp = 0.0;
	if (y <= -4.3e+191)
		tmp = t_0;
	elseif (y <= -950000.0)
		tmp = (x * -y) / z;
	elseif (y <= 4.4e+86)
		tmp = t_0;
	else
		tmp = (x / z) * -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4.3e+191], t$95$0, If[LessEqual[y, -950000.0], N[(N[(x * (-y)), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[y, 4.4e+86], t$95$0, N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y + \frac{x}{z}\\
\mathbf{if}\;y \leq -4.3 \cdot 10^{+191}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -950000:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{z}\\

\mathbf{elif}\;y \leq 4.4 \cdot 10^{+86}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.2999999999999998e191 or -9.5e5 < y < 4.40000000000000006e86

    1. Initial program 93.7%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 94.4%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 97.9%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg97.9%

        \[\leadsto y + \color{blue}{\left(-\frac{y \cdot x + -1 \cdot x}{z}\right)} \]
      2. unsub-neg97.9%

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out97.9%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified97.3%

      \[\leadsto \color{blue}{y - \frac{x}{\frac{z}{y + -1}}} \]
    6. Taylor expanded in y around 0 90.7%

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

        \[\leadsto y - \color{blue}{\frac{-1 \cdot x}{z}} \]
      2. neg-mul-190.7%

        \[\leadsto y - \frac{\color{blue}{-x}}{z} \]
    8. Simplified90.7%

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Taylor expanded in y around 0 90.7%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    10. Step-by-step derivation
      1. +-commutative90.7%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Simplified90.7%

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

    if -4.2999999999999998e191 < y < -9.5e5

    1. Initial program 80.8%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around inf 79.4%

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{z}} \]
    3. Taylor expanded in z around 0 65.3%

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(y \cdot x\right)}}{z} \]
    4. Step-by-step derivation
      1. mul-1-neg65.3%

        \[\leadsto \frac{\color{blue}{-y \cdot x}}{z} \]
      2. distribute-rgt-neg-out65.3%

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

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

    if 4.40000000000000006e86 < y

    1. Initial program 89.2%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around inf 89.2%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - x}}} \]
    4. Simplified99.9%

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - x}}} \]
    5. Taylor expanded in z around 0 67.9%

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

        \[\leadsto \frac{y}{\color{blue}{\frac{-1 \cdot z}{x}}} \]
      2. neg-mul-167.9%

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

      \[\leadsto \frac{y}{\color{blue}{\frac{-z}{x}}} \]
    8. Taylor expanded in y around 0 66.0%

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot x}{z}} \]
    9. Step-by-step derivation
      1. mul-1-neg66.0%

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

        \[\leadsto -\color{blue}{y \cdot \frac{x}{z}} \]
      3. distribute-rgt-neg-in68.1%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{-1 \cdot x}{z}} \]
      6. neg-mul-168.1%

        \[\leadsto y \cdot \frac{\color{blue}{-x}}{z} \]
    10. Simplified68.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.3 \cdot 10^{+191}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq -950000:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{z}\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{+86}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \end{array} \]

Alternative 6: 85.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+31} \lor \neg \left(x \leq 2.8 \cdot 10^{+91}\right):\\ \;\;\;\;\frac{x}{z} \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -1.4e+31) (not (<= x 2.8e+91)))
   (* (/ x z) (- 1.0 y))
   (+ y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.4e+31) || !(x <= 2.8e+91)) {
		tmp = (x / z) * (1.0 - y);
	} 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 ((x <= (-1.4d+31)) .or. (.not. (x <= 2.8d+91))) then
        tmp = (x / z) * (1.0d0 - y)
    else
        tmp = y + (x / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -1.4e+31) || !(x <= 2.8e+91)) {
		tmp = (x / z) * (1.0 - y);
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -1.4e+31) or not (x <= 2.8e+91):
		tmp = (x / z) * (1.0 - y)
	else:
		tmp = y + (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -1.4e+31) || !(x <= 2.8e+91))
		tmp = Float64(Float64(x / z) * Float64(1.0 - y));
	else
		tmp = Float64(y + Float64(x / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -1.4e+31) || ~((x <= 2.8e+91)))
		tmp = (x / z) * (1.0 - y);
	else
		tmp = y + (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.4e+31], N[Not[LessEqual[x, 2.8e+91]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+31} \lor \neg \left(x \leq 2.8 \cdot 10^{+91}\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(1 - y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.40000000000000008e31 or 2.7999999999999999e91 < x

    1. Initial program 92.6%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in x around inf 89.9%

      \[\leadsto \color{blue}{\frac{\left(1 + -1 \cdot y\right) \cdot x}{z}} \]
    3. Step-by-step derivation
      1. *-commutative89.9%

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 + -1 \cdot y}}} \]
      3. mul-1-neg93.0%

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

        \[\leadsto \frac{x}{\frac{z}{\color{blue}{1 - y}}} \]
    4. Simplified93.0%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 - y}}} \]
    5. Step-by-step derivation
      1. associate-/r/93.0%

        \[\leadsto \color{blue}{\frac{x}{z} \cdot \left(1 - y\right)} \]
    6. Applied egg-rr93.0%

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

    if -1.40000000000000008e31 < x < 2.7999999999999999e91

    1. Initial program 90.4%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 100.0%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 99.4%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg99.4%

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

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out99.5%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified89.8%

      \[\leadsto \color{blue}{y - \frac{x}{\frac{z}{y + -1}}} \]
    6. Taylor expanded in y around 0 84.5%

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

        \[\leadsto y - \color{blue}{\frac{-1 \cdot x}{z}} \]
      2. neg-mul-184.5%

        \[\leadsto y - \frac{\color{blue}{-x}}{z} \]
    8. Simplified84.5%

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Taylor expanded in y around 0 84.5%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    10. Step-by-step derivation
      1. +-commutative84.5%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Simplified84.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+31} \lor \neg \left(x \leq 2.8 \cdot 10^{+91}\right):\\ \;\;\;\;\frac{x}{z} \cdot \left(1 - y\right)\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \]

Alternative 7: 99.1% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -118 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;\frac{y}{\frac{z}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= y -118.0) (not (<= y 1.0))) (/ y (/ z (- z x))) (+ y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -118.0) || !(y <= 1.0)) {
		tmp = y / (z / (z - 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 <= (-118.0d0)) .or. (.not. (y <= 1.0d0))) then
        tmp = y / (z / (z - 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 <= -118.0) || !(y <= 1.0)) {
		tmp = y / (z / (z - x));
	} else {
		tmp = y + (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -118.0) or not (y <= 1.0):
		tmp = y / (z / (z - x))
	else:
		tmp = y + (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -118.0) || !(y <= 1.0))
		tmp = Float64(y / Float64(z / Float64(z - x)));
	else
		tmp = Float64(y + Float64(x / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((y <= -118.0) || ~((y <= 1.0)))
		tmp = y / (z / (z - x));
	else
		tmp = y + (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -118.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(y / N[(z / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -118 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\

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


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

    1. Initial program 82.3%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around inf 80.9%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - x}}} \]
    4. Simplified98.5%

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

    if -118 < y < 1

    1. Initial program 99.9%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 93.8%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 100.0%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg100.0%

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

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out100.0%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{y - \frac{x}{\frac{z}{y + -1}}} \]
    6. Taylor expanded in y around 0 98.4%

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

        \[\leadsto y - \color{blue}{\frac{-1 \cdot x}{z}} \]
      2. neg-mul-198.4%

        \[\leadsto y - \frac{\color{blue}{-x}}{z} \]
    8. Simplified98.4%

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Taylor expanded in y around 0 98.4%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    10. Step-by-step derivation
      1. +-commutative98.4%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Simplified98.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -118 \lor \neg \left(y \leq 1\right):\\ \;\;\;\;\frac{y}{\frac{z}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;y + \frac{x}{z}\\ \end{array} \]

Alternative 8: 57.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+44}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+29}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -1.55e+44) y (if (<= z 1.5e+29) (/ x z) y)))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.55e+44) {
		tmp = y;
	} else if (z <= 1.5e+29) {
		tmp = x / z;
	} else {
		tmp = y;
	}
	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.55d+44)) then
        tmp = y
    else if (z <= 1.5d+29) then
        tmp = x / z
    else
        tmp = y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -1.55e+44) {
		tmp = y;
	} else if (z <= 1.5e+29) {
		tmp = x / z;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -1.55e+44:
		tmp = y
	elif z <= 1.5e+29:
		tmp = x / z
	else:
		tmp = y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -1.55e+44)
		tmp = y;
	elseif (z <= 1.5e+29)
		tmp = Float64(x / z);
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -1.55e+44)
		tmp = y;
	elseif (z <= 1.5e+29)
		tmp = x / z;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -1.55e+44], y, If[LessEqual[z, 1.5e+29], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.55 \cdot 10^{+44}:\\
\;\;\;\;y\\

\mathbf{elif}\;z \leq 1.5 \cdot 10^{+29}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{else}:\\
\;\;\;\;y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.54999999999999998e44 or 1.5e29 < z

    1. Initial program 78.3%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in x around 0 75.0%

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

    if -1.54999999999999998e44 < z < 1.5e29

    1. Initial program 100.0%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 50.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.55 \cdot 10^{+44}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{+29}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 9: 79.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 1.0) (+ y (/ x z)) (* z (/ y z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.0) {
		tmp = y + (x / z);
	} else {
		tmp = z * (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 <= 1.0d0) then
        tmp = y + (x / z)
    else
        tmp = z * (y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.0) {
		tmp = y + (x / z);
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 1.0:
		tmp = y + (x / z)
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.0)
		tmp = Float64(y + Float64(x / z));
	else
		tmp = Float64(z * Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1.0)
		tmp = y + (x / z);
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\

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


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

    1. Initial program 92.1%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 95.8%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 99.0%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg99.0%

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

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out99.0%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified95.1%

      \[\leadsto \color{blue}{y - \frac{x}{\frac{z}{y + -1}}} \]
    6. Taylor expanded in y around 0 86.8%

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

        \[\leadsto y - \color{blue}{\frac{-1 \cdot x}{z}} \]
      2. neg-mul-186.8%

        \[\leadsto y - \frac{\color{blue}{-x}}{z} \]
    8. Simplified86.8%

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Taylor expanded in y around 0 86.8%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    10. Step-by-step derivation
      1. +-commutative86.8%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Simplified86.8%

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

    if 1 < y

    1. Initial program 88.4%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around inf 87.5%

      \[\leadsto \color{blue}{\frac{y \cdot \left(z - x\right)}{z}} \]
    3. Taylor expanded in z around inf 36.7%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z}}} \]
      2. associate-/r/48.5%

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    5. Applied egg-rr48.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]

Alternative 10: 81.6% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y 1.0) (+ y (/ x z)) (- y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= 1.0) {
		tmp = y + (x / z);
	} 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 <= 1.0d0) then
        tmp = y + (x / z)
    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 <= 1.0) {
		tmp = y + (x / z);
	} else {
		tmp = y - (x / z);
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= 1.0:
		tmp = y + (x / z)
	else:
		tmp = y - (x / z)
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= 1.0)
		tmp = Float64(y + Float64(x / z));
	else
		tmp = Float64(y - Float64(x / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= 1.0)
		tmp = y + (x / z);
	else
		tmp = y - (x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, 1.0], N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;y + \frac{x}{z}\\

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


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

    1. Initial program 92.1%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 95.8%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 99.0%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg99.0%

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

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out99.0%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified95.1%

      \[\leadsto \color{blue}{y - \frac{x}{\frac{z}{y + -1}}} \]
    6. Taylor expanded in y around 0 86.8%

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

        \[\leadsto y - \color{blue}{\frac{-1 \cdot x}{z}} \]
      2. neg-mul-186.8%

        \[\leadsto y - \frac{\color{blue}{-x}}{z} \]
    8. Simplified86.8%

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Taylor expanded in y around 0 86.8%

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    10. Step-by-step derivation
      1. +-commutative86.8%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Simplified86.8%

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

    if 1 < y

    1. Initial program 88.4%

      \[\frac{x + y \cdot \left(z - x\right)}{z} \]
    2. Taylor expanded in y around 0 78.1%

      \[\leadsto \color{blue}{\left(1 - \frac{x}{z}\right) \cdot y + \frac{x}{z}} \]
    3. Taylor expanded in z around -inf 94.2%

      \[\leadsto \color{blue}{y + -1 \cdot \frac{y \cdot x + -1 \cdot x}{z}} \]
    4. Step-by-step derivation
      1. mul-1-neg94.2%

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

        \[\leadsto \color{blue}{y - \frac{y \cdot x + -1 \cdot x}{z}} \]
      3. distribute-rgt-out94.3%

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y + -1}}} \]
    5. Simplified87.9%

      \[\leadsto \color{blue}{y - \frac{x}{\frac{z}{y + -1}}} \]
    6. Taylor expanded in y around 0 41.3%

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

        \[\leadsto y - \color{blue}{\frac{-1 \cdot x}{z}} \]
      2. neg-mul-141.3%

        \[\leadsto y - \frac{\color{blue}{-x}}{z} \]
    8. Simplified41.3%

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Step-by-step derivation
      1. add-sqr-sqrt41.0%

        \[\leadsto \color{blue}{\sqrt{y} \cdot \sqrt{y}} - \frac{-x}{z} \]
      2. add-sqr-sqrt22.3%

        \[\leadsto \sqrt{y} \cdot \sqrt{y} - \color{blue}{\sqrt{\frac{-x}{z}} \cdot \sqrt{\frac{-x}{z}}} \]
      3. difference-of-squares22.3%

        \[\leadsto \color{blue}{\left(\sqrt{y} + \sqrt{\frac{-x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{-x}{z}}\right)} \]
      4. add-sqr-sqrt10.9%

        \[\leadsto \left(\sqrt{y} + \sqrt{\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{-x}{z}}\right) \]
      5. sqrt-unprod15.8%

        \[\leadsto \left(\sqrt{y} + \sqrt{\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{-x}{z}}\right) \]
      6. sqr-neg15.8%

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

        \[\leadsto \left(\sqrt{y} + \sqrt{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{-x}{z}}\right) \]
      8. add-sqr-sqrt7.8%

        \[\leadsto \left(\sqrt{y} + \sqrt{\frac{\color{blue}{x}}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{-x}{z}}\right) \]
      9. add-sqr-sqrt3.1%

        \[\leadsto \left(\sqrt{y} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{z}}\right) \]
      10. sqrt-unprod29.8%

        \[\leadsto \left(\sqrt{y} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{\color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}}}{z}}\right) \]
      11. sqr-neg29.8%

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

        \[\leadsto \left(\sqrt{y} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{z}}\right) \]
      13. add-sqr-sqrt37.7%

        \[\leadsto \left(\sqrt{y} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{\color{blue}{x}}{z}}\right) \]
    10. Applied egg-rr37.7%

      \[\leadsto \color{blue}{\left(\sqrt{y} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{x}{z}}\right)} \]
    11. Step-by-step derivation
      1. /-rgt-identity37.7%

        \[\leadsto \left(\sqrt{\color{blue}{\frac{y}{1}}} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{x}{z}}\right) \]
      2. *-inverses37.7%

        \[\leadsto \left(\sqrt{\frac{y}{\color{blue}{\frac{z}{z}}}} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{x}{z}}\right) \]
      3. associate-/r/32.0%

        \[\leadsto \left(\sqrt{\color{blue}{\frac{y}{z} \cdot z}} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{x}{z}}\right) \]
      4. *-commutative32.0%

        \[\leadsto \left(\sqrt{\color{blue}{z \cdot \frac{y}{z}}} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{x}{z}}\right) \]
      5. unpow1/232.0%

        \[\leadsto \left(\color{blue}{{\left(z \cdot \frac{y}{z}\right)}^{0.5}} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{x}{z}}\right) \]
      6. metadata-eval32.0%

        \[\leadsto \left({\left(z \cdot \frac{y}{z}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{y} - \sqrt{\frac{x}{z}}\right) \]
      7. /-rgt-identity32.0%

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

        \[\leadsto \left({\left(z \cdot \frac{y}{z}\right)}^{\left(\frac{1}{2}\right)} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{\frac{y}{\color{blue}{\frac{z}{z}}}} - \sqrt{\frac{x}{z}}\right) \]
      9. associate-/r/24.2%

        \[\leadsto \left({\left(z \cdot \frac{y}{z}\right)}^{\left(\frac{1}{2}\right)} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{\color{blue}{\frac{y}{z} \cdot z}} - \sqrt{\frac{x}{z}}\right) \]
      10. *-commutative24.2%

        \[\leadsto \left({\left(z \cdot \frac{y}{z}\right)}^{\left(\frac{1}{2}\right)} + \sqrt{\frac{x}{z}}\right) \cdot \left(\sqrt{\color{blue}{z \cdot \frac{y}{z}}} - \sqrt{\frac{x}{z}}\right) \]
      11. unpow1/224.2%

        \[\leadsto \left({\left(z \cdot \frac{y}{z}\right)}^{\left(\frac{1}{2}\right)} + \sqrt{\frac{x}{z}}\right) \cdot \left(\color{blue}{{\left(z \cdot \frac{y}{z}\right)}^{0.5}} - \sqrt{\frac{x}{z}}\right) \]
      12. metadata-eval24.2%

        \[\leadsto \left({\left(z \cdot \frac{y}{z}\right)}^{\left(\frac{1}{2}\right)} + \sqrt{\frac{x}{z}}\right) \cdot \left({\left(z \cdot \frac{y}{z}\right)}^{\color{blue}{\left(\frac{1}{2}\right)}} - \sqrt{\frac{x}{z}}\right) \]
      13. difference-of-squares24.2%

        \[\leadsto \color{blue}{{\left(z \cdot \frac{y}{z}\right)}^{\left(\frac{1}{2}\right)} \cdot {\left(z \cdot \frac{y}{z}\right)}^{\left(\frac{1}{2}\right)} - \sqrt{\frac{x}{z}} \cdot \sqrt{\frac{x}{z}}} \]
      14. sqr-pow24.3%

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

        \[\leadsto \color{blue}{z \cdot \frac{y}{z}} - \sqrt{\frac{x}{z}} \cdot \sqrt{\frac{x}{z}} \]
      16. rem-square-sqrt53.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{z}\\ \end{array} \]

Alternative 11: 40.8% accurate, 9.0× speedup?

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

\\
y
\end{array}
Derivation
  1. Initial program 91.2%

    \[\frac{x + y \cdot \left(z - x\right)}{z} \]
  2. Taylor expanded in x around 0 40.5%

    \[\leadsto \color{blue}{y} \]
  3. Final simplification40.5%

    \[\leadsto y \]

Developer target: 93.8% accurate, 0.8× speedup?

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

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

Reproduce

?
herbie shell --seed 2023279 
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
  :precision binary64

  :herbie-target
  (- (+ y (/ x z)) (/ y (/ z x)))

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