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

Percentage Accurate: 87.6% → 99.9%
Time: 8.2s
Alternatives: 14
Speedup: 0.6×

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 14 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.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.50000000000000003e-17 or 9.2000000000000003e-48 < z

    1. Initial program 75.5%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. +-commutative75.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) \]
    5. Simplified99.8%

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

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

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

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

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

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

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

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

    if -1.50000000000000003e-17 < z < 9.2000000000000003e-48

    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. Add Preprocessing
    5. 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.9%

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

Alternative 2: 63.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ t_1 := x \cdot \frac{y}{z}\\ \mathbf{if}\;z \leq -3.2 \cdot 10^{+77}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2.55 \cdot 10^{-79}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-93}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-267}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-229}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-208}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 3.25 \cdot 10^{-159}:\\ \;\;\;\;x \cdot \frac{1}{z}\\ \mathbf{elif}\;z \leq 6.3 \cdot 10^{-65}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+105}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))) (t_1 (* x (/ y z))))
   (if (<= z -3.2e+77)
     (- x)
     (if (<= z -2.55e-79)
       t_1
       (if (<= z -2.5e-93)
         (/ x z)
         (if (<= z -1.65e-267)
           t_0
           (if (<= z 1.55e-229)
             (/ x z)
             (if (<= z 1.4e-208)
               t_0
               (if (<= z 3.25e-159)
                 (* x (/ 1.0 z))
                 (if (<= z 6.3e-65)
                   t_0
                   (if (<= z 8.6e-13)
                     (/ x z)
                     (if (<= z 1.35e+105) t_1 (- x)))))))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double t_1 = x * (y / z);
	double tmp;
	if (z <= -3.2e+77) {
		tmp = -x;
	} else if (z <= -2.55e-79) {
		tmp = t_1;
	} else if (z <= -2.5e-93) {
		tmp = x / z;
	} else if (z <= -1.65e-267) {
		tmp = t_0;
	} else if (z <= 1.55e-229) {
		tmp = x / z;
	} else if (z <= 1.4e-208) {
		tmp = t_0;
	} else if (z <= 3.25e-159) {
		tmp = x * (1.0 / z);
	} else if (z <= 6.3e-65) {
		tmp = t_0;
	} else if (z <= 8.6e-13) {
		tmp = x / z;
	} else if (z <= 1.35e+105) {
		tmp = t_1;
	} 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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y * (x / z)
    t_1 = x * (y / z)
    if (z <= (-3.2d+77)) then
        tmp = -x
    else if (z <= (-2.55d-79)) then
        tmp = t_1
    else if (z <= (-2.5d-93)) then
        tmp = x / z
    else if (z <= (-1.65d-267)) then
        tmp = t_0
    else if (z <= 1.55d-229) then
        tmp = x / z
    else if (z <= 1.4d-208) then
        tmp = t_0
    else if (z <= 3.25d-159) then
        tmp = x * (1.0d0 / z)
    else if (z <= 6.3d-65) then
        tmp = t_0
    else if (z <= 8.6d-13) then
        tmp = x / z
    else if (z <= 1.35d+105) then
        tmp = t_1
    else
        tmp = -x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double t_1 = x * (y / z);
	double tmp;
	if (z <= -3.2e+77) {
		tmp = -x;
	} else if (z <= -2.55e-79) {
		tmp = t_1;
	} else if (z <= -2.5e-93) {
		tmp = x / z;
	} else if (z <= -1.65e-267) {
		tmp = t_0;
	} else if (z <= 1.55e-229) {
		tmp = x / z;
	} else if (z <= 1.4e-208) {
		tmp = t_0;
	} else if (z <= 3.25e-159) {
		tmp = x * (1.0 / z);
	} else if (z <= 6.3e-65) {
		tmp = t_0;
	} else if (z <= 8.6e-13) {
		tmp = x / z;
	} else if (z <= 1.35e+105) {
		tmp = t_1;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	t_1 = x * (y / z)
	tmp = 0
	if z <= -3.2e+77:
		tmp = -x
	elif z <= -2.55e-79:
		tmp = t_1
	elif z <= -2.5e-93:
		tmp = x / z
	elif z <= -1.65e-267:
		tmp = t_0
	elif z <= 1.55e-229:
		tmp = x / z
	elif z <= 1.4e-208:
		tmp = t_0
	elif z <= 3.25e-159:
		tmp = x * (1.0 / z)
	elif z <= 6.3e-65:
		tmp = t_0
	elif z <= 8.6e-13:
		tmp = x / z
	elif z <= 1.35e+105:
		tmp = t_1
	else:
		tmp = -x
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(x / z))
	t_1 = Float64(x * Float64(y / z))
	tmp = 0.0
	if (z <= -3.2e+77)
		tmp = Float64(-x);
	elseif (z <= -2.55e-79)
		tmp = t_1;
	elseif (z <= -2.5e-93)
		tmp = Float64(x / z);
	elseif (z <= -1.65e-267)
		tmp = t_0;
	elseif (z <= 1.55e-229)
		tmp = Float64(x / z);
	elseif (z <= 1.4e-208)
		tmp = t_0;
	elseif (z <= 3.25e-159)
		tmp = Float64(x * Float64(1.0 / z));
	elseif (z <= 6.3e-65)
		tmp = t_0;
	elseif (z <= 8.6e-13)
		tmp = Float64(x / z);
	elseif (z <= 1.35e+105)
		tmp = t_1;
	else
		tmp = Float64(-x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (x / z);
	t_1 = x * (y / z);
	tmp = 0.0;
	if (z <= -3.2e+77)
		tmp = -x;
	elseif (z <= -2.55e-79)
		tmp = t_1;
	elseif (z <= -2.5e-93)
		tmp = x / z;
	elseif (z <= -1.65e-267)
		tmp = t_0;
	elseif (z <= 1.55e-229)
		tmp = x / z;
	elseif (z <= 1.4e-208)
		tmp = t_0;
	elseif (z <= 3.25e-159)
		tmp = x * (1.0 / z);
	elseif (z <= 6.3e-65)
		tmp = t_0;
	elseif (z <= 8.6e-13)
		tmp = x / z;
	elseif (z <= 1.35e+105)
		tmp = t_1;
	else
		tmp = -x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.2e+77], (-x), If[LessEqual[z, -2.55e-79], t$95$1, If[LessEqual[z, -2.5e-93], N[(x / z), $MachinePrecision], If[LessEqual[z, -1.65e-267], t$95$0, If[LessEqual[z, 1.55e-229], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.4e-208], t$95$0, If[LessEqual[z, 3.25e-159], N[(x * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.3e-65], t$95$0, If[LessEqual[z, 8.6e-13], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.35e+105], t$95$1, (-x)]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
t_1 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -3.2 \cdot 10^{+77}:\\
\;\;\;\;-x\\

\mathbf{elif}\;z \leq -2.55 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;z \leq -2.5 \cdot 10^{-93}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq -1.65 \cdot 10^{-267}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 1.55 \cdot 10^{-229}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{-208}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 3.25 \cdot 10^{-159}:\\
\;\;\;\;x \cdot \frac{1}{z}\\

\mathbf{elif}\;z \leq 6.3 \cdot 10^{-65}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 8.6 \cdot 10^{-13}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 1.35 \cdot 10^{+105}:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if z < -3.2000000000000002e77 or 1.35000000000000008e105 < z

    1. Initial program 65.6%

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

      \[\leadsto \color{blue}{-1 \cdot x} \]
    4. Step-by-step derivation
      1. mul-1-neg80.8%

        \[\leadsto \color{blue}{-x} \]
    5. Simplified80.8%

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

    if -3.2000000000000002e77 < z < -2.55e-79 or 8.5999999999999997e-13 < z < 1.35000000000000008e105

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

    if -2.55e-79 < z < -2.49999999999999997e-93 or -1.65000000000000002e-267 < z < 1.55e-229 or 6.2999999999999997e-65 < z < 8.5999999999999997e-13

    1. Initial program 100.0%

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

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

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

    if -2.49999999999999997e-93 < z < -1.65000000000000002e-267 or 1.55e-229 < z < 1.40000000000000001e-208 or 3.2500000000000001e-159 < z < 6.2999999999999997e-65

    1. Initial program 99.8%

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

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

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

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

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

    if 1.40000000000000001e-208 < z < 3.2500000000000001e-159

    1. Initial program 100.0%

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

      \[\leadsto \color{blue}{\frac{x \cdot \left(1 - z\right)}{z}} \]
    4. Step-by-step derivation
      1. *-un-lft-identity93.5%

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

        \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{1 - z}{z}} \]
      3. add-sqr-sqrt33.0%

        \[\leadsto \frac{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}{1} \cdot \frac{1 - z}{z} \]
      4. sqrt-unprod23.0%

        \[\leadsto \frac{\color{blue}{\sqrt{x \cdot x}}}{1} \cdot \frac{1 - z}{z} \]
      5. sqr-neg23.0%

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

        \[\leadsto \frac{\color{blue}{\sqrt{-x} \cdot \sqrt{-x}}}{1} \cdot \frac{1 - z}{z} \]
      7. add-sqr-sqrt0.6%

        \[\leadsto \frac{\color{blue}{-x}}{1} \cdot \frac{1 - z}{z} \]
      8. div-inv0.6%

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

        \[\leadsto \left(\left(-x\right) \cdot \color{blue}{1}\right) \cdot \frac{1 - z}{z} \]
      10. *-commutative0.6%

        \[\leadsto \color{blue}{\left(1 \cdot \left(-x\right)\right)} \cdot \frac{1 - z}{z} \]
      11. *-un-lft-identity0.6%

        \[\leadsto \color{blue}{\left(-x\right)} \cdot \frac{1 - z}{z} \]
      12. add-sqr-sqrt0.3%

        \[\leadsto \color{blue}{\left(\sqrt{-x} \cdot \sqrt{-x}\right)} \cdot \frac{1 - z}{z} \]
      13. sqrt-unprod23.0%

        \[\leadsto \color{blue}{\sqrt{\left(-x\right) \cdot \left(-x\right)}} \cdot \frac{1 - z}{z} \]
      14. sqr-neg23.0%

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1 - z}{z} \]
      15. sqrt-unprod33.0%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1 - z}{z} \]
      16. add-sqr-sqrt93.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.2 \cdot 10^{+77}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2.55 \cdot 10^{-79}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-93}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-267}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 1.55 \cdot 10^{-229}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-208}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 3.25 \cdot 10^{-159}:\\ \;\;\;\;x \cdot \frac{1}{z}\\ \mathbf{elif}\;z \leq 6.3 \cdot 10^{-65}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 8.6 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+105}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 60.2% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;y \leq -5.6 \cdot 10^{+36}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{-130}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-162}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq -4.1 \cdot 10^{-199}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{-267}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 2.75 \cdot 10^{-266}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-95}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-78}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))))
   (if (<= y -5.6e+36)
     t_0
     (if (<= y -7.2e-130)
       (- x)
       (if (<= y -1.45e-162)
         (/ x z)
         (if (<= y -4.1e-199)
           (- x)
           (if (<= y -2.25e-267)
             (/ x z)
             (if (<= y 2.75e-266)
               (- x)
               (if (<= y 4.2e-95)
                 (/ x z)
                 (if (<= y 5.2e-78) (- x) (if (<= y 1.0) (/ x z) t_0)))))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (y <= -5.6e+36) {
		tmp = t_0;
	} else if (y <= -7.2e-130) {
		tmp = -x;
	} else if (y <= -1.45e-162) {
		tmp = x / z;
	} else if (y <= -4.1e-199) {
		tmp = -x;
	} else if (y <= -2.25e-267) {
		tmp = x / z;
	} else if (y <= 2.75e-266) {
		tmp = -x;
	} else if (y <= 4.2e-95) {
		tmp = x / z;
	} else if (y <= 5.2e-78) {
		tmp = -x;
	} else if (y <= 1.0) {
		tmp = x / 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 = y * (x / z)
    if (y <= (-5.6d+36)) then
        tmp = t_0
    else if (y <= (-7.2d-130)) then
        tmp = -x
    else if (y <= (-1.45d-162)) then
        tmp = x / z
    else if (y <= (-4.1d-199)) then
        tmp = -x
    else if (y <= (-2.25d-267)) then
        tmp = x / z
    else if (y <= 2.75d-266) then
        tmp = -x
    else if (y <= 4.2d-95) then
        tmp = x / z
    else if (y <= 5.2d-78) then
        tmp = -x
    else if (y <= 1.0d0) then
        tmp = x / z
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (y <= -5.6e+36) {
		tmp = t_0;
	} else if (y <= -7.2e-130) {
		tmp = -x;
	} else if (y <= -1.45e-162) {
		tmp = x / z;
	} else if (y <= -4.1e-199) {
		tmp = -x;
	} else if (y <= -2.25e-267) {
		tmp = x / z;
	} else if (y <= 2.75e-266) {
		tmp = -x;
	} else if (y <= 4.2e-95) {
		tmp = x / z;
	} else if (y <= 5.2e-78) {
		tmp = -x;
	} else if (y <= 1.0) {
		tmp = x / z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if y <= -5.6e+36:
		tmp = t_0
	elif y <= -7.2e-130:
		tmp = -x
	elif y <= -1.45e-162:
		tmp = x / z
	elif y <= -4.1e-199:
		tmp = -x
	elif y <= -2.25e-267:
		tmp = x / z
	elif y <= 2.75e-266:
		tmp = -x
	elif y <= 4.2e-95:
		tmp = x / z
	elif y <= 5.2e-78:
		tmp = -x
	elif y <= 1.0:
		tmp = x / z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(x / z))
	tmp = 0.0
	if (y <= -5.6e+36)
		tmp = t_0;
	elseif (y <= -7.2e-130)
		tmp = Float64(-x);
	elseif (y <= -1.45e-162)
		tmp = Float64(x / z);
	elseif (y <= -4.1e-199)
		tmp = Float64(-x);
	elseif (y <= -2.25e-267)
		tmp = Float64(x / z);
	elseif (y <= 2.75e-266)
		tmp = Float64(-x);
	elseif (y <= 4.2e-95)
		tmp = Float64(x / z);
	elseif (y <= 5.2e-78)
		tmp = Float64(-x);
	elseif (y <= 1.0)
		tmp = Float64(x / z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (x / z);
	tmp = 0.0;
	if (y <= -5.6e+36)
		tmp = t_0;
	elseif (y <= -7.2e-130)
		tmp = -x;
	elseif (y <= -1.45e-162)
		tmp = x / z;
	elseif (y <= -4.1e-199)
		tmp = -x;
	elseif (y <= -2.25e-267)
		tmp = x / z;
	elseif (y <= 2.75e-266)
		tmp = -x;
	elseif (y <= 4.2e-95)
		tmp = x / z;
	elseif (y <= 5.2e-78)
		tmp = -x;
	elseif (y <= 1.0)
		tmp = x / z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.6e+36], t$95$0, If[LessEqual[y, -7.2e-130], (-x), If[LessEqual[y, -1.45e-162], N[(x / z), $MachinePrecision], If[LessEqual[y, -4.1e-199], (-x), If[LessEqual[y, -2.25e-267], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.75e-266], (-x), If[LessEqual[y, 4.2e-95], N[(x / z), $MachinePrecision], If[LessEqual[y, 5.2e-78], (-x), If[LessEqual[y, 1.0], N[(x / z), $MachinePrecision], t$95$0]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -7.2 \cdot 10^{-130}:\\
\;\;\;\;-x\\

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

\mathbf{elif}\;y \leq -4.1 \cdot 10^{-199}:\\
\;\;\;\;-x\\

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

\mathbf{elif}\;y \leq 2.75 \cdot 10^{-266}:\\
\;\;\;\;-x\\

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

\mathbf{elif}\;y \leq 5.2 \cdot 10^{-78}:\\
\;\;\;\;-x\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


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

    1. Initial program 85.5%

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

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

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

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

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

    if -5.6000000000000001e36 < y < -7.2000000000000003e-130 or -1.4500000000000001e-162 < y < -4.10000000000000022e-199 or -2.25e-267 < y < 2.75000000000000013e-266 or 4.2e-95 < y < 5.2000000000000002e-78

    1. Initial program 79.4%

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

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

        \[\leadsto \color{blue}{-x} \]
    5. Simplified68.0%

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

    if -7.2000000000000003e-130 < y < -1.4500000000000001e-162 or -4.10000000000000022e-199 < y < -2.25e-267 or 2.75000000000000013e-266 < y < 4.2e-95 or 5.2000000000000002e-78 < y < 1

    1. Initial program 95.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.6 \cdot 10^{+36}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{-130}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-162}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq -4.1 \cdot 10^{-199}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -2.25 \cdot 10^{-267}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 2.75 \cdot 10^{-266}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{-95}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-78}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 1:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 94.2% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{if}\;y \leq -3:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;y \leq 8.8 \cdot 10^{+192}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 82.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3 < y < 1

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.8000000000000003e192 < y

    1. Initial program 95.7%

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

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

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

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

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

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

Alternative 5: 99.8% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.0000000000000002e-14 or 9.50000000000000029e-17 < z

    1. Initial program 73.8%

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

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

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

        \[\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) \]
    5. Simplified99.8%

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

    if -5.0000000000000002e-14 < z < 9.50000000000000029e-17

    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. Add Preprocessing
    5. 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.9%

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

Alternative 6: 95.2% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 84.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{z} \cdot x - x} \]
      4. clear-num91.5%

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 + y}} - x} \]
    8. Taylor expanded in y around inf 92.0%

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

    if -3 < y < 1

    1. Initial program 88.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 98.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -1:\\ \;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\ \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.0)
   (* x (+ -1.0 (/ y z)))
   (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.0) {
		tmp = x * (-1.0 + (y / z));
	} 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.0d0)) then
        tmp = x * ((-1.0d0) + (y / z))
    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.0) {
		tmp = x * (-1.0 + (y / z));
	} 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.0:
		tmp = x * (-1.0 + (y / z))
	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.0)
		tmp = Float64(x * Float64(-1.0 + Float64(y / z)));
	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.0)
		tmp = x * (-1.0 + (y / z));
	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.0], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $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:\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\

