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

Percentage Accurate: 87.9% → 98.3%
Time: 7.4s
Alternatives: 10
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 10 alternatives:

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

Initial Program: 87.9% 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: 98.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4 \cdot 10^{+30}:\\
\;\;\;\;y - \frac{x}{\frac{z}{y + -1}}\\

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


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

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.0000000000000001e30 < y

    1. Initial program 77.1%

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

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

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

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

Alternative 2: 78.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.2 \cdot 10^{+79}:\\
\;\;\;\;y + \frac{x}{z}\\

\mathbf{elif}\;y \leq 1.6 \cdot 10^{+187} \lor \neg \left(y \leq 8.5 \cdot 10^{+281}\right):\\
\;\;\;\;y \cdot \frac{-x}{z}\\

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


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

    1. Initial program 90.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000029e79 < y < 1.59999999999999997e187 or 8.5000000000000006e281 < y

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

    if 1.59999999999999997e187 < y < 8.5000000000000006e281

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto y - \frac{x}{\frac{z}{\color{blue}{y + \left(-1\right)}}} \]
      8. metadata-eval86.1%

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

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

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

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

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

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto \color{blue}{1 \cdot y} - \frac{-x}{z} \]
      2. *-commutative52.7%

        \[\leadsto \color{blue}{y \cdot 1} - \frac{-x}{z} \]
      3. div-inv52.7%

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

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

        \[\leadsto y \cdot 1 - \color{blue}{\left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right) \cdot \left(\sqrt[3]{-x} \cdot \frac{1}{z}\right)} \]
      6. prod-diff52.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1, -\left(\sqrt[3]{-x} \cdot \frac{1}{z}\right) \cdot \left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{-x} \cdot \frac{1}{z}, \sqrt[3]{-x} \cdot \sqrt[3]{-x}, \left(\sqrt[3]{-x} \cdot \frac{1}{z}\right) \cdot \left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right)\right)} \]
    10. Applied egg-rr53.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1, -\left(\sqrt[3]{x} \cdot \frac{1}{z}\right) \cdot {\left(\sqrt[3]{x}\right)}^{2}\right) + \mathsf{fma}\left(-\sqrt[3]{x} \cdot \frac{1}{z}, {\left(\sqrt[3]{x}\right)}^{2}, \left(\sqrt[3]{x} \cdot \frac{1}{z}\right) \cdot {\left(\sqrt[3]{x}\right)}^{2}\right)} \]
    11. Simplified68.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 5.2 \cdot 10^{+79}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+187} \lor \neg \left(y \leq 8.5 \cdot 10^{+281}\right):\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{z}\\ \end{array} \]

Alternative 3: 78.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{+79}:\\
\;\;\;\;y + \frac{x}{z}\\

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

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

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


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

    1. Initial program 90.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.99999999999999974e79 < y < 2.9000000000000001e187

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

    if 2.9000000000000001e187 < y < 5.99999999999999994e282

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto y - \frac{x}{\frac{z}{\color{blue}{y + \left(-1\right)}}} \]
      8. metadata-eval86.1%

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

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

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

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

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

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto \color{blue}{1 \cdot y} - \frac{-x}{z} \]
      2. *-commutative52.7%

        \[\leadsto \color{blue}{y \cdot 1} - \frac{-x}{z} \]
      3. div-inv52.7%

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

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

        \[\leadsto y \cdot 1 - \color{blue}{\left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right) \cdot \left(\sqrt[3]{-x} \cdot \frac{1}{z}\right)} \]
      6. prod-diff52.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1, -\left(\sqrt[3]{-x} \cdot \frac{1}{z}\right) \cdot \left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{-x} \cdot \frac{1}{z}, \sqrt[3]{-x} \cdot \sqrt[3]{-x}, \left(\sqrt[3]{-x} \cdot \frac{1}{z}\right) \cdot \left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right)\right)} \]
    10. Applied egg-rr53.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1, -\left(\sqrt[3]{x} \cdot \frac{1}{z}\right) \cdot {\left(\sqrt[3]{x}\right)}^{2}\right) + \mathsf{fma}\left(-\sqrt[3]{x} \cdot \frac{1}{z}, {\left(\sqrt[3]{x}\right)}^{2}, \left(\sqrt[3]{x} \cdot \frac{1}{z}\right) \cdot {\left(\sqrt[3]{x}\right)}^{2}\right)} \]
    11. Simplified68.1%

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

    if 5.99999999999999994e282 < y

    1. Initial program 72.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1 - y}{z} \cdot x} \]
    5. Taylor expanded in y around inf 67.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3 \cdot 10^{+79}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+187}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{+282}:\\ \;\;\;\;y - \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-y}{z}\\ \end{array} \]

