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

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

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 87.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.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 89.4%

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

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

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

      \[\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) \]
  5. Simplified100.0%

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

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

Alternative 2: 58.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \frac{y}{z}\\ t_1 := \frac{x}{z} \cdot \left(-y\right)\\ \mathbf{if}\;y \leq -5.4 \cdot 10^{+243}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{+164}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-122}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (/ y z))) (t_1 (* (/ x z) (- y))))
   (if (<= y -5.4e+243)
     t_0
     (if (<= y -1.35e+164)
       t_1
       (if (<= y -5.2e-122) t_0 (if (<= y 7.8e-15) (/ x z) t_1))))))
double code(double x, double y, double z) {
	double t_0 = z * (y / z);
	double t_1 = (x / z) * -y;
	double tmp;
	if (y <= -5.4e+243) {
		tmp = t_0;
	} else if (y <= -1.35e+164) {
		tmp = t_1;
	} else if (y <= -5.2e-122) {
		tmp = t_0;
	} else if (y <= 7.8e-15) {
		tmp = x / z;
	} 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 = (x / z) * -y
    if (y <= (-5.4d+243)) then
        tmp = t_0
    else if (y <= (-1.35d+164)) then
        tmp = t_1
    else if (y <= (-5.2d-122)) then
        tmp = t_0
    else if (y <= 7.8d-15) then
        tmp = x / z
    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 = (x / z) * -y;
	double tmp;
	if (y <= -5.4e+243) {
		tmp = t_0;
	} else if (y <= -1.35e+164) {
		tmp = t_1;
	} else if (y <= -5.2e-122) {
		tmp = t_0;
	} else if (y <= 7.8e-15) {
		tmp = x / z;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y / z)
	t_1 = (x / z) * -y
	tmp = 0
	if y <= -5.4e+243:
		tmp = t_0
	elif y <= -1.35e+164:
		tmp = t_1
	elif y <= -5.2e-122:
		tmp = t_0
	elif y <= 7.8e-15:
		tmp = x / z
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(y / z))
	t_1 = Float64(Float64(x / z) * Float64(-y))
	tmp = 0.0
	if (y <= -5.4e+243)
		tmp = t_0;
	elseif (y <= -1.35e+164)
		tmp = t_1;
	elseif (y <= -5.2e-122)
		tmp = t_0;
	elseif (y <= 7.8e-15)
		tmp = Float64(x / z);
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (y / z);
	t_1 = (x / z) * -y;
	tmp = 0.0;
	if (y <= -5.4e+243)
		tmp = t_0;
	elseif (y <= -1.35e+164)
		tmp = t_1;
	elseif (y <= -5.2e-122)
		tmp = t_0;
	elseif (y <= 7.8e-15)
		tmp = x / z;
	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[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]}, If[LessEqual[y, -5.4e+243], t$95$0, If[LessEqual[y, -1.35e+164], t$95$1, If[LessEqual[y, -5.2e-122], t$95$0, If[LessEqual[y, 7.8e-15], N[(x / z), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -1.35 \cdot 10^{+164}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;y \leq -5.2 \cdot 10^{-122}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -5.4000000000000003e243 or -1.35000000000000003e164 < y < -5.1999999999999995e-122

    1. Initial program 78.7%

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

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

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

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

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

    if -5.4000000000000003e243 < y < -1.35000000000000003e164 or 7.80000000000000053e-15 < y

    1. Initial program 86.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.1999999999999995e-122 < y < 7.80000000000000053e-15

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{+243}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -1.35 \cdot 10^{+164}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-122}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq 7.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 58.2% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := z \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -2.2 \cdot 10^{+241}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{+164}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-122}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 7.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* z (/ y z))))
   (if (<= y -2.2e+241)
     t_0
     (if (<= y -1.1e+164)
       (* x (/ (- y) z))
       (if (<= y -5.2e-122)
         t_0
         (if (<= y 7.8e-15) (/ x z) (* (/ x z) (- y))))))))
