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

Percentage Accurate: 87.7% → 99.9%
Time: 5.7s
Alternatives: 8
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 8 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: 87.7% 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(1 - y\right) \end{array} \]
(FPCore (x y z) :precision binary64 (+ y (* (/ x z) (- 1.0 y))))
double code(double x, double y, double z) {
	return y + ((x / z) * (1.0 - 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 + ((x / z) * (1.0d0 - y))
end function
public static double code(double x, double y, double z) {
	return y + ((x / z) * (1.0 - y));
}
def code(x, y, z):
	return y + ((x / z) * (1.0 - y))
function code(x, y, z)
	return Float64(y + Float64(Float64(x / z) * Float64(1.0 - y)))
end
function tmp = code(x, y, z)
	tmp = y + ((x / z) * (1.0 - y));
end
code[x_, y_, z_] := N[(y + N[(N[(x / z), $MachinePrecision] * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

      \[\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(1 - y\right) \]

Alternative 2: 62.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \frac{y}{z}\\ t_1 := -y \cdot \frac{x}{z}\\ \mathbf{if}\;y \leq -1.16 \cdot 10^{+109}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{+57}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-62}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+203}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (/ y z))) (t_1 (- (* y (/ x z)))))
   (if (<= y -1.16e+109)
     t_0
     (if (<= y -1.45e+57)
       t_1
       (if (<= y -6.2e-62)
         y
         (if (<= y 5e-15) (/ x z) (if (<= y 4e+203) t_0 t_1)))))))
double code(double x, double y, double z) {
	double t_0 = z * (y / z);
	double t_1 = -(y * (x / z));
	double tmp;
	if (y <= -1.16e+109) {
		tmp = t_0;
	} else if (y <= -1.45e+57) {
		tmp = t_1;
	} else if (y <= -6.2e-62) {
		tmp = y;
	} else if (y <= 5e-15) {
		tmp = x / z;
	} else if (y <= 4e+203) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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 = z * (y / z)
    t_1 = -(y * (x / z))
    if (y <= (-1.16d+109)) then
        tmp = t_0
    else if (y <= (-1.45d+57)) then
        tmp = t_1
    else if (y <= (-6.2d-62)) then
        tmp = y
    else if (y <= 5d-15) then
        tmp = x / z
    else if (y <= 4d+203) then
        tmp = t_0
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = z * (y / z);
	double t_1 = -(y * (x / z));
	double tmp;
	if (y <= -1.16e+109) {
		tmp = t_0;
	} else if (y <= -1.45e+57) {
		tmp = t_1;
	} else if (y <= -6.2e-62) {
		tmp = y;
	} else if (y <= 5e-15) {
		tmp = x / z;
	} else if (y <= 4e+203) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y / z)
	t_1 = -(y * (x / z))
	tmp = 0
	if y <= -1.16e+109:
		tmp = t_0
	elif y <= -1.45e+57:
		tmp = t_1
	elif y <= -6.2e-62:
		tmp = y
	elif y <= 5e-15:
		tmp = x / z
	elif y <= 4e+203:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(y / z))
	t_1 = Float64(-Float64(y * Float64(x / z)))
	tmp = 0.0
	if (y <= -1.16e+109)
		tmp = t_0;
	elseif (y <= -1.45e+57)
		tmp = t_1;
	elseif (y <= -6.2e-62)
		tmp = y;
	elseif (y <= 5e-15)
		tmp = Float64(x / z);
	elseif (y <= 4e+203)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (y / z);
	t_1 = -(y * (x / z));
	tmp = 0.0;
	if (y <= -1.16e+109)
		tmp = t_0;
	elseif (y <= -1.45e+57)
		tmp = t_1;
	elseif (y <= -6.2e-62)
		tmp = y;
	elseif (y <= 5e-15)
		tmp = x / z;
	elseif (y <= 4e+203)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[y, -1.16e+109], t$95$0, If[LessEqual[y, -1.45e+57], t$95$1, If[LessEqual[y, -6.2e-62], y, If[LessEqual[y, 5e-15], N[(x / z), $MachinePrecision], If[LessEqual[y, 4e+203], t$95$0, t$95$1]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.45 \cdot 10^{+57}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -6.2 \cdot 10^{-62}:\\
\;\;\;\;y\\

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

\mathbf{elif}\;y \leq 4 \cdot 10^{+203}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -1.16000000000000003e109 or 4.99999999999999999e-15 < y < 4e203

    1. Initial program 70.7%

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

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

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

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

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

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

    if -1.16000000000000003e109 < y < -1.4500000000000001e57 or 4e203 < y

    1. Initial program 92.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \left(-\frac{x}{z}\right)} \]
      5. distribute-neg-frac80.7%

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

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

    if -1.4500000000000001e57 < y < -6.1999999999999999e-62

    1. Initial program 96.0%

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

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

    if -6.1999999999999999e-62 < y < 4.99999999999999999e-15

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.16 \cdot 10^{+109}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{+57}:\\ \;\;\;\;-y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq -6.2 \cdot 10^{-62}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 4 \cdot 10^{+203}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;-y \cdot \frac{x}{z}\\ \end{array} \]

Alternative 3: 62.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -2.35 \cdot 10^{+110}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{+60}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -6 \cdot 10^{-62}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{+200}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (/ y z))))
   (if (<= y -2.35e+110)
     t_0
     (if (<= y -2.4e+60)
       (* x (/ (- y) z))
       (if (<= y -6e-62)
         y
         (if (<= y 6e-15)
           (/ x z)
           (if (<= y 8.5e+200) t_0 (* y (/ (- x) z)))))))))
