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

Percentage Accurate: 88.2% → 99.8%
Time: 7.8s
Alternatives: 13
Speedup: 0.6×

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 13 alternatives:

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

Initial Program: 88.2% 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.8% accurate, 0.1× speedup?

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

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

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

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

    \[\leadsto \color{blue}{y + x \cdot \left(-1 \cdot \frac{y}{z} + \frac{1}{z}\right)} \]
  5. Step-by-step derivation
    1. distribute-lft-in93.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
    13. div-sub96.7%

      \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
    14. unsub-neg96.7%

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

      \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
    16. +-commutative96.7%

      \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
    17. distribute-neg-frac296.7%

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

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

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

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

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

      \[\leadsto y - {\color{blue}{\left(\frac{\frac{z}{x}}{-1 + y}\right)}}^{-1} \]
  8. Applied egg-rr99.8%

    \[\leadsto y - \color{blue}{{\left(\frac{\frac{z}{x}}{-1 + y}\right)}^{-1}} \]
  9. Final simplification99.8%

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

Alternative 2: 75.7% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{-169} \lor \neg \left(z \leq 3 \cdot 10^{-293} \lor \neg \left(z \leq 6.2 \cdot 10^{-208}\right) \land z \leq 8.6 \cdot 10^{-121}\right):\\
\;\;\;\;y + \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.39999999999999994e-169 or 3.0000000000000002e-293 < z < 6.1999999999999996e-208 or 8.5999999999999993e-121 < z

    1. Initial program 88.1%

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

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

      \[\leadsto \color{blue}{y + x \cdot \left(-1 \cdot \frac{y}{z} + \frac{1}{z}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in95.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(\color{blue}{\left(-\frac{x \cdot y}{z}\right)} - \frac{x}{-z}\right) \]
      12. distribute-frac-neg294.7%

        \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
      13. div-sub95.7%

        \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
      14. unsub-neg95.7%

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

        \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
      16. +-commutative95.7%

        \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
      17. distribute-neg-frac295.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Applied egg-rr79.5%

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

    if -1.39999999999999994e-169 < z < 3.0000000000000002e-293 or 6.1999999999999996e-208 < z < 8.5999999999999993e-121

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{y \cdot \frac{x}{z}} \]
    10. Applied egg-rr73.0%

      \[\leadsto \color{blue}{-y \cdot \frac{x}{z}} \]
    11. Step-by-step derivation
      1. clear-num73.0%

        \[\leadsto -y \cdot \color{blue}{\frac{1}{\frac{z}{x}}} \]
      2. un-div-inv73.0%

        \[\leadsto -\color{blue}{\frac{y}{\frac{z}{x}}} \]
    12. Applied egg-rr73.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{-169} \lor \neg \left(z \leq 3 \cdot 10^{-293} \lor \neg \left(z \leq 6.2 \cdot 10^{-208}\right) \land z \leq 8.6 \cdot 10^{-121}\right):\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{-x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 75.7% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-171} \lor \neg \left(z \leq 1.4 \cdot 10^{-293} \lor \neg \left(z \leq 2.3 \cdot 10^{-210}\right) \land z \leq 2.25 \cdot 10^{-119}\right):\\
\;\;\;\;y + \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.60000000000000005e-171 or 1.40000000000000013e-293 < z < 2.3e-210 or 2.2500000000000001e-119 < z

    1. Initial program 88.1%

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

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

      \[\leadsto \color{blue}{y + x \cdot \left(-1 \cdot \frac{y}{z} + \frac{1}{z}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in95.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(\color{blue}{\left(-\frac{x \cdot y}{z}\right)} - \frac{x}{-z}\right) \]
      12. distribute-frac-neg294.7%

        \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
      13. div-sub95.7%

        \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
      14. unsub-neg95.7%

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

        \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
      16. +-commutative95.7%

        \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
      17. distribute-neg-frac295.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Applied egg-rr79.5%

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

    if -2.60000000000000005e-171 < z < 1.40000000000000013e-293 or 2.3e-210 < z < 2.2500000000000001e-119

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{y \cdot \frac{x}{z}} \]
    10. Applied egg-rr73.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.6 \cdot 10^{-171} \lor \neg \left(z \leq 1.4 \cdot 10^{-293} \lor \neg \left(z \leq 2.3 \cdot 10^{-210}\right) \land z \leq 2.25 \cdot 10^{-119}\right):\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{-z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 75.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y + \frac{x}{z}\\ \mathbf{if}\;z \leq -1.02 \cdot 10^{-169}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-293}:\\ \;\;\;\;\frac{y}{\frac{z}{-x}}\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-208} \lor \neg \left(z \leq 8 \cdot 10^{-121}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-\frac{y}{z}\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ y (/ x z))))
   (if (<= z -1.02e-169)
     t_0
     (if (<= z 3.8e-293)
       (/ y (/ z (- x)))
       (if (or (<= z 3.1e-208) (not (<= z 8e-121))) t_0 (* x (- (/ y z))))))))
