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

Percentage Accurate: 88.1% → 99.5%
Time: 7.2s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 88.1% 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.5% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

    if -2.5500000000000001e23 < z < 0.0013500000000000001

    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. *-rgt-identity99.9%

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

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

    if 0.0013500000000000001 < z

    1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{\frac{-z}{y}} - x \]
      10. sqrt-unprod36.0%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\frac{-z}{y}} - x \]
      11. add-sqr-sqrt61.4%

        \[\leadsto \color{blue}{x} \cdot \frac{1}{\frac{-z}{y}} - x \]
      12. clear-num61.4%

        \[\leadsto x \cdot \color{blue}{\frac{y}{-z}} - x \]
      13. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} - x \]
      14. sqrt-unprod86.1%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}} - x \]
      15. sqr-neg86.1%

        \[\leadsto x \cdot \frac{y}{\sqrt{\color{blue}{z \cdot z}}} - x \]
      16. sqrt-unprod99.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} - x \]
      17. add-sqr-sqrt99.9%

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

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

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

Alternative 2: 58.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -1.25 \cdot 10^{+26}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -7.1 \cdot 10^{-62}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-191}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-209}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-186}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-138}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 420000000:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (/ y z))))
   (if (<= y -1.25e+26)
     t_0
     (if (<= y -7.1e-62)
       (- x)
       (if (<= y -5.5e-191)
         (/ x z)
         (if (<= y 2.1e-209)
           (- x)
           (if (<= y 1.45e-186)
             (/ x z)
             (if (<= y 1.2e-138)
               (- x)
               (if (<= y 420000000.0) (/ x z) t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = x * (y / z);
	double tmp;
	if (y <= -1.25e+26) {
		tmp = t_0;
	} else if (y <= -7.1e-62) {
		tmp = -x;
	} else if (y <= -5.5e-191) {
		tmp = x / z;
	} else if (y <= 2.1e-209) {
		tmp = -x;
	} else if (y <= 1.45e-186) {
		tmp = x / z;
	} else if (y <= 1.2e-138) {
		tmp = -x;
	} else if (y <= 420000000.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 = x * (y / z)
    if (y <= (-1.25d+26)) then
        tmp = t_0
    else if (y <= (-7.1d-62)) then
        tmp = -x
    else if (y <= (-5.5d-191)) then
        tmp = x / z
    else if (y <= 2.1d-209) then
        tmp = -x
    else if (y <= 1.45d-186) then
        tmp = x / z
    else if (y <= 1.2d-138) then
        tmp = -x
    else if (y <= 420000000.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 = x * (y / z);
	double tmp;
	if (y <= -1.25e+26) {
		tmp = t_0;
	} else if (y <= -7.1e-62) {
		tmp = -x;
	} else if (y <= -5.5e-191) {
		tmp = x / z;
	} else if (y <= 2.1e-209) {
		tmp = -x;
	} else if (y <= 1.45e-186) {
		tmp = x / z;
	} else if (y <= 1.2e-138) {
		tmp = -x;
	} else if (y <= 420000000.0) {
		tmp = x / z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (y / z)
	tmp = 0
	if y <= -1.25e+26:
		tmp = t_0
	elif y <= -7.1e-62:
		tmp = -x
	elif y <= -5.5e-191:
		tmp = x / z
	elif y <= 2.1e-209:
		tmp = -x
	elif y <= 1.45e-186:
		tmp = x / z
	elif y <= 1.2e-138:
		tmp = -x
	elif y <= 420000000.0:
		tmp = x / z
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(y / z))
	tmp = 0.0
	if (y <= -1.25e+26)
		tmp = t_0;
	elseif (y <= -7.1e-62)
		tmp = Float64(-x);
	elseif (y <= -5.5e-191)
		tmp = Float64(x / z);
	elseif (y <= 2.1e-209)
		tmp = Float64(-x);
	elseif (y <= 1.45e-186)
		tmp = Float64(x / z);
	elseif (y <= 1.2e-138)
		tmp = Float64(-x);
	elseif (y <= 420000000.0)
		tmp = Float64(x / z);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (y / z);
	tmp = 0.0;
	if (y <= -1.25e+26)
		tmp = t_0;
	elseif (y <= -7.1e-62)
		tmp = -x;
	elseif (y <= -5.5e-191)
		tmp = x / z;
	elseif (y <= 2.1e-209)
		tmp = -x;
	elseif (y <= 1.45e-186)
		tmp = x / z;
	elseif (y <= 1.2e-138)
		tmp = -x;
	elseif (y <= 420000000.0)
		tmp = x / z;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.25e+26], t$95$0, If[LessEqual[y, -7.1e-62], (-x), If[LessEqual[y, -5.5e-191], N[(x / z), $MachinePrecision], If[LessEqual[y, 2.1e-209], (-x), If[LessEqual[y, 1.45e-186], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.2e-138], (-x), If[LessEqual[y, 420000000.0], N[(x / z), $MachinePrecision], t$95$0]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq -7.1 \cdot 10^{-62}:\\
\;\;\;\;-x\\

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

\mathbf{elif}\;y \leq 2.1 \cdot 10^{-209}:\\
\;\;\;\;-x\\

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

\mathbf{elif}\;y \leq 1.2 \cdot 10^{-138}:\\
\;\;\;\;-x\\

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

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


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

    1. Initial program 90.9%

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

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

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

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

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

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

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

    if -1.25e26 < y < -7.1000000000000001e-62 or -5.5000000000000001e-191 < y < 2.09999999999999996e-209 or 1.4500000000000001e-186 < y < 1.2e-138

    1. Initial program 87.2%

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

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

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

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

    if -7.1000000000000001e-62 < y < -5.5000000000000001e-191 or 2.09999999999999996e-209 < y < 1.4500000000000001e-186 or 1.2e-138 < y < 4.2e8

    1. Initial program 96.5%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x + x \cdot y}{z}} \]
    5. Taylor expanded in x around -inf 71.2%

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{z}{-1 \cdot y - 1}}} \]
      4. sub-neg71.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.25 \cdot 10^{+26}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq -7.1 \cdot 10^{-62}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{-191}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 2.1 \cdot 10^{-209}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-186}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-138}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 420000000:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array} \]

Alternative 3: 61.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;y \leq -1.08 \cdot 10^{+18}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{-62}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{-191}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-209}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-187}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{-138}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 420000000:\\ \;\;\;\;\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 -1.08e+18)
     t_0
     (if (<= y -8.5e-62)
       (- x)
       (if (<= y -5.6e-191)
         (/ x z)
         (if (<= y 3.2e-209)
           (- x)
           (if (<= y 8e-187)
             (/ x z)
             (if (<= y 1.02e-138)
               (- x)
               (if (<= y 420000000.0) (/ x z) t_0)))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (y <= -1.08e+18) {
		tmp = t_0;
	} else if (y <= -8.5e-62) {
		tmp = -x;
	} else if (y <= -5.6e-191) {
		tmp = x / z;
	} else if (y <= 3.2e-209) {
		tmp = -x;
	} else if (y <= 8e-187) {
		tmp = x / z;
	} else if (y <= 1.02e-138) {
		tmp = -x;
	} else if (y <= 420000000.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 <= (-1.08d+18)) then
        tmp = t_0
    else if (y <= (-8.5d-62)) then
        tmp = -x
    else if (y <= (-5.6d-191)) then
        tmp = x / z
    else if (y <= 3.2d-209) then
        tmp = -x
    else if (y <= 8d-187) then
        tmp = x / z
    else if (y <= 1.02d-138) then
        tmp = -x
    else if (y <= 420000000.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 <= -1.08e+18) {
		tmp = t_0;
	} else if (y <= -8.5e-62) {
		tmp = -x;
	} else if (y <= -5.6e-191) {
		tmp = x / z;
	} else if (y <= 3.2e-209) {
		tmp = -x;
	} else if (y <= 8e-187) {
		tmp = x / z;
	} else if (y <= 1.02e-138) {
		tmp = -x;
	} else if (y <= 420000000.0) {
		tmp = x / z;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if y <= -1.08e+18:
		tmp = t_0
	elif y <= -8.5e-62:
		tmp = -x
	elif y <= -5.6e-191:
		tmp = x / z
	elif y <= 3.2e-209:
		tmp = -x
	elif y <= 8e-187:
		tmp = x / z
	elif y <= 1.02e-138:
		tmp = -x
	elif y <= 420000000.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 <= -1.08e+18)
		tmp = t_0;
	elseif (y <= -8.5e-62)
		tmp = Float64(-x);
	elseif (y <= -5.6e-191)
		tmp = Float64(x / z);
	elseif (y <= 3.2e-209)
		tmp = Float64(-x);
	elseif (y <= 8e-187)
		tmp = Float64(x / z);
	elseif (y <= 1.02e-138)
		tmp = Float64(-x);
	elseif (y <= 420000000.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 <= -1.08e+18)
		tmp = t_0;
	elseif (y <= -8.5e-62)
		tmp = -x;
	elseif (y <= -5.6e-191)
		tmp = x / z;
	elseif (y <= 3.2e-209)
		tmp = -x;
	elseif (y <= 8e-187)
		tmp = x / z;
	elseif (y <= 1.02e-138)
		tmp = -x;
	elseif (y <= 420000000.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, -1.08e+18], t$95$0, If[LessEqual[y, -8.5e-62], (-x), If[LessEqual[y, -5.6e-191], N[(x / z), $MachinePrecision], If[LessEqual[y, 3.2e-209], (-x), If[LessEqual[y, 8e-187], N[(x / z), $MachinePrecision], If[LessEqual[y, 1.02e-138], (-x), If[LessEqual[y, 420000000.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 -1.08 \cdot 10^{+18}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq -8.5 \cdot 10^{-62}:\\
\;\;\;\;-x\\

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

\mathbf{elif}\;y \leq 3.2 \cdot 10^{-209}:\\
\;\;\;\;-x\\

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

\mathbf{elif}\;y \leq 1.02 \cdot 10^{-138}:\\
\;\;\;\;-x\\

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

    if -1.08e18 < y < -8.4999999999999995e-62 or -5.60000000000000023e-191 < y < 3.2000000000000001e-209 or 8.0000000000000001e-187 < y < 1.02000000000000007e-138

    1. Initial program 88.1%

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

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

        \[\leadsto \color{blue}{-x} \]
    4. Simplified67.6%

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

    if -8.4999999999999995e-62 < y < -5.60000000000000023e-191 or 3.2000000000000001e-209 < y < 8.0000000000000001e-187 or 1.02000000000000007e-138 < y < 4.2e8

    1. Initial program 96.5%

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x + x \cdot y}{z}} \]
    5. Taylor expanded in x around -inf 71.2%

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{z}{-1 \cdot y - 1}}} \]
      4. sub-neg71.2%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.08 \cdot 10^{+18}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{-62}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq -5.6 \cdot 10^{-191}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-209}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-187}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{-138}:\\ \;\;\;\;-x\\ \mathbf{elif}\;y \leq 420000000:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]

Alternative 4: 99.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-19} \lor \neg \left(z \leq 2 \cdot 10^{-31}\right):\\
\;\;\;\;\frac{x}{\frac{z}{1 + \left(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 < -9.4999999999999995e-19 or 2e-31 < z

    1. Initial program 82.5%

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

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

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

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

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

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

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

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

    if -9.4999999999999995e-19 < z < 2e-31

    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.9%

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

Alternative 5: 99.9% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 80.6%

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

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

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

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

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

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

    if -1.4499999999999999e24 < z < 2e15

    1. Initial program 99.9%

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

        \[\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 2e15 < z

    1. Initial program 78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\frac{-z}{y}} - x \]
      11. add-sqr-sqrt62.7%

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

        \[\leadsto x \cdot \color{blue}{\frac{y}{-z}} - x \]
      13. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} - x \]
      14. sqrt-unprod85.8%

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

        \[\leadsto x \cdot \frac{y}{\sqrt{\color{blue}{z \cdot z}}} - x \]
      16. sqrt-unprod99.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} - x \]
      17. add-sqr-sqrt99.9%

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

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

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

