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

Percentage Accurate: 89.0% → 99.9%
Time: 6.5s
Alternatives: 10
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 10 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: 89.0% 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 88.9%

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

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

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

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

      \[\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. Final simplification99.9%

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

Alternative 2: 76.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{-y}{z}\\ t_1 := y + \frac{x}{z}\\ \mathbf{if}\;y \leq -2.05 \cdot 10^{+272}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{+87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3 \cdot 10^{+39}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7300000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{+120}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (/ (- y) z))) (t_1 (+ y (/ x z))))
   (if (<= y -2.05e+272)
     t_0
     (if (<= y -5.8e+87)
       t_1
       (if (<= y -3e+39)
         t_0
         (if (<= y 7300000.0) t_1 (if (<= y 9.2e+120) t_0 (* z (/ y z)))))))))
double code(double x, double y, double z) {
	double t_0 = x * (-y / z);
	double t_1 = y + (x / z);
	double tmp;
	if (y <= -2.05e+272) {
		tmp = t_0;
	} else if (y <= -5.8e+87) {
		tmp = t_1;
	} else if (y <= -3e+39) {
		tmp = t_0;
	} else if (y <= 7300000.0) {
		tmp = t_1;
	} else if (y <= 9.2e+120) {
		tmp = t_0;
	} 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 = x * (-y / z)
    t_1 = y + (x / z)
    if (y <= (-2.05d+272)) then
        tmp = t_0
    else if (y <= (-5.8d+87)) then
        tmp = t_1
    else if (y <= (-3d+39)) then
        tmp = t_0
    else if (y <= 7300000.0d0) then
        tmp = t_1
    else if (y <= 9.2d+120) then
        tmp = t_0
    else
        tmp = z * (y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x * (-y / z);
	double t_1 = y + (x / z);
	double tmp;
	if (y <= -2.05e+272) {
		tmp = t_0;
	} else if (y <= -5.8e+87) {
		tmp = t_1;
	} else if (y <= -3e+39) {
		tmp = t_0;
	} else if (y <= 7300000.0) {
		tmp = t_1;
	} else if (y <= 9.2e+120) {
		tmp = t_0;
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (-y / z)
	t_1 = y + (x / z)
	tmp = 0
	if y <= -2.05e+272:
		tmp = t_0
	elif y <= -5.8e+87:
		tmp = t_1
	elif y <= -3e+39:
		tmp = t_0
	elif y <= 7300000.0:
		tmp = t_1
	elif y <= 9.2e+120:
		tmp = t_0
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(Float64(-y) / z))
	t_1 = Float64(y + Float64(x / z))
	tmp = 0.0
	if (y <= -2.05e+272)
		tmp = t_0;
	elseif (y <= -5.8e+87)
		tmp = t_1;
	elseif (y <= -3e+39)
		tmp = t_0;
	elseif (y <= 7300000.0)
		tmp = t_1;
	elseif (y <= 9.2e+120)
		tmp = t_0;
	else
		tmp = Float64(z * Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (-y / z);
	t_1 = y + (x / z);
	tmp = 0.0;
	if (y <= -2.05e+272)
		tmp = t_0;
	elseif (y <= -5.8e+87)
		tmp = t_1;
	elseif (y <= -3e+39)
		tmp = t_0;
	elseif (y <= 7300000.0)
		tmp = t_1;
	elseif (y <= 9.2e+120)
		tmp = t_0;
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.05e+272], t$95$0, If[LessEqual[y, -5.8e+87], t$95$1, If[LessEqual[y, -3e+39], t$95$0, If[LessEqual[y, 7300000.0], t$95$1, If[LessEqual[y, 9.2e+120], t$95$0, N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -5.8 \cdot 10^{+87}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -3 \cdot 10^{+39}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 7300000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 9.2 \cdot 10^{+120}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -2.04999999999999989e272 or -5.7999999999999996e87 < y < -3e39 or 7.3e6 < y < 9.1999999999999997e120

    1. Initial program 81.9%

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

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

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

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

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

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

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

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

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

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

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

    if -2.04999999999999989e272 < y < -5.7999999999999996e87 or -3e39 < y < 7.3e6

    1. Initial program 94.8%

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

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

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

        \[\leadsto \color{blue}{y - \frac{x \cdot \left(y - 1\right)}{z}} \]
      3. associate-/l*98.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. Taylor expanded in y around 0 91.3%

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

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

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

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

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

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

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

    if 9.1999999999999997e120 < y

    1. Initial program 73.7%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    4. Applied egg-rr67.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.05 \cdot 10^{+272}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -5.8 \cdot 10^{+87}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq -3 \cdot 10^{+39}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq 7300000:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{+120}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]

Alternative 3: 77.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y}{\frac{-z}{x}}\\ t_1 := y + \frac{x}{z}\\ \mathbf{if}\;y \leq -2.15 \cdot 10^{+272}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -1.5 \cdot 10^{+89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{+39}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 1400000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.56 \cdot 10^{+121}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ y (/ (- z) x))) (t_1 (+ y (/ x z))))
   (if (<= y -2.15e+272)
     (* x (/ (- y) z))
     (if (<= y -1.5e+89)
       t_1
       (if (<= y -3.1e+39)
         t_0
         (if (<= y 1400000000000.0)
           t_1
           (if (<= y 1.56e+121) t_0 (* z (/ y z)))))))))