\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

    1. Initial program 69.8%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. +-commutative69.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.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) \]
    5. Simplified99.9%

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

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

    if -1 < z < 1

    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. Add Preprocessing
    5. Taylor expanded in z around 0 98.9%

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

    if 1 < z

    1. Initial program 73.2%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. +-commutative73.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) \]
    5. Simplified99.8%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 + y}} - x} \]
    8. Taylor expanded in y around inf 98.3%

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

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

Alternative 8: 84.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.45 \cdot 10^{+34} \lor \neg \left(y \leq 1.1 \cdot 10^{+117}\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.45e+34) (not (<= y 1.1e+117))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -1.45e+34) || !(y <= 1.1e+117)) {
		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.45d+34)) .or. (.not. (y <= 1.1d+117))) 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.45e+34) || !(y <= 1.1e+117)) {
		tmp = y * (x / z);
	} else {
		tmp = (x / z) - x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (y <= -1.45e+34) or not (y <= 1.1e+117):
		tmp = y * (x / z)
	else:
		tmp = (x / z) - x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((y <= -1.45e+34) || !(y <= 1.1e+117))
		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.45e+34) || ~((y <= 1.1e+117)))
		tmp = y * (x / z);
	else
		tmp = (x / z) - x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.45e+34], N[Not[LessEqual[y, 1.1e+117]], $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.45 \cdot 10^{+34} \lor \neg \left(y \leq 1.1 \cdot 10^{+117}\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.4500000000000001e34 or 1.10000000000000007e117 < y

    1. Initial program 84.9%

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

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

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

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

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

    if -1.4500000000000001e34 < y < 1.10000000000000007e117

    1. Initial program 87.9%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. +-commutative87.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.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) \]
    5. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 84.7% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2999999999999998e34 < y < 2.2e116

    1. Initial program 87.9%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. +-commutative87.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.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) \]
    5. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

    if 2.2e116 < y

    1. Initial program 90.8%

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

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

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

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

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

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

