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

Percentage Accurate: 88.4% → 99.9%
Time: 7.4s
Alternatives: 15
Speedup: 0.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 15 alternatives:

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

Initial Program: 88.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.9% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 77.4%

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

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

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

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

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

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

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

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

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

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

    if -10 < z < 2.9999999999999998e-25

    1. Initial program 99.9%

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

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

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

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

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

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

Alternative 2: 64.8% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ t_1 := x \cdot \frac{y}{z}\\ \mathbf{if}\;z \leq -3.4 \cdot 10^{+90}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2.05 \cdot 10^{-17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{-135}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-200}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-226}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-99}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 9.8 \cdot 10^{-74}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.08 \cdot 10^{+92}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))) (t_1 (* x (/ y z))))
   (if (<= z -3.4e+90)
     (- x)
     (if (<= z -2.05e-17)
       t_1
       (if (<= z -2.15e-135)
         (/ x z)
         (if (<= z -2e-200)
           t_0
           (if (<= z 4.8e-226)
             (/ x z)
             (if (<= z 1.85e-99)
               t_0
               (if (<= z 9.8e-74)
                 (/ x z)
                 (if (<= z 5.2e-41)
                   t_0
                   (if (<= z 1.4e-17)
                     (/ x z)
                     (if (<= z 1.08e+92) t_1 (- x)))))))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double t_1 = x * (y / z);
	double tmp;
	if (z <= -3.4e+90) {
		tmp = -x;
	} else if (z <= -2.05e-17) {
		tmp = t_1;
	} else if (z <= -2.15e-135) {
		tmp = x / z;
	} else if (z <= -2e-200) {
		tmp = t_0;
	} else if (z <= 4.8e-226) {
		tmp = x / z;
	} else if (z <= 1.85e-99) {
		tmp = t_0;
	} else if (z <= 9.8e-74) {
		tmp = x / z;
	} else if (z <= 5.2e-41) {
		tmp = t_0;
	} else if (z <= 1.4e-17) {
		tmp = x / z;
	} else if (z <= 1.08e+92) {
		tmp = t_1;
	} else {
		tmp = -x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y * (x / z)
    t_1 = x * (y / z)
    if (z <= (-3.4d+90)) then
        tmp = -x
    else if (z <= (-2.05d-17)) then
        tmp = t_1
    else if (z <= (-2.15d-135)) then
        tmp = x / z
    else if (z <= (-2d-200)) then
        tmp = t_0
    else if (z <= 4.8d-226) then
        tmp = x / z
    else if (z <= 1.85d-99) then
        tmp = t_0
    else if (z <= 9.8d-74) then
        tmp = x / z
    else if (z <= 5.2d-41) then
        tmp = t_0
    else if (z <= 1.4d-17) then
        tmp = x / z
    else if (z <= 1.08d+92) then
        tmp = t_1
    else
        tmp = -x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double t_1 = x * (y / z);
	double tmp;
	if (z <= -3.4e+90) {
		tmp = -x;
	} else if (z <= -2.05e-17) {
		tmp = t_1;
	} else if (z <= -2.15e-135) {
		tmp = x / z;
	} else if (z <= -2e-200) {
		tmp = t_0;
	} else if (z <= 4.8e-226) {
		tmp = x / z;
	} else if (z <= 1.85e-99) {
		tmp = t_0;
	} else if (z <= 9.8e-74) {
		tmp = x / z;
	} else if (z <= 5.2e-41) {
		tmp = t_0;
	} else if (z <= 1.4e-17) {
		tmp = x / z;
	} else if (z <= 1.08e+92) {
		tmp = t_1;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	t_1 = x * (y / z)
	tmp = 0
	if z <= -3.4e+90:
		tmp = -x
	elif z <= -2.05e-17:
		tmp = t_1
	elif z <= -2.15e-135:
		tmp = x / z
	elif z <= -2e-200:
		tmp = t_0
	elif z <= 4.8e-226:
		tmp = x / z
	elif z <= 1.85e-99:
		tmp = t_0
	elif z <= 9.8e-74:
		tmp = x / z
	elif z <= 5.2e-41:
		tmp = t_0
	elif z <= 1.4e-17:
		tmp = x / z
	elif z <= 1.08e+92:
		tmp = t_1
	else:
		tmp = -x
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(x / z))
	t_1 = Float64(x * Float64(y / z))
	tmp = 0.0
	if (z <= -3.4e+90)
		tmp = Float64(-x);
	elseif (z <= -2.05e-17)
		tmp = t_1;
	elseif (z <= -2.15e-135)
		tmp = Float64(x / z);
	elseif (z <= -2e-200)
		tmp = t_0;
	elseif (z <= 4.8e-226)
		tmp = Float64(x / z);
	elseif (z <= 1.85e-99)
		tmp = t_0;
	elseif (z <= 9.8e-74)
		tmp = Float64(x / z);
	elseif (z <= 5.2e-41)
		tmp = t_0;
	elseif (z <= 1.4e-17)
		tmp = Float64(x / z);
	elseif (z <= 1.08e+92)
		tmp = t_1;
	else
		tmp = Float64(-x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (x / z);
	t_1 = x * (y / z);
	tmp = 0.0;
	if (z <= -3.4e+90)
		tmp = -x;
	elseif (z <= -2.05e-17)
		tmp = t_1;
	elseif (z <= -2.15e-135)
		tmp = x / z;
	elseif (z <= -2e-200)
		tmp = t_0;
	elseif (z <= 4.8e-226)
		tmp = x / z;
	elseif (z <= 1.85e-99)
		tmp = t_0;
	elseif (z <= 9.8e-74)
		tmp = x / z;
	elseif (z <= 5.2e-41)
		tmp = t_0;
	elseif (z <= 1.4e-17)
		tmp = x / z;
	elseif (z <= 1.08e+92)
		tmp = t_1;
	else
		tmp = -x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+90], (-x), If[LessEqual[z, -2.05e-17], t$95$1, If[LessEqual[z, -2.15e-135], N[(x / z), $MachinePrecision], If[LessEqual[z, -2e-200], t$95$0, If[LessEqual[z, 4.8e-226], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.85e-99], t$95$0, If[LessEqual[z, 9.8e-74], N[(x / z), $MachinePrecision], If[LessEqual[z, 5.2e-41], t$95$0, If[LessEqual[z, 1.4e-17], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.08e+92], t$95$1, (-x)]]]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.05 \cdot 10^{-17}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;z \leq -2.15 \cdot 10^{-135}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq -2 \cdot 10^{-200}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 4.8 \cdot 10^{-226}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 1.85 \cdot 10^{-99}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 9.8 \cdot 10^{-74}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 5.2 \cdot 10^{-41}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.4 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 1.08 \cdot 10^{+92}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -3.40000000000000018e90 or 1.08e92 < z

    1. Initial program 68.4%

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

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

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

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

        \[\leadsto \color{blue}{-x} \]
    6. Simplified83.1%

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

    if -3.40000000000000018e90 < z < -2.05e-17 or 1.3999999999999999e-17 < z < 1.08e92

    1. Initial program 95.4%

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

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

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

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

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

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

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

    if -2.05e-17 < z < -2.14999999999999999e-135 or -2e-200 < z < 4.7999999999999999e-226 or 1.85e-99 < z < 9.8000000000000006e-74 or 5.1999999999999999e-41 < z < 1.3999999999999999e-17

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{z} \cdot x} \]
    6. Simplified92.6%

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

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

    if -2.14999999999999999e-135 < z < -2e-200 or 4.7999999999999999e-226 < z < 1.85e-99 or 9.8000000000000006e-74 < z < 5.1999999999999999e-41

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    6. Simplified81.2%

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    7. Step-by-step derivation
      1. clear-num81.0%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.4 \cdot 10^{+90}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2.05 \cdot 10^{-17}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq -2.15 \cdot 10^{-135}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-200}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-226}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-99}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 9.8 \cdot 10^{-74}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-41}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 1.4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.08 \cdot 10^{+92}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 3: 64.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;z \leq -1.35:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-136}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{-200}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-226}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-99}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-76}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-41}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.08 \cdot 10^{+92}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))))
   (if (<= z -1.35)
     (- x)
     (if (<= z -1.7e-136)
       (/ x z)
       (if (<= z -1.8e-200)
         t_0
         (if (<= z 5.5e-226)
           (/ x z)
           (if (<= z 2.1e-99)
             t_0
             (if (<= z 5.2e-76)
               (/ x z)
               (if (<= z 3.2e-41)
                 t_0
                 (if (<= z 2.3e-17)
                   (/ x z)
                   (if (<= z 1.08e+92) t_0 (- x))))))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -1.35) {
		tmp = -x;
	} else if (z <= -1.7e-136) {
		tmp = x / z;
	} else if (z <= -1.8e-200) {
		tmp = t_0;
	} else if (z <= 5.5e-226) {
		tmp = x / z;
	} else if (z <= 2.1e-99) {
		tmp = t_0;
	} else if (z <= 5.2e-76) {
		tmp = x / z;
	} else if (z <= 3.2e-41) {
		tmp = t_0;
	} else if (z <= 2.3e-17) {
		tmp = x / z;
	} else if (z <= 1.08e+92) {
		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 <= (-1.35d0)) then
        tmp = -x
    else if (z <= (-1.7d-136)) then
        tmp = x / z
    else if (z <= (-1.8d-200)) then
        tmp = t_0
    else if (z <= 5.5d-226) then
        tmp = x / z
    else if (z <= 2.1d-99) then
        tmp = t_0
    else if (z <= 5.2d-76) then
        tmp = x / z
    else if (z <= 3.2d-41) then
        tmp = t_0
    else if (z <= 2.3d-17) then
        tmp = x / z
    else if (z <= 1.08d+92) 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 <= -1.35) {
		tmp = -x;
	} else if (z <= -1.7e-136) {
		tmp = x / z;
	} else if (z <= -1.8e-200) {
		tmp = t_0;
	} else if (z <= 5.5e-226) {
		tmp = x / z;
	} else if (z <= 2.1e-99) {
		tmp = t_0;
	} else if (z <= 5.2e-76) {
		tmp = x / z;
	} else if (z <= 3.2e-41) {
		tmp = t_0;
	} else if (z <= 2.3e-17) {
		tmp = x / z;
	} else if (z <= 1.08e+92) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if z <= -1.35:
		tmp = -x
	elif z <= -1.7e-136:
		tmp = x / z
	elif z <= -1.8e-200:
		tmp = t_0
	elif z <= 5.5e-226:
		tmp = x / z
	elif z <= 2.1e-99:
		tmp = t_0
	elif z <= 5.2e-76:
		tmp = x / z
	elif z <= 3.2e-41:
		tmp = t_0
	elif z <= 2.3e-17:
		tmp = x / z
	elif z <= 1.08e+92:
		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 <= -1.35)
		tmp = Float64(-x);
	elseif (z <= -1.7e-136)
		tmp = Float64(x / z);
	elseif (z <= -1.8e-200)
		tmp = t_0;
	elseif (z <= 5.5e-226)
		tmp = Float64(x / z);
	elseif (z <= 2.1e-99)
		tmp = t_0;
	elseif (z <= 5.2e-76)
		tmp = Float64(x / z);
	elseif (z <= 3.2e-41)
		tmp = t_0;
	elseif (z <= 2.3e-17)
		tmp = Float64(x / z);
	elseif (z <= 1.08e+92)
		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 <= -1.35)
		tmp = -x;
	elseif (z <= -1.7e-136)
		tmp = x / z;
	elseif (z <= -1.8e-200)
		tmp = t_0;
	elseif (z <= 5.5e-226)
		tmp = x / z;
	elseif (z <= 2.1e-99)
		tmp = t_0;
	elseif (z <= 5.2e-76)
		tmp = x / z;
	elseif (z <= 3.2e-41)
		tmp = t_0;
	elseif (z <= 2.3e-17)
		tmp = x / z;
	elseif (z <= 1.08e+92)
		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, -1.35], (-x), If[LessEqual[z, -1.7e-136], N[(x / z), $MachinePrecision], If[LessEqual[z, -1.8e-200], t$95$0, If[LessEqual[z, 5.5e-226], N[(x / z), $MachinePrecision], If[LessEqual[z, 2.1e-99], t$95$0, If[LessEqual[z, 5.2e-76], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.2e-41], t$95$0, If[LessEqual[z, 2.3e-17], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.08e+92], t$95$0, (-x)]]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -1.7 \cdot 10^{-136}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq -1.8 \cdot 10^{-200}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 2.1 \cdot 10^{-99}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 5.2 \cdot 10^{-76}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 3.2 \cdot 10^{-41}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 2.3 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 1.08 \cdot 10^{+92}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 72.7%

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

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

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

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

        \[\leadsto \color{blue}{-x} \]
    6. Simplified76.7%

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

    if -1.3500000000000001 < z < -1.7e-136 or -1.8000000000000001e-200 < z < 5.5e-226 or 2.09999999999999984e-99 < z < 5.1999999999999999e-76 or 3.20000000000000012e-41 < z < 2.30000000000000009e-17

    1. Initial program 99.9%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{z} \cdot x} \]
    6. Simplified92.7%

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

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

    if -1.7e-136 < z < -1.8000000000000001e-200 or 5.5e-226 < z < 2.09999999999999984e-99 or 5.1999999999999999e-76 < z < 3.20000000000000012e-41 or 2.30000000000000009e-17 < z < 1.08e92

    1. Initial program 98.4%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.35:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-136}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.8 \cdot 10^{-200}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-226}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 2.1 \cdot 10^{-99}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 5.2 \cdot 10^{-76}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.2 \cdot 10^{-41}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.08 \cdot 10^{+92}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 4: 94.7% accurate, 0.7× speedup?

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

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

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