Alternative 6: 99.5% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;z \leq 0.00135:\\
\;\;\;\;\frac{x \cdot t_0}{z}\\

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


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

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

    if -6.0000000000000002e23 < z < 0.0013500000000000001

    1. Initial program 99.9%

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

    if 0.0013500000000000001 < z

    1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{\frac{-z}{y}} - x \]
      10. sqrt-unprod36.0%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\frac{-z}{y}} - x \]
      11. add-sqr-sqrt61.4%

        \[\leadsto \color{blue}{x} \cdot \frac{1}{\frac{-z}{y}} - x \]
      12. clear-num61.4%

        \[\leadsto x \cdot \color{blue}{\frac{y}{-z}} - x \]
      13. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} - x \]
      14. sqrt-unprod86.1%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}} - x \]
      15. sqr-neg86.1%

        \[\leadsto x \cdot \frac{y}{\sqrt{\color{blue}{z \cdot z}}} - x \]
      16. sqrt-unprod99.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} - x \]
      17. add-sqr-sqrt99.9%

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

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

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

Alternative 7: 94.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.8 \cdot 10^{+17} \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 -3.8e+17) (not (<= y 1.0)))
   (* x (+ -1.0 (/ y z)))
   (- (/ x z) x)))
double code(double x, double y, double z) {
	double tmp;
	if ((y <= -3.8e+17) || !(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 <= (-3.8d+17)) .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 <= -3.8e+17) || !(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 <= -3.8e+17) 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 <= -3.8e+17) || !(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 <= -3.8e+17) || ~((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, -3.8e+17], 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 -3.8 \cdot 10^{+17} \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 < -3.8e17 or 1 < y

    1. Initial program 90.4%

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

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

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

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

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

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

    if -3.8e17 < y < 1

    1. Initial program 91.7%

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

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

      \[\leadsto \color{blue}{-1 \cdot x + \frac{x}{z}} \]
    4. Step-by-step derivation
      1. neg-mul-198.5%

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

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

        \[\leadsto \color{blue}{\frac{x}{z} - x} \]
    5. Simplified98.5%

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

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

Alternative 8: 94.5% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 90.3%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{-z}} \cdot y - x \]
      5. associate-/r/89.2%

        \[\leadsto \color{blue}{\frac{-x}{\frac{-z}{y}}} - x \]
      6. div-inv87.3%

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

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

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

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{\frac{-z}{y}} - x \]
      10. sqrt-unprod13.5%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\frac{-z}{y}} - x \]
      11. add-sqr-sqrt19.4%

        \[\leadsto \color{blue}{x} \cdot \frac{1}{\frac{-z}{y}} - x \]
      12. clear-num19.4%

        \[\leadsto x \cdot \color{blue}{\frac{y}{-z}} - x \]
      13. add-sqr-sqrt12.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} - x \]
      14. sqrt-unprod46.9%

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

        \[\leadsto x \cdot \frac{y}{\sqrt{\color{blue}{z \cdot z}}} - x \]
      16. sqrt-unprod40.6%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} - x \]
      17. add-sqr-sqrt87.3%

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

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

    if -3.8e17 < y < 1

    1. Initial program 91.7%

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

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

      \[\leadsto \color{blue}{-1 \cdot x + \frac{x}{z}} \]
    4. Step-by-step derivation
      1. neg-mul-198.5%

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

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

        \[\leadsto \color{blue}{\frac{x}{z} - x} \]
    5. Simplified98.5%

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

    if 1 < y

    1. Initial program 90.4%

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

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

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

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

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

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

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