double code(double x, double y, double z) {
	double t_0 = z * (y / z);
	double tmp;
	if (y <= -2.35e+110) {
		tmp = t_0;
	} else if (y <= -2.4e+60) {
		tmp = x * (-y / z);
	} else if (y <= -6e-62) {
		tmp = y;
	} else if (y <= 6e-15) {
		tmp = x / z;
	} else if (y <= 8.5e+200) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = z * (y / z)
    if (y <= (-2.35d+110)) then
        tmp = t_0
    else if (y <= (-2.4d+60)) then
        tmp = x * (-y / z)
    else if (y <= (-6d-62)) then
        tmp = y
    else if (y <= 6d-15) then
        tmp = x / z
    else if (y <= 8.5d+200) then
        tmp = t_0
    else
        tmp = y * (-x / z)
    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 <= -2.35e+110) {
		tmp = t_0;
	} else if (y <= -2.4e+60) {
		tmp = x * (-y / z);
	} else if (y <= -6e-62) {
		tmp = y;
	} else if (y <= 6e-15) {
		tmp = x / z;
	} else if (y <= 8.5e+200) {
		tmp = t_0;
	} else {
		tmp = y * (-x / z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y / z)
	tmp = 0
	if y <= -2.35e+110:
		tmp = t_0
	elif y <= -2.4e+60:
		tmp = x * (-y / z)
	elif y <= -6e-62:
		tmp = y
	elif y <= 6e-15:
		tmp = x / z
	elif y <= 8.5e+200:
		tmp = t_0
	else:
		tmp = y * (-x / z)
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(y / z))
	tmp = 0.0
	if (y <= -2.35e+110)
		tmp = t_0;
	elseif (y <= -2.4e+60)
		tmp = Float64(x * Float64(Float64(-y) / z));
	elseif (y <= -6e-62)
		tmp = y;
	elseif (y <= 6e-15)
		tmp = Float64(x / z);
	elseif (y <= 8.5e+200)
		tmp = t_0;
	else
		tmp = Float64(y * Float64(Float64(-x) / z));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (y / z);
	tmp = 0.0;
	if (y <= -2.35e+110)
		tmp = t_0;
	elseif (y <= -2.4e+60)
		tmp = x * (-y / z);
	elseif (y <= -6e-62)
		tmp = y;
	elseif (y <= 6e-15)
		tmp = x / z;
	elseif (y <= 8.5e+200)
		tmp = t_0;
	else
		tmp = y * (-x / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.35e+110], t$95$0, If[LessEqual[y, -2.4e+60], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -6e-62], y, If[LessEqual[y, 6e-15], N[(x / z), $MachinePrecision], If[LessEqual[y, 8.5e+200], t$95$0, N[(y * N[((-x) / z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -2.4 \cdot 10^{+60}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\

\mathbf{elif}\;y \leq -6 \cdot 10^{-62}:\\
\;\;\;\;y\\

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

\mathbf{elif}\;y \leq 8.5 \cdot 10^{+200}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y < -2.3499999999999999e110 or 6e-15 < y < 8.5e200

    1. Initial program 70.7%

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

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

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

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

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

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

    if -2.3499999999999999e110 < y < -2.4e60

    1. Initial program 82.8%

      \[\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*82.4%

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

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

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

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

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

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

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

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

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

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

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

    if -2.4e60 < y < -6.0000000000000002e-62

    1. Initial program 96.0%

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

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

    if -6.0000000000000002e-62 < y < 6e-15

    1. Initial program 99.9%

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

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

    if 8.5e200 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.35 \cdot 10^{+110}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{+60}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -6 \cdot 10^{-62}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{+200}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \end{array} \]

Alternative 4: 77.8% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq -1.75 \cdot 10^{+59}:\\
\;\;\;\;x \cdot \frac{-y}{z}\\

\mathbf{elif}\;y \leq 8.5 \cdot 10^{+202}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.77999999999999995e106 or -1.75e59 < y < 8.5000000000000003e202

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

    if -1.77999999999999995e106 < y < -1.75e59

    1. Initial program 82.8%

      \[\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*82.4%

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

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

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

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

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

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

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

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

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

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

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

    if 8.5000000000000003e202 < y

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.78 \cdot 10^{+106}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq -1.75 \cdot 10^{+59}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{+202}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \end{array} \]

Alternative 5: 98.2% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+30} \lor \neg \left(y \leq 2.15 \cdot 10^{-13}\right):\\
\;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.50000000000000025e30 or 2.1499999999999999e-13 < y

    1. Initial program 75.9%

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

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

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

        \[\leadsto \color{blue}{y - \frac{x \cdot \left(y - 1\right)}{z}} \]
      3. associate-/l*92.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 inf 99.4%

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

    if -5.50000000000000025e30 < y < 2.1499999999999999e-13

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

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

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

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

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

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

Alternative 6: 63.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{-62} \lor \neg \left(y \leq 1.25 \cdot 10^{-13}\right):\\
\;\;\;\;z \cdot \frac{y}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.0000000000000002e-62 or 1.24999999999999997e-13 < y

    1. Initial program 79.1%

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

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

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

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

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

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

    if -5.0000000000000002e-62 < y < 1.24999999999999997e-13

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5 \cdot 10^{-62} \lor \neg \left(y \leq 1.25 \cdot 10^{-13}\right):\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]

Alternative 7: 60.8% accurate, 1.3× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.0000000000000006e-64 or 6.49999999999999991e-15 < y

    1. Initial program 79.1%

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

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

    if -7.0000000000000006e-64 < y < 6.49999999999999991e-15

    1. Initial program 99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-64}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 8: 40.3% 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.3%

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

    \[\leadsto \color{blue}{y} \]
  3. Final simplification42.8%

    \[\leadsto y \]

Developer target: 94.4% 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 2023332 
(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))