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

Percentage Accurate: 88.0% → 98.8%
Time: 7.1s
Alternatives: 12
Speedup: 1.0×

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 12 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.0% 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: 98.8% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 80.3%

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

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

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

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

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

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

    if -0.849999999999999978 < z < 1

    1. Initial program 99.9%

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

        \[\leadsto \frac{\color{blue}{x \cdot \left(y - z\right) + x \cdot 1}}{z} \]
      2. *-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 z around 0 98.3%

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

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

Alternative 2: 65.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;z \leq -4.9 \cdot 10^{+64}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-63}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-211}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.05 \cdot 10^{-176}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.1 \cdot 10^{-158}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{+31}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))))
   (if (<= z -4.9e+64)
     (- x)
     (if (<= z -6.6e-63)
       t_0
       (if (<= z 7.2e-211)
         (/ x z)
         (if (<= z 3.05e-176)
           t_0
           (if (<= z 5.1e-158) (/ x z) (if (<= z 3.6e+31) t_0 (- x)))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -4.9e+64) {
		tmp = -x;
	} else if (z <= -6.6e-63) {
		tmp = t_0;
	} else if (z <= 7.2e-211) {
		tmp = x / z;
	} else if (z <= 3.05e-176) {
		tmp = t_0;
	} else if (z <= 5.1e-158) {
		tmp = x / z;
	} else if (z <= 3.6e+31) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y * (x / z)
    if (z <= (-4.9d+64)) then
        tmp = -x
    else if (z <= (-6.6d-63)) then
        tmp = t_0
    else if (z <= 7.2d-211) then
        tmp = x / z
    else if (z <= 3.05d-176) then
        tmp = t_0
    else if (z <= 5.1d-158) then
        tmp = x / z
    else if (z <= 3.6d+31) then
        tmp = t_0
    else
        tmp = -x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -4.9e+64) {
		tmp = -x;
	} else if (z <= -6.6e-63) {
		tmp = t_0;
	} else if (z <= 7.2e-211) {
		tmp = x / z;
	} else if (z <= 3.05e-176) {
		tmp = t_0;
	} else if (z <= 5.1e-158) {
		tmp = x / z;
	} else if (z <= 3.6e+31) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if z <= -4.9e+64:
		tmp = -x
	elif z <= -6.6e-63:
		tmp = t_0
	elif z <= 7.2e-211:
		tmp = x / z
	elif z <= 3.05e-176:
		tmp = t_0
	elif z <= 5.1e-158:
		tmp = x / z
	elif z <= 3.6e+31:
		tmp = t_0
	else:
		tmp = -x
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(x / z))
	tmp = 0.0
	if (z <= -4.9e+64)
		tmp = Float64(-x);
	elseif (z <= -6.6e-63)
		tmp = t_0;
	elseif (z <= 7.2e-211)
		tmp = Float64(x / z);
	elseif (z <= 3.05e-176)
		tmp = t_0;
	elseif (z <= 5.1e-158)
		tmp = Float64(x / z);
	elseif (z <= 3.6e+31)
		tmp = t_0;
	else
		tmp = Float64(-x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (x / z);
	tmp = 0.0;
	if (z <= -4.9e+64)
		tmp = -x;
	elseif (z <= -6.6e-63)
		tmp = t_0;
	elseif (z <= 7.2e-211)
		tmp = x / z;
	elseif (z <= 3.05e-176)
		tmp = t_0;
	elseif (z <= 5.1e-158)
		tmp = x / z;
	elseif (z <= 3.6e+31)
		tmp = t_0;
	else
		tmp = -x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.9e+64], (-x), If[LessEqual[z, -6.6e-63], t$95$0, If[LessEqual[z, 7.2e-211], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.05e-176], t$95$0, If[LessEqual[z, 5.1e-158], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.6e+31], t$95$0, (-x)]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -6.6 \cdot 10^{-63}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 7.2 \cdot 10^{-211}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 3.05 \cdot 10^{-176}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 5.1 \cdot 10^{-158}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 3.6 \cdot 10^{+31}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.9000000000000003e64 or 3.59999999999999996e31 < z

    1. Initial program 77.5%

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

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

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

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

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

    if -4.9000000000000003e64 < z < -6.59999999999999987e-63 or 7.1999999999999998e-211 < z < 3.0500000000000001e-176 or 5.1000000000000003e-158 < z < 3.59999999999999996e31

    1. Initial program 98.6%

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

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

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

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

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

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

    if -6.59999999999999987e-63 < z < 7.1999999999999998e-211 or 3.0500000000000001e-176 < z < 5.1000000000000003e-158

    1. Initial program 100.0%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.9 \cdot 10^{+64}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -6.6 \cdot 10^{-63}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 7.2 \cdot 10^{-211}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.05 \cdot 10^{-176}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 5.1 \cdot 10^{-158}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.6 \cdot 10^{+31}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 3: 64.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;z \leq -2.1 \cdot 10^{+97}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-29}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-214}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-184}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 9.6 \cdot 10^{-162}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+31}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))))
   (if (<= z -2.1e+97)
     (- x)
     (if (<= z -3.2e-29)
       (* x (/ y z))
       (if (<= z 7.5e-214)
         (/ x z)
         (if (<= z 4.8e-184)
           t_0
           (if (<= z 9.6e-162) (/ x z) (if (<= z 1.2e+31) t_0 (- x)))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -2.1e+97) {
		tmp = -x;
	} else if (z <= -3.2e-29) {
		tmp = x * (y / z);
	} else if (z <= 7.5e-214) {
		tmp = x / z;
	} else if (z <= 4.8e-184) {
		tmp = t_0;
	} else if (z <= 9.6e-162) {
		tmp = x / z;
	} else if (z <= 1.2e+31) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y * (x / z)
    if (z <= (-2.1d+97)) then
        tmp = -x
    else if (z <= (-3.2d-29)) then
        tmp = x * (y / z)
    else if (z <= 7.5d-214) then
        tmp = x / z
    else if (z <= 4.8d-184) then
        tmp = t_0
    else if (z <= 9.6d-162) then
        tmp = x / z
    else if (z <= 1.2d+31) then
        tmp = t_0
    else
        tmp = -x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -2.1e+97) {
		tmp = -x;
	} else if (z <= -3.2e-29) {
		tmp = x * (y / z);
	} else if (z <= 7.5e-214) {
		tmp = x / z;
	} else if (z <= 4.8e-184) {
		tmp = t_0;
	} else if (z <= 9.6e-162) {
		tmp = x / z;
	} else if (z <= 1.2e+31) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if z <= -2.1e+97:
		tmp = -x
	elif z <= -3.2e-29:
		tmp = x * (y / z)
	elif z <= 7.5e-214:
		tmp = x / z
	elif z <= 4.8e-184:
		tmp = t_0
	elif z <= 9.6e-162:
		tmp = x / z
	elif z <= 1.2e+31:
		tmp = t_0
	else:
		tmp = -x
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(x / z))
	tmp = 0.0
	if (z <= -2.1e+97)
		tmp = Float64(-x);
	elseif (z <= -3.2e-29)
		tmp = Float64(x * Float64(y / z));
	elseif (z <= 7.5e-214)
		tmp = Float64(x / z);
	elseif (z <= 4.8e-184)
		tmp = t_0;
	elseif (z <= 9.6e-162)
		tmp = Float64(x / z);
	elseif (z <= 1.2e+31)
		tmp = t_0;
	else
		tmp = Float64(-x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (x / z);
	tmp = 0.0;
	if (z <= -2.1e+97)
		tmp = -x;
	elseif (z <= -3.2e-29)
		tmp = x * (y / z);
	elseif (z <= 7.5e-214)
		tmp = x / z;
	elseif (z <= 4.8e-184)
		tmp = t_0;
	elseif (z <= 9.6e-162)
		tmp = x / z;
	elseif (z <= 1.2e+31)
		tmp = t_0;
	else
		tmp = -x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.1e+97], (-x), If[LessEqual[z, -3.2e-29], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.5e-214], N[(x / z), $MachinePrecision], If[LessEqual[z, 4.8e-184], t$95$0, If[LessEqual[z, 9.6e-162], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.2e+31], t$95$0, (-x)]]]]]]]