double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double tmp;
	if (z <= -1.02e-169) {
		tmp = t_0;
	} else if (z <= 3.8e-293) {
		tmp = y / (z / -x);
	} else if ((z <= 3.1e-208) || !(z <= 8e-121)) {
		tmp = t_0;
	} 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) :: t_0
    real(8) :: tmp
    t_0 = y + (x / z)
    if (z <= (-1.02d-169)) then
        tmp = t_0
    else if (z <= 3.8d-293) then
        tmp = y / (z / -x)
    else if ((z <= 3.1d-208) .or. (.not. (z <= 8d-121))) then
        tmp = t_0
    else
        tmp = x * -(y / z)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y + (x / z);
	double tmp;
	if (z <= -1.02e-169) {
		tmp = t_0;
	} else if (z <= 3.8e-293) {
		tmp = y / (z / -x);
	} else if ((z <= 3.1e-208) || !(z <= 8e-121)) {
		tmp = t_0;
	} else {
		tmp = x * -(y / z);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y + (x / z)
	tmp = 0
	if z <= -1.02e-169:
		tmp = t_0
	elif z <= 3.8e-293:
		tmp = y / (z / -x)
	elif (z <= 3.1e-208) or not (z <= 8e-121):
		tmp = t_0
	else:
		tmp = x * -(y / z)
	return tmp
function code(x, y, z)
	t_0 = Float64(y + Float64(x / z))
	tmp = 0.0
	if (z <= -1.02e-169)
		tmp = t_0;
	elseif (z <= 3.8e-293)
		tmp = Float64(y / Float64(z / Float64(-x)));
	elseif ((z <= 3.1e-208) || !(z <= 8e-121))
		tmp = t_0;
	else
		tmp = Float64(x * Float64(-Float64(y / z)));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y + (x / z);
	tmp = 0.0;
	if (z <= -1.02e-169)
		tmp = t_0;
	elseif (z <= 3.8e-293)
		tmp = y / (z / -x);
	elseif ((z <= 3.1e-208) || ~((z <= 8e-121)))
		tmp = t_0;
	else
		tmp = x * -(y / z);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.02e-169], t$95$0, If[LessEqual[z, 3.8e-293], N[(y / N[(z / (-x)), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 3.1e-208], N[Not[LessEqual[z, 8e-121]], $MachinePrecision]], t$95$0, N[(x * (-N[(y / z), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y + \frac{x}{z}\\
\mathbf{if}\;z \leq -1.02 \cdot 10^{-169}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;z \leq 3.1 \cdot 10^{-208} \lor \neg \left(z \leq 8 \cdot 10^{-121}\right):\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.01999999999999996e-169 or 3.8e-293 < z < 3.0999999999999998e-208 or 7.9999999999999998e-121 < z

    1. Initial program 88.1%

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

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

      \[\leadsto \color{blue}{y + x \cdot \left(-1 \cdot \frac{y}{z} + \frac{1}{z}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in95.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(\color{blue}{\left(-\frac{x \cdot y}{z}\right)} - \frac{x}{-z}\right) \]
      12. distribute-frac-neg294.7%

        \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
      13. div-sub95.7%

        \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
      14. unsub-neg95.7%

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

        \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
      16. +-commutative95.7%

        \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
      17. distribute-neg-frac295.7%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Applied egg-rr79.5%

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

    if -1.01999999999999996e-169 < z < 3.8e-293

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\color{blue}{y \cdot \frac{x}{z}} \]
    10. Applied egg-rr72.3%

      \[\leadsto \color{blue}{-y \cdot \frac{x}{z}} \]
    11. Step-by-step derivation
      1. clear-num72.3%

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

        \[\leadsto -\color{blue}{\frac{y}{\frac{z}{x}}} \]
    12. Applied egg-rr72.3%

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

    if 3.0999999999999998e-208 < z < 7.9999999999999998e-121

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.02 \cdot 10^{-169}:\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{-293}:\\ \;\;\;\;\frac{y}{\frac{z}{-x}}\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-208} \lor \neg \left(z \leq 8 \cdot 10^{-121}\right):\\ \;\;\;\;y + \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(-\frac{y}{z}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.2% accurate, 0.5× speedup?

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

    1. Initial program 82.6%

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

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

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

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

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

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

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

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

    if -122 < y < 1

    1. Initial program 99.9%

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

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

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

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

        \[\leadsto y + \left(x \cdot \color{blue}{\left(-\frac{y}{z}\right)} + x \cdot \frac{1}{z}\right) \]
      3. distribute-rgt-neg-in98.1%

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(\color{blue}{\left(-\frac{x \cdot y}{z}\right)} - \frac{x}{-z}\right) \]
      12. distribute-frac-neg298.3%

        \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
      13. div-sub100.0%

        \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
      14. unsub-neg100.0%

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

        \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
      16. +-commutative100.0%

        \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
      17. distribute-neg-frac2100.0%

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(-\color{blue}{\left(-\frac{x}{z}\right)}\right) \]
      3. remove-double-neg97.4%

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

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Applied egg-rr97.4%

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

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

Alternative 6: 84.1% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4000000000000002e66 or 9.7999999999999994e-71 < x

    1. Initial program 93.2%

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

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

        \[\leadsto \color{blue}{x \cdot \frac{1 + -1 \cdot y}{z}} \]
      2. mul-1-neg83.6%

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

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

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

    if -2.4000000000000002e66 < x < 9.7999999999999994e-71

    1. Initial program 87.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(\color{blue}{\left(-\frac{x \cdot y}{z}\right)} - \frac{x}{-z}\right) \]
      12. distribute-frac-neg299.3%

        \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
      13. div-sub99.3%

        \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
      14. unsub-neg99.3%

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

        \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
      16. +-commutative99.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(-\color{blue}{\left(-\frac{x}{z}\right)}\right) \]
      3. remove-double-neg85.8%

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

        \[\leadsto \color{blue}{\frac{x}{z} + y} \]
    11. Applied egg-rr85.8%

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

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

Alternative 7: 97.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-15}:\\
\;\;\;\;y - \frac{x \cdot \left(y + -1\right)}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < 2.0000000000000002e-15

    1. Initial program 94.7%

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

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

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

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

        \[\leadsto y + \left(x \cdot \color{blue}{\left(-\frac{y}{z}\right)} + x \cdot \frac{1}{z}\right) \]
      3. distribute-rgt-neg-in90.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
      13. div-sub98.8%

        \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
      14. unsub-neg98.8%

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

        \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
      16. +-commutative98.8%

        \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
      17. distribute-neg-frac298.8%

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

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

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

    if 2.0000000000000002e-15 < z

    1. Initial program 80.5%

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

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

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

Alternative 8: 98.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+36}:\\
\;\;\;\;x \cdot \left(\frac{1 - y}{z} + \frac{y}{x}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.00000000000000008e36

    1. Initial program 88.9%

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

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

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

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

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

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

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

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

    if -2.00000000000000008e36 < x

    1. Initial program 91.4%

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

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

      \[\leadsto \color{blue}{y + x \cdot \left(-1 \cdot \frac{y}{z} + \frac{1}{z}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in93.2%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
      13. div-sub98.0%

        \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
      14. unsub-neg98.0%

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

        \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
      16. +-commutative98.0%

        \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
      17. distribute-neg-frac298.0%

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

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

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

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

Alternative 9: 62.9% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{-51} \lor \neg \left(y \leq 6.5 \cdot 10^{-24}\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 < -2.30000000000000002e-51 or 6.5e-24 < y

    1. Initial program 84.4%

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

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

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

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

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

    if -2.30000000000000002e-51 < y < 6.5e-24

    1. Initial program 100.0%

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

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

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

Alternative 10: 97.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 83.2%

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

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

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

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

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

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

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

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

    if -5.5e15 < y

    1. Initial program 93.4%

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

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

      \[\leadsto \color{blue}{y + x \cdot \left(-1 \cdot \frac{y}{z} + \frac{1}{z}\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-in93.6%

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

        \[\leadsto y + \left(x \cdot \color{blue}{\left(-\frac{y}{z}\right)} + x \cdot \frac{1}{z}\right) \]
      3. distribute-rgt-neg-in93.6%

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

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

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

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

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

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

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

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

        \[\leadsto y + \left(\color{blue}{\left(-\frac{x \cdot y}{z}\right)} - \frac{x}{-z}\right) \]
      12. distribute-frac-neg293.7%

        \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
      13. div-sub97.9%

        \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
      14. unsub-neg97.9%

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

        \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
      16. +-commutative97.9%

        \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
      17. distribute-neg-frac297.9%

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

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

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

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

Alternative 11: 60.1% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -9.99999999999999965e-106 or 5.0000000000000002e-23 < y

    1. Initial program 85.6%

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

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

    if -9.99999999999999965e-106 < y < 5.0000000000000002e-23

    1. Initial program 100.0%

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

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

Alternative 12: 78.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ y + \frac{x}{z} \end{array} \]
(FPCore (x y z) :precision binary64 (+ y (/ x z)))
double code(double x, double y, double z) {
	return y + (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 = y + (x / z)
end function
public static double code(double x, double y, double z) {
	return y + (x / z);
}
def code(x, y, z):
	return y + (x / z)
function code(x, y, z)
	return Float64(y + Float64(x / z))
end
function tmp = code(x, y, z)
	tmp = y + (x / z);
end
code[x_, y_, z_] := N[(y + N[(x / z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
y + \frac{x}{z}
\end{array}
Derivation
  1. Initial program 90.7%

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

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

    \[\leadsto \color{blue}{y + x \cdot \left(-1 \cdot \frac{y}{z} + \frac{1}{z}\right)} \]
  5. Step-by-step derivation
    1. distribute-lft-in93.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto y + \left(\color{blue}{\frac{x \cdot y}{-z}} - \frac{x}{-z}\right) \]
    13. div-sub96.7%

      \[\leadsto y + \color{blue}{\frac{x \cdot y - x}{-z}} \]
    14. unsub-neg96.7%

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

      \[\leadsto y + \frac{x \cdot y + \color{blue}{-1 \cdot x}}{-z} \]
    16. +-commutative96.7%

      \[\leadsto y + \frac{\color{blue}{-1 \cdot x + x \cdot y}}{-z} \]
    17. distribute-neg-frac296.7%

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

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

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

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

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

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

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

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

      \[\leadsto y + \left(-\color{blue}{\left(-\frac{x}{z}\right)}\right) \]
    3. remove-double-neg71.7%

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

      \[\leadsto \color{blue}{\frac{x}{z} + y} \]
  11. Applied egg-rr71.7%

    \[\leadsto \color{blue}{\frac{x}{z} + y} \]
  12. Final simplification71.7%

    \[\leadsto y + \frac{x}{z} \]
  13. Add Preprocessing

Alternative 13: 41.9% 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 90.7%

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

    \[\leadsto \color{blue}{y} \]
  4. Add Preprocessing

Developer target: 94.3% 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 2024085 
(FPCore (x y z)
  :name "Diagrams.Backend.Rasterific:rasterificRadialGradient from diagrams-rasterific-1.3.1.3"
  :precision binary64

  :alt
  (- (+ y (/ x z)) (/ y (/ z x)))

  (/ (+ x (* y (- z x))) z))