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

Percentage Accurate: 88.4% → 99.9%
Time: 7.0s
Alternatives: 11
Speedup: 1.0×

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.4% 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.9% accurate, 1.0× speedup?

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

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

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

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

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

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

      \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
    4. associate-/r/100.0%

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

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

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

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

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

Alternative 2: 78.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y + \frac{x}{z}\\ t_1 := \frac{-x}{\frac{z}{y}}\\ \mathbf{if}\;y \leq -2.6 \cdot 10^{+42}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2300000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 12500000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+88}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ y (/ x z))) (t_1 (/ (- x) (/ z y))))
   (if (<= y -2.6e+42)
     t_0
     (if (<= y -2300000000.0)
       t_1
       (if (<= y 12500000000.0) t_0 (if (<= y 2.9e+88) t_1 (* z (/ y z))))))))
double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double t_1 = -x / (z / y);
	double tmp;
	if (y <= -2.6e+42) {
		tmp = t_0;
	} else if (y <= -2300000000.0) {
		tmp = t_1;
	} else if (y <= 12500000000.0) {
		tmp = t_0;
	} else if (y <= 2.9e+88) {
		tmp = t_1;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y + (x / z)
    t_1 = -x / (z / y)
    if (y <= (-2.6d+42)) then
        tmp = t_0
    else if (y <= (-2300000000.0d0)) then
        tmp = t_1
    else if (y <= 12500000000.0d0) then
        tmp = t_0
    else if (y <= 2.9d+88) then
        tmp = t_1
    else
        tmp = z * (y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double t_1 = -x / (z / y);
	double tmp;
	if (y <= -2.6e+42) {
		tmp = t_0;
	} else if (y <= -2300000000.0) {
		tmp = t_1;
	} else if (y <= 12500000000.0) {
		tmp = t_0;
	} else if (y <= 2.9e+88) {
		tmp = t_1;
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y + (x / z)
	t_1 = -x / (z / y)
	tmp = 0
	if y <= -2.6e+42:
		tmp = t_0
	elif y <= -2300000000.0:
		tmp = t_1
	elif y <= 12500000000.0:
		tmp = t_0
	elif y <= 2.9e+88:
		tmp = t_1
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	t_0 = Float64(y + Float64(x / z))
	t_1 = Float64(Float64(-x) / Float64(z / y))
	tmp = 0.0
	if (y <= -2.6e+42)
		tmp = t_0;
	elseif (y <= -2300000000.0)
		tmp = t_1;
	elseif (y <= 12500000000.0)
		tmp = t_0;
	elseif (y <= 2.9e+88)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y + (x / z);
	t_1 = -x / (z / y);
	tmp = 0.0;
	if (y <= -2.6e+42)
		tmp = t_0;
	elseif (y <= -2300000000.0)
		tmp = t_1;
	elseif (y <= 12500000000.0)
		tmp = t_0;
	elseif (y <= 2.9e+88)
		tmp = t_1;
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-x) / N[(z / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.6e+42], t$95$0, If[LessEqual[y, -2300000000.0], t$95$1, If[LessEqual[y, 12500000000.0], t$95$0, If[LessEqual[y, 2.9e+88], t$95$1, N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2300000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 12500000000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2.9 \cdot 10^{+88}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.5999999999999999e42 or -2.3e9 < y < 1.25e10

    1. Initial program 92.4%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    9. Step-by-step derivation
      1. +-commutative92.2%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    10. Simplified92.2%

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

    if -2.5999999999999999e42 < y < -2.3e9 or 1.25e10 < y < 2.9e88

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

    if 2.9e88 < y

    1. Initial program 66.5%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6 \cdot 10^{+42}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq -2300000000:\\ \;\;\;\;\frac{-x}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 12500000000:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+88}:\\ \;\;\;\;\frac{-x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]

Alternative 3: 78.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y + \frac{x}{z}\\ t_1 := \frac{x}{z} \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -5 \cdot 10^{+44}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2300000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 125000000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+179}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ y (/ x z))) (t_1 (* (/ x z) (- y))))
   (if (<= y -5e+44)
     t_0
     (if (<= y -2300000000.0)
       t_1
       (if (<= y 125000000000.0)
         t_0
         (if (<= y 1.4e+179) t_1 (* z (/ y z))))))))