\mathbf{elif}\;y \leq 4.5 \cdot 10^{+212}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 88.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/92.3%

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

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

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

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

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

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

    if -1 < y < 0.149999999999999994

    1. Initial program 84.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/99.8%

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

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

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

    if 4.5000000000000002e212 < y

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    6. Simplified95.1%

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

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

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

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

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

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

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

Alternative 5: 94.9% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{x}{\frac{z}{y}} - x\\
\mathbf{if}\;y \leq -1:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;y \leq 9.5 \cdot 10^{+210}:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 88.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/92.3%

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

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

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

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

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

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

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

    if -1 < y < 0.149999999999999994

    1. Initial program 84.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/99.8%

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

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

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

    if 9.5000000000000004e210 < y

    1. Initial program 99.7%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    6. Simplified95.1%

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

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

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

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

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

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

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

Alternative 6: 99.8% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+22} \lor \neg \left(z \leq 6.5 \cdot 10^{+61}\right):\\
\;\;\;\;x \cdot \frac{y}{z} - x\\

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


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

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4e22 < z < 6.4999999999999996e61

    1. Initial program 99.2%

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

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

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

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

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

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

Alternative 7: 98.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 75.1%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{z}} - x \]
    9. Simplified99.0%

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

    if -13.199999999999999 < z < 1

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