Alternative 10: 84.9% accurate, 0.6× speedup?

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

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+16}:\\
\;\;\;\;\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.2e37

    1. Initial program 81.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2e37 < y < 4.8e16

    1. Initial program 87.3%

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

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

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

        \[\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) \]
    5. Simplified99.8%

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

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

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

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

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

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

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

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

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

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

    if 4.8e16 < y

    1. Initial program 92.1%

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

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

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

Alternative 11: 97.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 92.4%

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

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

    if 3.5e13 < x

    1. Initial program 70.1%

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

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

        \[\leadsto \frac{x \cdot \color{blue}{\left(1 + \left(y - z\right)\right)}}{z} \]
      2. +-commutative70.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) \]
    5. Simplified99.8%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{z}{1 + y}} - x \]
    7. Applied egg-rr100.0%

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

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

Alternative 12: 93.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 92.0%

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

    if 6.00000000000000018e-54 < x

    1. Initial program 74.0%

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

      \[\leadsto \color{blue}{\frac{x \cdot \left(\left(1 + y\right) - z\right)}{z}} \]
    4. 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.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) \]
    5. Simplified99.8%

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x}}{\frac{z}{1 + y}} - x \]
    7. Applied egg-rr100.0%

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

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

Alternative 13: 64.2% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.014 \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.0140000000000000003 or 1 < z

    1. Initial program 72.1%

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

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

        \[\leadsto \color{blue}{-x} \]
    5. Simplified65.6%

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

    if -0.0140000000000000003 < z < 1

    1. Initial program 99.9%

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

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

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

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

Alternative 14: 39.2% 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 86.6%

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

    \[\leadsto \color{blue}{-1 \cdot x} \]
  4. Step-by-step derivation
    1. mul-1-neg32.8%

      \[\leadsto \color{blue}{-x} \]
  5. Simplified32.8%

    \[\leadsto \color{blue}{-x} \]
  6. Final simplification32.8%

    \[\leadsto -x \]
  7. Add Preprocessing

Developer target: 99.5% accurate, 0.4× 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 2024041 
(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))