Alternative 9: 95.3% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 82.8%

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

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

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

        \[\leadsto -1 \cdot x + \color{blue}{\frac{x}{z} \cdot y} \]
    5. Simplified93.2%

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

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

    if -0.032000000000000001 < z < 0.0013500000000000001

    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. *-rgt-identity99.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 + y}}} \]
    9. Simplified89.1%

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

    if 0.0013500000000000001 < z

    1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{\frac{-z}{y}} - x \]
      10. sqrt-unprod36.0%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\frac{-z}{y}} - x \]
      11. add-sqr-sqrt61.4%

        \[\leadsto \color{blue}{x} \cdot \frac{1}{\frac{-z}{y}} - x \]
      12. clear-num61.4%

        \[\leadsto x \cdot \color{blue}{\frac{y}{-z}} - x \]
      13. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} - x \]
      14. sqrt-unprod86.1%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}} - x \]
      15. sqr-neg86.1%

        \[\leadsto x \cdot \frac{y}{\sqrt{\color{blue}{z \cdot z}}} - x \]
      16. sqrt-unprod99.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} - x \]
      17. add-sqr-sqrt99.9%

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

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

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

Alternative 10: 98.9% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 82.3%

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

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

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

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

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

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

    if -1.1000000000000001 < z < 0.0013500000000000001

    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 97.5%

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

    if 0.0013500000000000001 < z

    1. Initial program 78.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \sqrt{\color{blue}{x \cdot x}} \cdot \frac{1}{\frac{-z}{y}} - x \]
      10. sqrt-unprod36.0%

        \[\leadsto \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} \cdot \frac{1}{\frac{-z}{y}} - x \]
      11. add-sqr-sqrt61.4%

        \[\leadsto \color{blue}{x} \cdot \frac{1}{\frac{-z}{y}} - x \]
      12. clear-num61.4%

        \[\leadsto x \cdot \color{blue}{\frac{y}{-z}} - x \]
      13. add-sqr-sqrt0.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{-z} \cdot \sqrt{-z}}} - x \]
      14. sqrt-unprod86.1%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{\left(-z\right) \cdot \left(-z\right)}}} - x \]
      15. sqr-neg86.1%

        \[\leadsto x \cdot \frac{y}{\sqrt{\color{blue}{z \cdot z}}} - x \]
      16. sqrt-unprod99.8%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\sqrt{z} \cdot \sqrt{z}}} - x \]
      17. add-sqr-sqrt99.9%

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

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

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