double code(double x, double y, double z) {
	double t_0 = y / (-z / x);
	double t_1 = y + (x / z);
	double tmp;
	if (y <= -2.15e+272) {
		tmp = x * (-y / z);
	} else if (y <= -1.5e+89) {
		tmp = t_1;
	} else if (y <= -3.1e+39) {
		tmp = t_0;
	} else if (y <= 1400000000000.0) {
		tmp = t_1;
	} else if (y <= 1.56e+121) {
		tmp = t_0;
	} 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 / (-z / x)
    t_1 = y + (x / z)
    if (y <= (-2.15d+272)) then
        tmp = x * (-y / z)
    else if (y <= (-1.5d+89)) then
        tmp = t_1
    else if (y <= (-3.1d+39)) then
        tmp = t_0
    else if (y <= 1400000000000.0d0) then
        tmp = t_1
    else if (y <= 1.56d+121) then
        tmp = t_0
    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 / (-z / x);
	double t_1 = y + (x / z);
	double tmp;
	if (y <= -2.15e+272) {
		tmp = x * (-y / z);
	} else if (y <= -1.5e+89) {
		tmp = t_1;
	} else if (y <= -3.1e+39) {
		tmp = t_0;
	} else if (y <= 1400000000000.0) {
		tmp = t_1;
	} else if (y <= 1.56e+121) {
		tmp = t_0;
	} else {
		tmp = z * (y / z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y / (-z / x)
	t_1 = y + (x / z)
	tmp = 0
	if y <= -2.15e+272:
		tmp = x * (-y / z)
	elif y <= -1.5e+89:
		tmp = t_1
	elif y <= -3.1e+39:
		tmp = t_0
	elif y <= 1400000000000.0:
		tmp = t_1
	elif y <= 1.56e+121:
		tmp = t_0
	else:
		tmp = z * (y / z)
	return tmp
function code(x, y, z)
	t_0 = Float64(y / Float64(Float64(-z) / x))
	t_1 = Float64(y + Float64(x / z))
	tmp = 0.0
	if (y <= -2.15e+272)
		tmp = Float64(x * Float64(Float64(-y) / z));
	elseif (y <= -1.5e+89)
		tmp = t_1;
	elseif (y <= -3.1e+39)
		tmp = t_0;
	elseif (y <= 1400000000000.0)
		tmp = t_1;
	elseif (y <= 1.56e+121)
		tmp = t_0;
	else
		tmp = Float64(z * Float64(y / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y / (-z / x);
	t_1 = y + (x / z);
	tmp = 0.0;
	if (y <= -2.15e+272)
		tmp = x * (-y / z);
	elseif (y <= -1.5e+89)
		tmp = t_1;
	elseif (y <= -3.1e+39)
		tmp = t_0;
	elseif (y <= 1400000000000.0)
		tmp = t_1;
	elseif (y <= 1.56e+121)
		tmp = t_0;
	else
		tmp = z * (y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y / N[((-z) / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.15e+272], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.5e+89], t$95$1, If[LessEqual[y, -3.1e+39], t$95$0, If[LessEqual[y, 1400000000000.0], t$95$1, If[LessEqual[y, 1.56e+121], t$95$0, N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.5 \cdot 10^{+89}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -3.1 \cdot 10^{+39}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 1400000000000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq 1.56 \cdot 10^{+121}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 88.6%

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

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

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

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

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

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

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

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

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

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

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

    if -2.15000000000000002e272 < y < -1.50000000000000006e89 or -3.1000000000000003e39 < y < 1.4e12

    1. Initial program 94.8%

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

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

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

        \[\leadsto \color{blue}{y - \frac{x \cdot \left(y - 1\right)}{z}} \]
      3. associate-/l*98.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. Taylor expanded in y around 0 91.3%

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

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

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

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

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

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

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

    if -1.50000000000000006e89 < y < -3.1000000000000003e39 or 1.4e12 < y < 1.5599999999999999e121

    1. Initial program 80.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - x}}} \]
    6. Applied egg-rr99.8%

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

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

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

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

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

    if 1.5599999999999999e121 < y

    1. Initial program 73.7%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    4. Applied egg-rr67.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.15 \cdot 10^{+272}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -1.5 \cdot 10^{+89}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq -3.1 \cdot 10^{+39}:\\ \;\;\;\;\frac{y}{\frac{-z}{x}}\\ \mathbf{elif}\;y \leq 1400000000000:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.56 \cdot 10^{+121}:\\ \;\;\;\;\frac{y}{\frac{-z}{x}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]

Alternative 4: 60.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -5 \cdot 10^{-11}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -2.25 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;y \leq -1.26 \cdot 10^{-85}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq 2.2 \cdot 10^{-26}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.00000000000000018e-11 or 2.2000000000000001e-26 < y

    1. Initial program 80.0%

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

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

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

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

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

    if -5.00000000000000018e-11 < y < -2.25e-74 or -1.26e-85 < y < 2.2000000000000001e-26

    1. Initial program 99.9%

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

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

    if -2.25e-74 < y < -1.26e-85

    1. Initial program 99.4%

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

      \[\leadsto \color{blue}{y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification65.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-11}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{-74}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq -1.26 \cdot 10^{-85}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-26}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]

Alternative 5: 58.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-18}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{-74} \lor \neg \left(y \leq -1.25 \cdot 10^{-85}\right) \land y \leq 9.5 \cdot 10^{-27}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= y -2.2e-18)
   y
   (if (or (<= y -2.2e-74) (and (not (<= y -1.25e-85)) (<= y 9.5e-27)))
     (/ x z)
     y)))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -2.2e-18) {
		tmp = y;
	} else if ((y <= -2.2e-74) || (!(y <= -1.25e-85) && (y <= 9.5e-27))) {
		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 (y <= (-2.2d-18)) then
        tmp = y
    else if ((y <= (-2.2d-74)) .or. (.not. (y <= (-1.25d-85))) .and. (y <= 9.5d-27)) 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 (y <= -2.2e-18) {
		tmp = y;
	} else if ((y <= -2.2e-74) || (!(y <= -1.25e-85) && (y <= 9.5e-27))) {
		tmp = x / z;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -2.2e-18:
		tmp = y
	elif (y <= -2.2e-74) or (not (y <= -1.25e-85) and (y <= 9.5e-27)):
		tmp = x / z
	else:
		tmp = y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -2.2e-18)
		tmp = y;
	elseif ((y <= -2.2e-74) || (!(y <= -1.25e-85) && (y <= 9.5e-27)))
		tmp = Float64(x / z);
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -2.2e-18)
		tmp = y;
	elseif ((y <= -2.2e-74) || (~((y <= -1.25e-85)) && (y <= 9.5e-27)))
		tmp = x / z;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -2.2e-18], y, If[Or[LessEqual[y, -2.2e-74], And[N[Not[LessEqual[y, -1.25e-85]], $MachinePrecision], LessEqual[y, 9.5e-27]]], N[(x / z), $MachinePrecision], y]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-18}:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq -2.2 \cdot 10^{-74} \lor \neg \left(y \leq -1.25 \cdot 10^{-85}\right) \land y \leq 9.5 \cdot 10^{-27}:\\
