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

Percentage Accurate: 88.5% → 99.5%
Time: 5.5s
Alternatives: 11
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 11 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.5% accurate, 1.0× speedup?

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

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

Alternative 1: 99.5% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -1.0000000000000001e-15 or 2.6e-124 < z

    1. Initial program 75.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.0000000000000001e-15 < z < 2.6e-124

    1. Initial program 99.8%

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

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

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

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

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

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

Alternative 2: 97.4% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z) < -1.9999999999999999e-77

    1. Initial program 81.1%

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

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

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

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

    if -1.9999999999999999e-77 < (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z)

    1. Initial program 87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 63.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;z \leq -5.8 \cdot 10^{+83}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -0.00017:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{-122}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-264}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-264}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+80}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))))
   (if (<= z -5.8e+83)
     (- x)
     (if (<= z -0.00017)
       (* x (/ y z))
       (if (<= z -9.4e-122)
         (/ x z)
         (if (<= z -1.2e-264)
           t_0
           (if (<= z 1.5e-264) (/ x z) (if (<= z 3.5e+80) t_0 (- x)))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -5.8e+83) {
		tmp = -x;
	} else if (z <= -0.00017) {
		tmp = x * (y / z);
	} else if (z <= -9.4e-122) {
		tmp = x / z;
	} else if (z <= -1.2e-264) {
		tmp = t_0;
	} else if (z <= 1.5e-264) {
		tmp = x / z;
	} else if (z <= 3.5e+80) {
		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 <= (-5.8d+83)) then
        tmp = -x
    else if (z <= (-0.00017d0)) then
        tmp = x * (y / z)
    else if (z <= (-9.4d-122)) then
        tmp = x / z
    else if (z <= (-1.2d-264)) then
        tmp = t_0
    else if (z <= 1.5d-264) then
        tmp = x / z
    else if (z <= 3.5d+80) 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 <= -5.8e+83) {
		tmp = -x;
	} else if (z <= -0.00017) {
		tmp = x * (y / z);
	} else if (z <= -9.4e-122) {
		tmp = x / z;
	} else if (z <= -1.2e-264) {
		tmp = t_0;
	} else if (z <= 1.5e-264) {
		tmp = x / z;
	} else if (z <= 3.5e+80) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if z <= -5.8e+83:
		tmp = -x
	elif z <= -0.00017:
		tmp = x * (y / z)
	elif z <= -9.4e-122:
		tmp = x / z
	elif z <= -1.2e-264:
		tmp = t_0
	elif z <= 1.5e-264:
		tmp = x / z
	elif z <= 3.5e+80:
		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 <= -5.8e+83)
		tmp = Float64(-x);
	elseif (z <= -0.00017)
		tmp = Float64(x * Float64(y / z));
	elseif (z <= -9.4e-122)
		tmp = Float64(x / z);
	elseif (z <= -1.2e-264)
		tmp = t_0;
	elseif (z <= 1.5e-264)
		tmp = Float64(x / z);
	elseif (z <= 3.5e+80)
		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 <= -5.8e+83)
		tmp = -x;
	elseif (z <= -0.00017)
		tmp = x * (y / z);
	elseif (z <= -9.4e-122)
		tmp = x / z;
	elseif (z <= -1.2e-264)
		tmp = t_0;
	elseif (z <= 1.5e-264)
		tmp = x / z;
	elseif (z <= 3.5e+80)
		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, -5.8e+83], (-x), If[LessEqual[z, -0.00017], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.4e-122], N[(x / z), $MachinePrecision], If[LessEqual[z, -1.2e-264], t$95$0, If[LessEqual[z, 1.5e-264], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.5e+80], t$95$0, (-x)]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -9.4 \cdot 10^{-122}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq -1.2 \cdot 10^{-264}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 1.5 \cdot 10^{-264}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 3.5 \cdot 10^{+80}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -5.79999999999999999e83 or 3.49999999999999994e80 < z

    1. Initial program 63.0%

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

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

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

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

    if -5.79999999999999999e83 < z < -1.7e-4

    1. Initial program 91.5%

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    4. Simplified64.1%

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

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

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

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

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

    if -1.7e-4 < z < -9.3999999999999999e-122 or -1.1999999999999999e-264 < z < 1.5e-264

    1. Initial program 99.8%

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

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

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

    if -9.3999999999999999e-122 < z < -1.1999999999999999e-264 or 1.5e-264 < z < 3.49999999999999994e80

    1. Initial program 99.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.8 \cdot 10^{+83}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -0.00017:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{-122}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.2 \cdot 10^{-264}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 1.5 \cdot 10^{-264}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+80}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 4: 64.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;z \leq -320000:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-117}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-264}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-259}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+80}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))))
   (if (<= z -320000.0)
     (- x)
     (if (<= z -3.4e-117)
       (/ x z)
       (if (<= z -1.45e-264)
         t_0
         (if (<= z 4.2e-259) (/ x z) (if (<= z 9e+80) t_0 (- x))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -320000.0) {
		tmp = -x;
	} else if (z <= -3.4e-117) {
		tmp = x / z;
	} else if (z <= -1.45e-264) {
		tmp = t_0;
	} else if (z <= 4.2e-259) {
		tmp = x / z;
	} else if (z <= 9e+80) {
		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 <= (-320000.0d0)) then
        tmp = -x
    else if (z <= (-3.4d-117)) then
        tmp = x / z
    else if (z <= (-1.45d-264)) then
        tmp = t_0
    else if (z <= 4.2d-259) then
        tmp = x / z
    else if (z <= 9d+80) 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 <= -320000.0) {
		tmp = -x;
	} else if (z <= -3.4e-117) {
		tmp = x / z;
	} else if (z <= -1.45e-264) {
		tmp = t_0;
	} else if (z <= 4.2e-259) {
		tmp = x / z;
	} else if (z <= 9e+80) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if z <= -320000.0:
		tmp = -x
	elif z <= -3.4e-117:
		tmp = x / z
	elif z <= -1.45e-264:
		tmp = t_0
	elif z <= 4.2e-259:
		tmp = x / z
	elif z <= 9e+80:
		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 <= -320000.0)
		tmp = Float64(-x);
	elseif (z <= -3.4e-117)
		tmp = Float64(x / z);
	elseif (z <= -1.45e-264)
		tmp = t_0;
	elseif (z <= 4.2e-259)
		tmp = Float64(x / z);
	elseif (z <= 9e+80)
		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 <= -320000.0)
		tmp = -x;
	elseif (z <= -3.4e-117)
		tmp = x / z;
	elseif (z <= -1.45e-264)
		tmp = t_0;
	elseif (z <= 4.2e-259)
		tmp = x / z;
	elseif (z <= 9e+80)
		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, -320000.0], (-x), If[LessEqual[z, -3.4e-117], N[(x / z), $MachinePrecision], If[LessEqual[z, -1.45e-264], t$95$0, If[LessEqual[z, 4.2e-259], N[(x / z), $MachinePrecision], If[LessEqual[z, 9e+80], t$95$0, (-x)]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -3.4 \cdot 10^{-117}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq -1.45 \cdot 10^{-264}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;z \leq 9 \cdot 10^{+80}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.2e5 or 9.00000000000000013e80 < z

    1. Initial program 67.6%

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

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

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

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

    if -3.2e5 < z < -3.40000000000000035e-117 or -1.4499999999999999e-264 < z < 4.19999999999999995e-259

    1. Initial program 99.8%

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

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

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

    if -3.40000000000000035e-117 < z < -1.4499999999999999e-264 or 4.19999999999999995e-259 < z < 9.00000000000000013e80

    1. Initial program 99.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -320000:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-117}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-264}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-259}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 9 \cdot 10^{+80}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 5: 94.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 82.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -560 < y < 8.5e-9

    1. Initial program 87.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 98.6% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.15e12 < z < 170

    1. Initial program 99.8%

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

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

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

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

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

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

Alternative 7: 84.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 87.2%

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

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

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

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

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

    if -1.35e16 < y < 2.5

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

    if 2.5 < y

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

Alternative 8: 82.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 87.2%

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

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

        \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    4. Simplified70.1%

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

    if -7.4e18 < y < 2.5

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

    if 2.5 < y

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

Alternative 9: 84.0% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 87.2%

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

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

    if -2e18 < y < 2.5

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

    if 2.5 < y

    1. Initial program 78.1%

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

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

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

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

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

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

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

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

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

Alternative 10: 64.3% accurate, 1.3× speedup?

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

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

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


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

    1. Initial program 70.8%

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

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

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

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

    if -3.2e5 < z < 0.40000000000000002

    1. Initial program 99.8%

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

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

      \[\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 -320000 \lor \neg \left(z \leq 0.4\right):\\ \;\;\;\;-x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z}\\ \end{array} \]

Alternative 11: 38.4% 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 84.8%

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

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

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

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

    \[\leadsto -x \]

Developer target: 99.4% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023300 
(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))