Alternative 8: 85.5% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 82.8%

      \[\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 y around inf 64.9%

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    7. Step-by-step derivation
      1. clear-num66.4%

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

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

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

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

    if -900 < y < 9.99999999999999949e60

    1. Initial program 85.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/99.8%

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

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

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

    if 9.99999999999999949e60 < y

    1. Initial program 98.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    6. Simplified84.6%

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

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

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

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

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

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

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

Alternative 9: 84.4% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 84.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 68.7%

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

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

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

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

    if -3.59999999999999981e-8 < y < 2.6000000000000001e63

    1. Initial program 85.3%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/99.8%

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

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

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

    if 2.6000000000000001e63 < y

    1. Initial program 98.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    6. Simplified84.6%

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

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

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

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

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

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

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

Alternative 10: 95.2% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 82.8%

      \[\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 88.4%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/92.8%

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{1 + y}}} - x \]
    8. Applied egg-rr94.2%

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

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

    if -1 < y < 0.149999999999999994

    1. Initial program 84.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/99.8%

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

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

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

    if 0.149999999999999994 < y

    1. Initial program 98.2%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/82.8%

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

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

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

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

Alternative 11: 85.4% accurate, 1.0× speedup?

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

    1. Initial program 89.8%

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z}} \cdot y \]
    8. Applied egg-rr75.1%

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

    if -1500 < y < 8.3000000000000004e65

    1. Initial program 85.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/99.8%

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

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

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

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

