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

Percentage Accurate: 85.0% → 95.8%
Time: 5.3s
Alternatives: 10
Speedup: 0.8×

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

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.9499999999999999e77

    1. Initial program 89.5%

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

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

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

    if -1.9499999999999999e77 < z

    1. Initial program 83.4%

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

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

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

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

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

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

Alternative 2: 70.6% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.8 \cdot 10^{-36} \lor \neg \left(z \leq 4.4 \cdot 10^{+48}\right):\\
\;\;\;\;x \cdot \frac{-z}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -3.79999999999999971e-36 or 4.3999999999999999e48 < z

    1. Initial program 90.1%

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{y}} \]
      4. div-sub91.5%

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

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

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

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

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

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

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

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

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

    if -3.79999999999999971e-36 < z < 4.3999999999999999e48

    1. Initial program 78.3%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{y} - \frac{z}{y}\right)} \]
      5. *-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. Taylor expanded in z around 0 78.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{-36} \lor \neg \left(z \leq 4.4 \cdot 10^{+48}\right):\\ \;\;\;\;x \cdot \frac{-z}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternative 3: 72.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{-36} \lor \neg \left(z \leq 4 \cdot 10^{+49}\right):\\
\;\;\;\;z \cdot \frac{-x}{y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.10000000000000013e-36 or 3.99999999999999979e49 < z

    1. Initial program 90.1%

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{y}} \]
      4. div-sub91.5%

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

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

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

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

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

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

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

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

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

    if -4.10000000000000013e-36 < z < 3.99999999999999979e49

    1. Initial program 78.3%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{y} - \frac{z}{y}\right)} \]
      5. *-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. Taylor expanded in z around 0 78.4%

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

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

Alternative 4: 71.3% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq 4.5 \cdot 10^{+48}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.89999999999999985e-36

    1. Initial program 89.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.89999999999999985e-36 < z < 4.49999999999999995e48

    1. Initial program 78.3%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{y} - \frac{z}{y}\right)} \]
      5. *-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. Taylor expanded in z around 0 78.4%

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

    if 4.49999999999999995e48 < z

    1. Initial program 91.1%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}} \]
    5. Applied egg-rr96.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.9 \cdot 10^{-36}:\\ \;\;\;\;z \cdot \frac{-x}{y}\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+48}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{-y}{z}}\\ \end{array} \]

Alternative 5: 72.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+51}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.8499999999999999e-36

    1. Initial program 89.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8499999999999999e-36 < z < 1.34999999999999996e51

    1. Initial program 78.3%

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(\frac{y}{y} - \frac{z}{y}\right)} \]
      5. *-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. Taylor expanded in z around 0 78.4%

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

    if 1.34999999999999996e51 < z

    1. Initial program 91.1%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.85 \cdot 10^{-36}:\\ \;\;\;\;z \cdot \frac{-x}{y}\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+51}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{z \cdot \left(-x\right)}{y}\\ \end{array} \]

Alternative 6: 95.2% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.9000000000000001e192

    1. Initial program 85.6%

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y - z}{y}} \]
      4. div-sub76.5%

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

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

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

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

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

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

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

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

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

    if -2.9000000000000001e192 < z

    1. Initial program 84.4%

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

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

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

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

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

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

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

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

Alternative 7: 95.6% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -4.3999999999999997e65

    1. Initial program 89.9%

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

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

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

    if -4.3999999999999997e65 < z

    1. Initial program 83.3%

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

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

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

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

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

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

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

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

Alternative 8: 51.5% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+216}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 6.50000000000000029e216

    1. Initial program 85.5%

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

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

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

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

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

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

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

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

    if 6.50000000000000029e216 < x

    1. Initial program 74.0%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot y} \]
    4. Applied egg-rr53.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 6.5 \cdot 10^{+216}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{y}\\ \end{array} \]

Alternative 9: 51.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{+178}:\\
\;\;\;\;x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2.79999999999999993e178

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

    if 2.79999999999999993e178 < x

    1. Initial program 71.7%

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot y} \]
    4. Applied egg-rr58.8%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot y} \]
    5. Step-by-step derivation
      1. *-commutative58.8%

        \[\leadsto \color{blue}{y \cdot \frac{x}{y}} \]
      2. clear-num58.6%

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

        \[\leadsto \color{blue}{\frac{y}{\frac{y}{x}}} \]
    6. Applied egg-rr58.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 2.8 \cdot 10^{+178}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{y}{x}}\\ \end{array} \]

Alternative 10: 50.9% 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 84.5%

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{x} \]
  5. Final simplification49.3%

    \[\leadsto x \]

Developer target: 96.2% accurate, 0.6× 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 2023332 
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))

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