Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3

Percentage Accurate: 87.6% → 99.9%
Time: 7.1s
Alternatives: 15
Speedup: 0.8×

Specification

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

\\
\frac{x \cdot \left(\left(y - z\right) + 1\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 15 alternatives:

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

Initial Program: 87.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.0000000000000001e26

    1. Initial program 69.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} + \left(-x\right) \]
    10. Step-by-step derivation
      1. unsub-neg99.9%

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

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

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

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

    if -2.0000000000000001e26 < z < 8.2e13

    1. Initial program 99.8%

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

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

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

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

    if 8.2e13 < z

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.9% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.09999999999999981e-15 or 1.1e-16 < z

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.09999999999999981e-15 < z < 1.1e-16

    1. Initial program 99.9%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. distribute-lft-in99.9%

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y - z, x\right)}{z}} \]
    4. Taylor expanded in z around 0 99.9%

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

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

Alternative 3: 97.4% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 91.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.9999999999999998e-199 < x

    1. Initial program 80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 64.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.49:\\
\;\;\;\;-x\\

\mathbf{elif}\;z \leq 8.2 \cdot 10^{-169}:\\
\;\;\;\;\frac{x}{z}\\

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

\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -0.48999999999999999 or 1 < z

    1. Initial program 72.9%

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

      \[\leadsto \color{blue}{-1 \cdot x} \]
    3. Step-by-step derivation
      1. mul-1-neg72.0%

        \[\leadsto \color{blue}{-x} \]
    4. Simplified72.0%

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

    if -0.48999999999999999 < z < 8.1999999999999996e-169 or 2.59999999999999995e-123 < z < 1

    1. Initial program 99.8%

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 - z}}} \]
    4. Simplified66.5%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 - z}}} \]
    5. Taylor expanded in z around 0 63.7%

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

    if 8.1999999999999996e-169 < z < 2.59999999999999995e-123

    1. Initial program 99.9%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.49:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-169}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-123}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 5: 94.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < y < 1

    1. Initial program 89.4%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{z} - 1\right)} \]
    6. Step-by-step derivation
      1. sub-neg98.9%

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot x}{z}} + -1 \cdot x \]
      5. *-lft-identity99.1%

        \[\leadsto \frac{\color{blue}{x}}{z} + -1 \cdot x \]
      6. neg-mul-199.1%

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

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

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

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

Alternative 6: 98.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 72.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < z < 1

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 98.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}} - x} \]
      2. div-inv98.5%

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} - x \]
    11. Applied egg-rr98.6%

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

    if -0.94999999999999996 < z < 1

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1 < z

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 98.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}} - x} \]
      2. div-inv98.5%

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} - x \]
    11. Applied egg-rr98.6%

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

    if -0.97999999999999998 < z < 1

    1. Initial program 99.8%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. distribute-lft-in99.9%

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y - z, x\right)}{z}} \]
    4. Taylor expanded in z around 0 97.3%

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

    if 1 < z

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 98.8% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}} - x} \]
      2. div-inv98.5%

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{z}} - x \]
    11. Applied egg-rr98.6%

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

    if -1.05000000000000004 < z < 1

    1. Initial program 99.8%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Step-by-step derivation
      1. distribute-lft-in99.9%

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

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y - z, x\right)}{z}} \]
    4. Taylor expanded in z around 0 97.3%

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

    if 1 < z

    1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.05:\\ \;\;\;\;x \cdot \frac{y}{z} - x\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{x + x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}} - x\\ \end{array} \]

Alternative 10: 93.5% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 92.5%

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

    if 1.4499999999999999e-77 < x

    1. Initial program 74.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 93.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 92.7%

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

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

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

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

    if 6.00000000000000007e-43 < x

    1. Initial program 71.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 85.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+20} \lor \neg \left(y \leq 2.3 \cdot 10^{+14}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.15e20 or 2.3e14 < y

    1. Initial program 84.1%

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

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

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

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

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

    if -1.15e20 < y < 2.3e14

    1. Initial program 89.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{z} - 1\right)} \]
    6. Step-by-step derivation
      1. sub-neg97.7%

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot x}{z}} + -1 \cdot x \]
      5. *-lft-identity97.9%

        \[\leadsto \frac{\color{blue}{x}}{z} + -1 \cdot x \]
      6. neg-mul-197.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.15 \cdot 10^{+20} \lor \neg \left(y \leq 2.3 \cdot 10^{+14}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} - x\\ \end{array} \]

Alternative 13: 84.9% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 42000000000000:\\
\;\;\;\;\frac{x}{z} - x\\

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


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

    1. Initial program 82.7%

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

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

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

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

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

    if -1.2e16 < y < 4.2e13

    1. Initial program 89.2%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{z} - 1\right)} \]
    6. Step-by-step derivation
      1. sub-neg97.7%

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot x}{z}} + -1 \cdot x \]
      5. *-lft-identity97.9%

        \[\leadsto \frac{\color{blue}{x}}{z} + -1 \cdot x \]
      6. neg-mul-197.9%

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

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

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

    if 4.2e13 < y

    1. Initial program 85.5%

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

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

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

Alternative 14: 64.7% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.49 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;-x\\

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


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

    1. Initial program 72.9%

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

      \[\leadsto \color{blue}{-1 \cdot x} \]
    3. Step-by-step derivation
      1. mul-1-neg72.0%

        \[\leadsto \color{blue}{-x} \]
    4. Simplified72.0%

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

    if -0.48999999999999999 < z < 1

    1. Initial program 99.8%

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 - z}}} \]
    4. Simplified63.5%

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 - z}}} \]
    5. Taylor expanded in z around 0 60.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -0.49 \lor \neg \left(z \leq 1\right):\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]

Alternative 15: 38.5% accurate, 4.5× 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 Float64(-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 87.0%

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

    \[\leadsto \color{blue}{-1 \cdot x} \]
  3. Step-by-step derivation
    1. mul-1-neg36.1%

      \[\leadsto \color{blue}{-x} \]
  4. Simplified36.1%

    \[\leadsto \color{blue}{-x} \]
  5. Final simplification36.1%

    \[\leadsto -x \]

Developer target: 99.4% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023316 
(FPCore (x y z)
  :name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))

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