Alternative 11: 97.7% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 95.7%

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

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

    if 2.9000000000000001e-117 < x

    1. Initial program 83.0%

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

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

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

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

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

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

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

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

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

Alternative 12: 85.4% accurate, 1.0× speedup?

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

    1. Initial program 90.4%

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

      \[\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/78.9%

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

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

    if -2.8e18 < y < 5.0999999999999999e42

    1. Initial program 91.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot x + \frac{x}{z}} \]
    4. Step-by-step derivation
      1. neg-mul-196.6%

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

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

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

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

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

Alternative 13: 85.2% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+41}:\\
\;\;\;\;\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 < -8e17

    1. Initial program 90.3%

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

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

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

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

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

        \[\leadsto \color{blue}{y \cdot \frac{x}{z}} \]
      2. clear-num73.0%

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

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

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

    if -8e17 < y < 4.8000000000000003e41

    1. Initial program 91.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot x + \frac{x}{z}} \]
    4. Step-by-step derivation
      1. neg-mul-196.6%

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

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

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

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

    if 4.8000000000000003e41 < y

    1. Initial program 90.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -8 \cdot 10^{+17}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 4.8 \cdot 10^{+41}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]

Alternative 14: 85.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 2.6 \cdot 10^{+40}:\\
\;\;\;\;\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 < -5.1e17

    1. Initial program 90.3%

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

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

    if -5.1e17 < y < 2.6000000000000001e40

    1. Initial program 91.5%

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

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

      \[\leadsto \color{blue}{-1 \cdot x + \frac{x}{z}} \]
    4. Step-by-step derivation
      1. neg-mul-196.6%

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

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

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

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

    if 2.6000000000000001e40 < y

    1. Initial program 90.6%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.1 \cdot 10^{+17}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{+40}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]

Alternative 15: 64.5% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;z \leq 6 \cdot 10^{+17}:\\
\;\;\;\;\frac{x}{z}\\

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


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

    1. Initial program 80.5%

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

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

        \[\leadsto \color{blue}{-x} \]
    4. Simplified73.5%

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

    if -1 < z < 6e17

    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 97.6%

      \[\leadsto \color{blue}{\frac{x + x \cdot y}{z}} \]
    5. Taylor expanded in x around -inf 97.6%

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

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

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

        \[\leadsto \color{blue}{\frac{-x}{\frac{z}{-1 \cdot y - 1}}} \]
      4. sub-neg88.8%

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

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

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

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

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

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

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

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

Alternative 16: 39.0% 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 91.0%

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

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

      \[\leadsto \color{blue}{-x} \]
  4. Simplified35.3%

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

    \[\leadsto -x \]

Developer target: 99.5% 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 2023290 
(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))