double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double t_1 = (x / z) * -y;
	double tmp;
	if (y <= -5e+44) {
		tmp = t_0;
	} else if (y <= -2300000000.0) {
		tmp = t_1;
	} else if (y <= 125000000000.0) {
		tmp = t_0;
	} else if (y <= 1.4e+179) {
		tmp = t_1;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y + (x / z)
    t_1 = (x / z) * -y
    if (y <= (-5d+44)) then
        tmp = t_0
    else if (y <= (-2300000000.0d0)) then
        tmp = t_1
    else if (y <= 125000000000.0d0) then
        tmp = t_0
    else if (y <= 1.4d+179) then
        tmp = t_1
    else
        tmp = z * (y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double t_1 = (x / z) * -y;
	double tmp;
	if (y <= -5e+44) {
		tmp = t_0;
	} else if (y <= -2300000000.0) {
		tmp = t_1;
	} else if (y <= 125000000000.0) {
		tmp = t_0;
	} else if (y <= 1.4e+179) {
		tmp = t_1;
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y + (x / z)
	t_1 = (x / z) * -y
	tmp = 0
	if y <= -5e+44:
		tmp = t_0
	elif y <= -2300000000.0:
		tmp = t_1
	elif y <= 125000000000.0:
		tmp = t_0
	elif y <= 1.4e+179:
		tmp = t_1
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	t_0 = Float64(y + Float64(x / z))
	t_1 = Float64(Float64(x / z) * Float64(-y))
	tmp = 0.0
	if (y <= -5e+44)
		tmp = t_0;
	elseif (y <= -2300000000.0)
		tmp = t_1;
	elseif (y <= 125000000000.0)
		tmp = t_0;
	elseif (y <= 1.4e+179)
		tmp = t_1;
	else
		tmp = Float64(z * Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y + (x / z);
	t_1 = (x / z) * -y;
	tmp = 0.0;
	if (y <= -5e+44)
		tmp = t_0;
	elseif (y <= -2300000000.0)
		tmp = t_1;
	elseif (y <= 125000000000.0)
		tmp = t_0;
	elseif (y <= 1.4e+179)
		tmp = t_1;
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]}, If[LessEqual[y, -5e+44], t$95$0, If[LessEqual[y, -2300000000.0], t$95$1, If[LessEqual[y, 125000000000.0], t$95$0, If[LessEqual[y, 1.4e+179], t$95$1, N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y + \frac{x}{z}\\
t_1 := \frac{x}{z} \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -5 \cdot 10^{+44}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -2300000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 125000000000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1.4 \cdot 10^{+179}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -4.9999999999999996e44 or -2.3e9 < y < 1.25e11

    1. Initial program 92.4%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    9. Step-by-step derivation
      1. +-commutative92.2%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    10. Simplified92.2%

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

    if -4.9999999999999996e44 < y < -2.3e9 or 1.25e11 < y < 1.4e179

    1. Initial program 95.5%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.4e179 < y

    1. Initial program 53.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{+44}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq -2300000000:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq 125000000000:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{+179}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]

Alternative 4: 77.6% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y + \frac{x}{z}\\ \mathbf{if}\;y \leq -2.2 \cdot 10^{+42}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2300000000:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq 160000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{+176}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ y (/ x z))))
   (if (<= y -2.2e+42)
     t_0
     (if (<= y -2300000000.0)
       (* (/ x z) (- y))
       (if (<= y 160000.0)
         t_0
         (if (<= y 4.1e+176) (/ (* x (- y)) z) (* z (/ y z))))))))