Alternative 12: 85.4% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 82.8%

      \[\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 y around inf 64.9%

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    7. Step-by-step derivation
      1. clear-num66.4%

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

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

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

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

    if -1500 < y < 1.92e59

    1. Initial program 85.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/99.8%

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

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

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

    if 1.92e59 < y

    1. Initial program 98.0%

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    6. Simplified84.6%

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

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

Alternative 13: 85.5% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 82.8%

      \[\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 y around inf 64.9%

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    7. Step-by-step derivation
      1. clear-num66.4%

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

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

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

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

    if -1500 < y < 3.7999999999999999e57

    1. Initial program 85.9%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{\frac{z}{x}}} - x \]
      5. associate-/r/99.8%

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

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

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

    if 3.7999999999999999e57 < y

    1. Initial program 98.0%

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

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

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

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

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

Alternative 14: 64.7% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 75.3%

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

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

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

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

        \[\leadsto \color{blue}{-x} \]
    6. Simplified72.1%

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

    if -1.3500000000000001 < z < 1

    1. Initial program 99.8%

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 + y}{z} \cdot x} \]
    6. Simplified87.2%

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

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

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

Alternative 15: 37.7% accurate, 4.5× speedup?

\[\begin{array}{l} \\ -x \end{array} \]
(FPCore (x y z) :precision binary64 (- x))
double code(double x, double y, double z) {
	return -x;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = -x
end function
public static double code(double x, double y, double z) {
	return -x;
}
def code(x, y, z):
	return -x
function code(x, y, z)
	return Float64(-x)
end
function tmp = code(x, y, z)
	tmp = -x;
end
code[x_, y_, z_] := (-x)
\begin{array}{l}

\\
-x
\end{array}
Derivation
  1. Initial program 87.7%

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

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

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

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

      \[\leadsto \color{blue}{-x} \]
  6. Simplified37.1%

    \[\leadsto \color{blue}{-x} \]
  7. Final simplification37.1%

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