Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3

Percentage Accurate: 84.9% → 96.0%
Time: 6.8s
Alternatives: 9
Speedup: 1.0×

Specification

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

\\
\frac{x \cdot \left(y - z\right)}{y}
\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 9 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: 84.9% accurate, 1.0× speedup?

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

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

Alternative 1: 96.0% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 74.4%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Step-by-step derivation
      1. remove-double-neg74.4%

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

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

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

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

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

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

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

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

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

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

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

    if -1e21 < y < 3.2000000000000002e-167

    1. Initial program 92.3%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num92.2%

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

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

      \[\leadsto \color{blue}{{\left(\frac{y}{x \cdot \left(y - z\right)}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-192.2%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{y - z}}} \]
      3. associate-/r/96.4%

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

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

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

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

    if 3.2000000000000002e-167 < y

    1. Initial program 80.1%

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

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{y}} \]
      2. add-sqr-sqrt49.6%

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

        \[\leadsto \color{blue}{\sqrt{x} \cdot \left(\sqrt{x} \cdot \frac{y - z}{y}\right)} \]
    4. Applied egg-rr49.6%

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

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

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

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{y - z}}} \]
      4. un-div-inv99.9%

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

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

Alternative 2: 95.7% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-27} \lor \neg \left(y \leq 1.3 \cdot 10^{-169}\right):\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.0000000000000001e-27 or 1.30000000000000007e-169 < y

    1. Initial program 79.1%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{y}} \]
      2. add-sqr-sqrt50.7%

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

        \[\leadsto \color{blue}{\sqrt{x} \cdot \left(\sqrt{x} \cdot \frac{y - z}{y}\right)} \]
    4. Applied egg-rr50.7%

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

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{y - z}{y}} \]
      2. add-sqr-sqrt99.9%

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

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{y - z}}} \]
      4. un-div-inv99.9%

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

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

    if -2.0000000000000001e-27 < y < 1.30000000000000007e-169

    1. Initial program 91.3%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative91.3%

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

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

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

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

Alternative 3: 95.6% accurate, 0.4× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.99999999999999983e29 or 1.6000000000000001e-167 < y

    1. Initial program 77.9%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Step-by-step derivation
      1. remove-double-neg77.9%

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999983e29 < y < 1.6000000000000001e-167

    1. Initial program 92.3%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative92.3%

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

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

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

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

Alternative 4: 72.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+31}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.7999999999999996e31 or 7.7999999999999996e-14 < y

    1. Initial program 75.6%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Step-by-step derivation
      1. remove-double-neg75.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.7999999999999996e31 < y < 7.7999999999999996e-14

    1. Initial program 92.0%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num92.0%

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

        \[\leadsto \color{blue}{{\left(\frac{y}{x \cdot \left(y - z\right)}\right)}^{-1}} \]
    4. Applied egg-rr92.0%

      \[\leadsto \color{blue}{{\left(\frac{y}{x \cdot \left(y - z\right)}\right)}^{-1}} \]
    5. Step-by-step derivation
      1. unpow-192.0%

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

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{y}{x}}{y - z}}} \]
      3. associate-/r/94.7%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{+31}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 7.8 \cdot 10^{-14}:\\ \;\;\;\;\frac{z}{\frac{y}{-x}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 71.8% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{+32}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.19999999999999996e32 or 7.49999999999999981e-20 < y

    1. Initial program 75.6%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Step-by-step derivation
      1. remove-double-neg75.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.19999999999999996e32 < y < 7.49999999999999981e-20

    1. Initial program 92.0%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Step-by-step derivation
      1. remove-double-neg92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 70.0% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+32}:\\
\;\;\;\;x\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.2499999999999999e32 or 1.4000000000000001e-12 < y

    1. Initial program 75.6%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Step-by-step derivation
      1. remove-double-neg75.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2499999999999999e32 < y < 1.4000000000000001e-12

    1. Initial program 92.0%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Step-by-step derivation
      1. remove-double-neg92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 96.0% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-9}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 5.0000000000000001e-9

    1. Initial program 86.5%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Step-by-step derivation
      1. remove-double-neg86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-9 < x

    1. Initial program 69.8%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*99.9%

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{y}} \]
      2. add-sqr-sqrt99.5%

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

        \[\leadsto \color{blue}{\sqrt{x} \cdot \left(\sqrt{x} \cdot \frac{y - z}{y}\right)} \]
    4. Applied egg-rr99.5%

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

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right) \cdot \frac{y - z}{y}} \]
      2. add-sqr-sqrt99.9%

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

        \[\leadsto x \cdot \color{blue}{\frac{1}{\frac{y}{y - z}}} \]
      4. un-div-inv99.9%

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

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

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

Alternative 8: 96.0% accurate, 1.0× speedup?

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

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

    \[\frac{x \cdot \left(y - z\right)}{y} \]
  2. Step-by-step derivation
    1. remove-double-neg82.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 50.3% accurate, 7.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
	return x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x
end function
public static double code(double x, double y, double z) {
	return x;
}
def code(x, y, z):
	return x
function code(x, y, z)
	return x
end
function tmp = code(x, y, z)
	tmp = x;
end
code[x_, y_, z_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 82.6%

    \[\frac{x \cdot \left(y - z\right)}{y} \]
  2. Step-by-step derivation
    1. remove-double-neg82.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  6. Add Preprocessing

Developer Target 1: 96.1% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z < -2.060202331921739 \cdot 10^{+104}:\\
\;\;\;\;x - \frac{z \cdot x}{y}\\

\mathbf{elif}\;z < 1.6939766013828526 \cdot 10^{+213}:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024179 
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< z -206020233192173900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- x (/ (* z x) y)) (if (< z 1693976601382852600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ x (/ y (- y z))) (* (- y z) (/ x y)))))

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