\begin{array}{l}

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

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

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

\mathbf{elif}\;z \leq 4.8 \cdot 10^{-184}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 1.2 \cdot 10^{+31}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -2.10000000000000012e97 or 1.19999999999999991e31 < z

    1. Initial program 76.5%

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

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

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

        \[\leadsto \color{blue}{-x} \]
    5. Simplified84.2%

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

    if -2.10000000000000012e97 < z < -3.2e-29

    1. Initial program 99.6%

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

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

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

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{y}}} \]
    5. Step-by-step derivation
      1. div-inv61.4%

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

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

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

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

    if -3.2e-29 < z < 7.49999999999999966e-214 or 4.80000000000000049e-184 < z < 9.6000000000000007e-162

    1. Initial program 100.0%

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

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

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

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

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

    if 7.49999999999999966e-214 < z < 4.80000000000000049e-184 or 9.6000000000000007e-162 < z < 1.19999999999999991e31

    1. Initial program 98.1%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -2.1 \cdot 10^{+97}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -3.2 \cdot 10^{-29}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{-214}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-184}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 9.6 \cdot 10^{-162}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.2 \cdot 10^{+31}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 4: 83.1% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq 1.5 \cdot 10^{+23} \lor \neg \left(y \leq 3.8 \cdot 10^{+68}\right) \land y \leq 9.2 \cdot 10^{+142}:\\