Alternative 4: 78.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.5 \cdot 10^{+81}:\\
\;\;\;\;y + \frac{x}{z}\\

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

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

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


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

    1. Initial program 90.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.49999999999999999e81 < y < 3.4e187

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

    if 3.4e187 < y < 1.2499999999999999e273

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto y - \frac{x}{\frac{z}{\color{blue}{y + \left(-1\right)}}} \]
      8. metadata-eval86.1%

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

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

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

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

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

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity52.7%

        \[\leadsto \color{blue}{1 \cdot y} - \frac{-x}{z} \]
      2. *-commutative52.7%

        \[\leadsto \color{blue}{y \cdot 1} - \frac{-x}{z} \]
      3. div-inv52.7%

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

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

        \[\leadsto y \cdot 1 - \color{blue}{\left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right) \cdot \left(\sqrt[3]{-x} \cdot \frac{1}{z}\right)} \]
      6. prod-diff52.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1, -\left(\sqrt[3]{-x} \cdot \frac{1}{z}\right) \cdot \left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{-x} \cdot \frac{1}{z}, \sqrt[3]{-x} \cdot \sqrt[3]{-x}, \left(\sqrt[3]{-x} \cdot \frac{1}{z}\right) \cdot \left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right)\right)} \]
    10. Applied egg-rr53.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1, -\left(\sqrt[3]{x} \cdot \frac{1}{z}\right) \cdot {\left(\sqrt[3]{x}\right)}^{2}\right) + \mathsf{fma}\left(-\sqrt[3]{x} \cdot \frac{1}{z}, {\left(\sqrt[3]{x}\right)}^{2}, \left(\sqrt[3]{x} \cdot \frac{1}{z}\right) \cdot {\left(\sqrt[3]{x}\right)}^{2}\right)} \]
    11. Simplified68.1%

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

    if 1.2499999999999999e273 < y

    1. Initial program 72.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1 - y}{z} \cdot x} \]
    5. Taylor expanded in y around inf 67.7%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.5 \cdot 10^{+81}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;y \leq 3.4 \cdot 10^{+187}:\\ \;\;\;\;y \cdot \frac{-x}{z}\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+273}:\\ \;\;\;\;y - \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \left(-x\right)}{z}\\ \end{array} \]

Alternative 5: 98.3% accurate, 0.8× speedup?

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

    1. Initial program 76.4%

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

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

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

    if -2.4e7 < y < 4.80000000000000004e-27

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 98.3% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -24000000:\\
\;\;\;\;\frac{y}{\frac{z}{z - x}}\\

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

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


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

    1. Initial program 71.5%

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

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

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

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

    if -2.4e7 < y < 4.80000000000000004e-27

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.80000000000000004e-27 < y

    1. Initial program 81.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -24000000:\\ \;\;\;\;\frac{y}{\frac{z}{z - x}}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{-27}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(1 - \frac{x}{z}\right)\\ \end{array} \]

Alternative 7: 56.9% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;z \leq 9.5 \cdot 10^{+55}:\\
\;\;\;\;\frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.74999999999999989e83 or 9.49999999999999989e55 < z

    1. Initial program 72.6%

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

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

    if -1.74999999999999989e83 < z < 9.49999999999999989e55

    1. Initial program 99.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.75 \cdot 10^{+83}:\\ \;\;\;\;y\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{+55}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 8: 78.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-27}:\\
\;\;\;\;y + \frac{x}{z}\\

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


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

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.80000000000000004e-27 < y

    1. Initial program 81.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.8 \cdot 10^{-27}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{y}{z}\\ \end{array} \]

Alternative 9: 80.4% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{-27}:\\
\;\;\;\;y + \frac{x}{z}\\

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


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

    1. Initial program 91.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.80000000000000004e-27 < y

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y - \color{blue}{\frac{-x}{z}} \]
    9. Step-by-step derivation
      1. *-un-lft-identity49.3%

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

        \[\leadsto \color{blue}{y \cdot 1} - \frac{-x}{z} \]
      3. div-inv49.3%

        \[\leadsto y \cdot 1 - \color{blue}{\left(-x\right) \cdot \frac{1}{z}} \]
      4. add-cube-cbrt49.3%

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

        \[\leadsto y \cdot 1 - \color{blue}{\left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right) \cdot \left(\sqrt[3]{-x} \cdot \frac{1}{z}\right)} \]
      6. prod-diff49.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1, -\left(\sqrt[3]{-x} \cdot \frac{1}{z}\right) \cdot \left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{-x} \cdot \frac{1}{z}, \sqrt[3]{-x} \cdot \sqrt[3]{-x}, \left(\sqrt[3]{-x} \cdot \frac{1}{z}\right) \cdot \left(\sqrt[3]{-x} \cdot \sqrt[3]{-x}\right)\right)} \]
    10. Applied egg-rr50.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 1, -\left(\sqrt[3]{x} \cdot \frac{1}{z}\right) \cdot {\left(\sqrt[3]{x}\right)}^{2}\right) + \mathsf{fma}\left(-\sqrt[3]{x} \cdot \frac{1}{z}, {\left(\sqrt[3]{x}\right)}^{2}, \left(\sqrt[3]{x} \cdot \frac{1}{z}\right) \cdot {\left(\sqrt[3]{x}\right)}^{2}\right)} \]
    11. Simplified61.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.8 \cdot 10^{-27}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y - \frac{x}{z}\\ \end{array} \]

Alternative 10: 41.0% 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.6%

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

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

    \[\leadsto y \]

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 2023242 
(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))