double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double tmp;
	if (y <= -2.2e+42) {
		tmp = t_0;
	} else if (y <= -2300000000.0) {
		tmp = (x / z) * -y;
	} else if (y <= 160000.0) {
		tmp = t_0;
	} else if (y <= 4.1e+176) {
		tmp = (x * -y) / 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) :: t_0
    real(8) :: tmp
    t_0 = y + (x / z)
    if (y <= (-2.2d+42)) then
        tmp = t_0
    else if (y <= (-2300000000.0d0)) then
        tmp = (x / z) * -y
    else if (y <= 160000.0d0) then
        tmp = t_0
    else if (y <= 4.1d+176) then
        tmp = (x * -y) / z
    else
        tmp = z * (y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double tmp;
	if (y <= -2.2e+42) {
		tmp = t_0;
	} else if (y <= -2300000000.0) {
		tmp = (x / z) * -y;
	} else if (y <= 160000.0) {
		tmp = t_0;
	} else if (y <= 4.1e+176) {
		tmp = (x * -y) / z;
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y + (x / z)
	tmp = 0
	if y <= -2.2e+42:
		tmp = t_0
	elif y <= -2300000000.0:
		tmp = (x / z) * -y
	elif y <= 160000.0:
		tmp = t_0
	elif y <= 4.1e+176:
		tmp = (x * -y) / z
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	t_0 = Float64(y + Float64(x / z))
	tmp = 0.0
	if (y <= -2.2e+42)
		tmp = t_0;
	elseif (y <= -2300000000.0)
		tmp = Float64(Float64(x / z) * Float64(-y));
	elseif (y <= 160000.0)
		tmp = t_0;
	elseif (y <= 4.1e+176)
		tmp = Float64(Float64(x * Float64(-y)) / z);
	else
		tmp = Float64(z * Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y + (x / z);
	tmp = 0.0;
	if (y <= -2.2e+42)
		tmp = t_0;
	elseif (y <= -2300000000.0)
		tmp = (x / z) * -y;
	elseif (y <= 160000.0)
		tmp = t_0;
	elseif (y <= 4.1e+176)
		tmp = (x * -y) / z;
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e+42], t$95$0, If[LessEqual[y, -2300000000.0], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision], If[LessEqual[y, 160000.0], t$95$0, If[LessEqual[y, 4.1e+176], N[(N[(x * (-y)), $MachinePrecision] / z), $MachinePrecision], N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq 160000:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 4.1 \cdot 10^{+176}:\\
\;\;\;\;\frac{x \cdot \left(-y\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -2.2000000000000001e42 or -2.3e9 < y < 1.6e5

    1. Initial program 92.4%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    9. Step-by-step derivation
      1. +-commutative92.2%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    10. Simplified92.2%

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

    if -2.2000000000000001e42 < y < -2.3e9

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.6e5 < y < 4.0999999999999999e176

    1. Initial program 94.2%

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

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

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

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

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

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

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

    if 4.0999999999999999e176 < y

    1. Initial program 53.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+42}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq -2300000000:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq 160000:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{+176}:\\ \;\;\;\;\frac{x \cdot \left(-y\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]

Alternative 5: 99.0% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 78.1%

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

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

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

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

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

    if -2.60000000000000009 < y < 0.640000000000000013

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/100.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.5% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.00000000000000014e-97 or 6.8e9 < z

    1. Initial program 81.1%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/99.9%

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

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

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

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

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

        \[\leadsto y - \color{blue}{\left(-\frac{x}{z}\right)} \]
      2. distribute-frac-neg88.0%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    10. Simplified88.0%

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

    if -4.00000000000000014e-97 < z < 6.8e9

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 7: 95.2% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 78.1%

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

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

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

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

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

    if -2.60000000000000009 < y < 0.640000000000000013

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/100.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 95.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6:\\
\;\;\;\;\left(z - x\right) \cdot \frac{y}{z}\\

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

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


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

    1. Initial program 77.9%

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

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

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

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

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

    if -2.60000000000000009 < y < 0.640000000000000013

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/100.0%

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

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

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

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

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

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

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

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

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

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

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

    if 0.640000000000000013 < y

    1. Initial program 78.2%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.6:\\ \;\;\;\;\left(z - x\right) \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq 0.64:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{y \cdot x}{z}\\ \end{array} \]

Alternative 9: 58.2% accurate, 1.3× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.1000000000000001e-43 or 2.89999999999999988e41 < x

    1. Initial program 92.9%

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

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

    if -2.1000000000000001e-43 < x < 2.89999999999999988e41

    1. Initial program 85.5%

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

      \[\leadsto \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.1%

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

Alternative 10: 79.1% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.64:\\
\;\;\;\;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 < 0.640000000000000013

    1. Initial program 92.7%

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

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

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

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

        \[\leadsto y - \color{blue}{\frac{x}{\frac{z}{y - 1}}} \]
      4. associate-/r/100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{y + \frac{x}{z}} \]
    9. Step-by-step derivation
      1. +-commutative88.3%

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    10. Simplified88.3%

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

    if 0.640000000000000013 < y

    1. Initial program 78.2%

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

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

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

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

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

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

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

Alternative 11: 40.5% 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 89.3%

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

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

    \[\leadsto y \]

Developer target: 94.2% 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 2023315 
(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))