\;\;\;\;\frac{x}{z} - x\\

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


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

    1. Initial program 88.5%

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

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

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

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

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

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

    if -1.7999999999999999e46 < y < 1.5e23 or 3.8000000000000001e68 < y < 9.20000000000000009e142

    1. Initial program 87.8%

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

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

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

    if 1.5e23 < y < 3.8000000000000001e68 or 9.20000000000000009e142 < y

    1. Initial program 96.1%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.8 \cdot 10^{+46}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+23} \lor \neg \left(y \leq 3.8 \cdot 10^{+68}\right) \land y \leq 9.2 \cdot 10^{+142}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array} \]

Alternative 5: 83.7% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq 1.2 \cdot 10^{+23}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 2 \cdot 10^{+68}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;y \leq 4.2 \cdot 10^{+127}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 88.5%

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

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

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

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

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

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

    if -3.20000000000000014e43 < y < 1.2e23 or 1.99999999999999991e68 < y < 4.19999999999999983e127

    1. Initial program 88.0%

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

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

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

    if 1.2e23 < y < 1.99999999999999991e68

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

    if 4.19999999999999983e127 < y

    1. Initial program 92.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{+43}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+68}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+127}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array} \]

Alternative 6: 84.3% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;y \leq 1.28 \cdot 10^{+23}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;y \leq 5.4 \cdot 10^{+68}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;y \leq 2.8 \cdot 10^{+127}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 88.5%

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

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

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

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

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

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

    if -2.3e42 < y < 1.28e23 or 5.39999999999999982e68 < y < 2.8000000000000002e127

    1. Initial program 88.0%

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

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

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

    if 1.28e23 < y < 5.39999999999999982e68

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

    if 2.8000000000000002e127 < y

    1. Initial program 92.8%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{+42}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 1.28 \cdot 10^{+23}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+68}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{+127}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array} \]

Alternative 7: 94.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 90.6%

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

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

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

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

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

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

    if -1 < y < 1

    1. Initial program 88.6%

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

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

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

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

Alternative 8: 95.3% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 90.6%

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

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

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

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

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

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

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

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

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

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

    if -1 < y < 1

    1. Initial program 88.6%

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

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

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

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

Alternative 9: 97.0% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 90.6%

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} - x \]
    5. Simplified95.0%

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

    if -1 < y < 1

    1. Initial program 88.6%

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

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

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

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

Alternative 10: 96.1% accurate, 1.0× speedup?

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

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

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

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

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

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

Alternative 11: 65.6% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 80.0%

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

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

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

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

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

    if -1 < z < 122000

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 12: 38.8% 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 89.5%

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

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

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

      \[\leadsto \color{blue}{-x} \]
  5. Simplified41.2%

    \[\leadsto \color{blue}{-x} \]
  6. Final simplification41.2%

    \[\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 2023185 
(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))