\;\;\;\;\frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.1999999999999998e-18 or -2.2000000000000001e-74 < y < -1.25e-85 or 9.50000000000000037e-27 < y

    1. Initial program 80.6%

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

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

    if -2.1999999999999998e-18 < y < -2.2000000000000001e-74 or -1.25e-85 < y < 9.50000000000000037e-27

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-18}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{-74} \lor \neg \left(y \leq -1.25 \cdot 10^{-85}\right) \land y \leq 9.5 \cdot 10^{-27}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 6: 94.9% accurate, 0.8× speedup?

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

    1. Initial program 78.4%

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

      \[\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/92.9%

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

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

    if -1.05e10 < y < 1

    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 99.5%

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

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

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

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

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

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

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

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

Alternative 7: 99.0% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -10500000000 \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 -10500000000.0) (not (<= y 1.0)))
   (/ y (/ z (- z x)))
   (+ y (/ x z))))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -10500000000.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 <= (-10500000000.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 <= -10500000000.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 <= -10500000000.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 <= -10500000000.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 <= -10500000000.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, -10500000000.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 -10500000000 \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 < -1.05e10 or 1 < y

    1. Initial program 78.4%

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

      \[\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/92.9%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{z - x}}} \]
    6. Applied egg-rr99.4%

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

    if -1.05e10 < y < 1

    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 99.5%

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

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

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

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

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

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

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

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

Alternative 8: 78.1% accurate, 1.3× speedup?

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

    1. Initial program 93.4%

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

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

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

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

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

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

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

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

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

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

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

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

    if 11500 < y

    1. Initial program 76.6%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    4. Applied egg-rr56.6%

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

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

Alternative 9: 78.1% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 93.3%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < y

    1. Initial program 77.3%

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{z} \cdot z} \]
    5. Step-by-step derivation
      1. *-commutative56.4%

        \[\leadsto \color{blue}{z \cdot \frac{y}{z}} \]
      2. clear-num56.3%

        \[\leadsto z \cdot \color{blue}{\frac{1}{\frac{z}{y}}} \]
      3. un-div-inv56.4%

        \[\leadsto \color{blue}{\frac{z}{\frac{z}{y}}} \]
    6. Applied egg-rr56.4%

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

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

Alternative 10: 39.7% 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 88.9%

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

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

    \[\leadsto y \]

Developer target: 93.6% 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 2023320 
(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))