double code(double x, double y, double z) {
	double t_0 = z * (y / z);
	double tmp;
	if (y <= -2.2e+241) {
		tmp = t_0;
	} else if (y <= -1.1e+164) {
		tmp = x * (-y / z);
	} else if (y <= -5.2e-122) {
		tmp = t_0;
	} else if (y <= 7.8e-15) {
		tmp = x / z;
	} else {
		tmp = (x / z) * -y;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = z * (y / z)
    if (y <= (-2.2d+241)) then
        tmp = t_0
    else if (y <= (-1.1d+164)) then
        tmp = x * (-y / z)
    else if (y <= (-5.2d-122)) then
        tmp = t_0
    else if (y <= 7.8d-15) then
        tmp = x / z
    else
        tmp = (x / z) * -y
    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.2e+241) {
		tmp = t_0;
	} else if (y <= -1.1e+164) {
		tmp = x * (-y / z);
	} else if (y <= -5.2e-122) {
		tmp = t_0;
	} else if (y <= 7.8e-15) {
		tmp = x / z;
	} else {
		tmp = (x / z) * -y;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = z * (y / z)
	tmp = 0
	if y <= -2.2e+241:
		tmp = t_0
	elif y <= -1.1e+164:
		tmp = x * (-y / z)
	elif y <= -5.2e-122:
		tmp = t_0
	elif y <= 7.8e-15:
		tmp = x / z
	else:
		tmp = (x / z) * -y
	return tmp
function code(x, y, z)
	t_0 = Float64(z * Float64(y / z))
	tmp = 0.0
	if (y <= -2.2e+241)
		tmp = t_0;
	elseif (y <= -1.1e+164)
		tmp = Float64(x * Float64(Float64(-y) / z));
	elseif (y <= -5.2e-122)
		tmp = t_0;
	elseif (y <= 7.8e-15)
		tmp = Float64(x / z);
	else
		tmp = Float64(Float64(x / z) * Float64(-y));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = z * (y / z);
	tmp = 0.0;
	if (y <= -2.2e+241)
		tmp = t_0;
	elseif (y <= -1.1e+164)
		tmp = x * (-y / z);
	elseif (y <= -5.2e-122)
		tmp = t_0;
	elseif (y <= 7.8e-15)
		tmp = x / z;
	else
		tmp = (x / z) * -y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.2e+241], t$95$0, If[LessEqual[y, -1.1e+164], N[(x * N[((-y) / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -5.2e-122], t$95$0, If[LessEqual[y, 7.8e-15], N[(x / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * (-y)), $MachinePrecision]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;y \leq -5.2 \cdot 10^{-122}:\\
\;\;\;\;t_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < -2.2e241 or -1.10000000000000003e164 < y < -5.1999999999999995e-122

    1. Initial program 78.7%

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

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

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

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

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

    if -2.2e241 < y < -1.10000000000000003e164

    1. Initial program 83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.1999999999999995e-122 < y < 7.80000000000000053e-15

    1. Initial program 100.0%

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

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

    if 7.80000000000000053e-15 < y

    1. Initial program 86.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \color{blue}{\frac{-x}{z}} \]
    11. Simplified61.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+241}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -1.1 \cdot 10^{+164}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-122}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq 7.8 \cdot 10^{-15}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot \left(-y\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 76.1% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+244}:\\
\;\;\;\;z \cdot \frac{y}{z}\\

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

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

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


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

    1. Initial program 57.7%

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

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

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

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

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

    if -3.2000000000000002e244 < y < -6.9999999999999995e164

    1. Initial program 83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.9999999999999995e164 < y < 2.2999999999999998

    1. Initial program 93.6%

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

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

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

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

        \[\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) \]
    5. Simplified100.0%

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

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

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

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

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

    if 2.2999999999999998 < y

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 76.1% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+243}:\\
\;\;\;\;z \cdot \frac{y}{z}\\

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

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

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


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

    1. Initial program 57.7%

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

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

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

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

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

    if -9.49999999999999957e243 < y < -1.70000000000000005e165

    1. Initial program 83.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.70000000000000005e165 < y < 2.2999999999999998

    1. Initial program 93.6%

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

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

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

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

        \[\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) \]
    5. Simplified100.0%

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

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

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

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

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

    if 2.2999999999999998 < y

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+243}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{+165}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq 2.3:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{-z}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 85.9% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -125000 or 3.0000000000000001e-71 < z

    1. Initial program 80.9%

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

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

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

        \[\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) \]
    5. Simplified100.0%

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

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

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

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

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

    if -125000 < z < 3.0000000000000001e-71

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

Alternative 7: 95.1% accurate, 0.5× speedup?

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

    1. Initial program 79.9%

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

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

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

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

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

    if -1 < y < 1

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{y + -1 \cdot \frac{x \cdot \left(y - 1\right)}{z}} \]
    4. 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) \]
    5. Simplified100.0%

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

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

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

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

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

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

Alternative 8: 98.6% accurate, 0.5× speedup?

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

    1. Initial program 80.3%

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

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

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

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

    if -1 < y < 7.80000000000000053e-15

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{y + -1 \cdot \frac{x \cdot \left(y - 1\right)}{z}} \]
    4. 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) \]
    5. Simplified100.0%

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

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

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

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

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

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

Alternative 9: 60.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{-122} \lor \neg \left(y \leq 1.58 \cdot 10^{-25}\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.1999999999999995e-122 or 1.57999999999999989e-25 < y

    1. Initial program 82.8%

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

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

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

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

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

    if -5.1999999999999995e-122 < y < 1.57999999999999989e-25

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-122} \lor \neg \left(y \leq 1.58 \cdot 10^{-25}\right):\\ \;\;\;\;z \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 59.7% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -5.1999999999999995e-122 or 1.39999999999999994e-25 < y

    1. Initial program 82.8%

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

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

    if -5.1999999999999995e-122 < y < 1.39999999999999994e-25

    1. Initial program 100.0%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.2 \cdot 10^{-122}:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 40.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 89.4%

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

    \[\leadsto \color{blue}{y} \]
  4. Final simplification37.7%

    \[\leadsto y \]
  5. Add Preprocessing

Developer target: 93.9% 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 2024021 
(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))