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

Percentage Accurate: 87.6% → 99.8%
Time: 6.2s
Alternatives: 13
Speedup: 0.6×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 87.6% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 0.5× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -2.0000000000000001e-54 or 1.59999999999999988e-33 < z

    1. Initial program 79.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}{x \cdot \frac{\left(y - z\right) + 1}{z}} \]
      2. +-commutative99.9%

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

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

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

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

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

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

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

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

    if -2.0000000000000001e-54 < z < 1.59999999999999988e-33

    1. Initial program 99.9%

      \[\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.9%

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

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

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

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

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

Alternative 2: 64.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;z \leq -3.8 \cdot 10^{+106}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{-123}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-276}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-169}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;z \leq 10^{-60}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+48}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))))
   (if (<= z -3.8e+106)
     (- x)
     (if (<= z -2.25e-123)
       t_0
       (if (<= z -2.35e-276)
         (/ x z)
         (if (<= z 1.6e-169)
           t_0
           (if (<= z 1e-60) (/ x z) (if (<= z 3.3e+48) t_0 (- x)))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -3.8e+106) {
		tmp = -x;
	} else if (z <= -2.25e-123) {
		tmp = t_0;
	} else if (z <= -2.35e-276) {
		tmp = x / z;
	} else if (z <= 1.6e-169) {
		tmp = t_0;
	} else if (z <= 1e-60) {
		tmp = x / z;
	} else if (z <= 3.3e+48) {
		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 <= (-3.8d+106)) then
        tmp = -x
    else if (z <= (-2.25d-123)) then
        tmp = t_0
    else if (z <= (-2.35d-276)) then
        tmp = x / z
    else if (z <= 1.6d-169) then
        tmp = t_0
    else if (z <= 1d-60) then
        tmp = x / z
    else if (z <= 3.3d+48) 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 <= -3.8e+106) {
		tmp = -x;
	} else if (z <= -2.25e-123) {
		tmp = t_0;
	} else if (z <= -2.35e-276) {
		tmp = x / z;
	} else if (z <= 1.6e-169) {
		tmp = t_0;
	} else if (z <= 1e-60) {
		tmp = x / z;
	} else if (z <= 3.3e+48) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if z <= -3.8e+106:
		tmp = -x
	elif z <= -2.25e-123:
		tmp = t_0
	elif z <= -2.35e-276:
		tmp = x / z
	elif z <= 1.6e-169:
		tmp = t_0
	elif z <= 1e-60:
		tmp = x / z
	elif z <= 3.3e+48:
		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 <= -3.8e+106)
		tmp = Float64(-x);
	elseif (z <= -2.25e-123)
		tmp = t_0;
	elseif (z <= -2.35e-276)
		tmp = Float64(x / z);
	elseif (z <= 1.6e-169)
		tmp = t_0;
	elseif (z <= 1e-60)
		tmp = Float64(x / z);
	elseif (z <= 3.3e+48)
		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 <= -3.8e+106)
		tmp = -x;
	elseif (z <= -2.25e-123)
		tmp = t_0;
	elseif (z <= -2.35e-276)
		tmp = x / z;
	elseif (z <= 1.6e-169)
		tmp = t_0;
	elseif (z <= 1e-60)
		tmp = x / z;
	elseif (z <= 3.3e+48)
		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, -3.8e+106], (-x), If[LessEqual[z, -2.25e-123], t$95$0, If[LessEqual[z, -2.35e-276], N[(x / z), $MachinePrecision], If[LessEqual[z, 1.6e-169], t$95$0, If[LessEqual[z, 1e-60], N[(x / z), $MachinePrecision], If[LessEqual[z, 3.3e+48], t$95$0, (-x)]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;z \leq -2.25 \cdot 10^{-123}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq -2.35 \cdot 10^{-276}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 1.6 \cdot 10^{-169}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;z \leq 10^{-60}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 3.3 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -3.7999999999999998e106 or 3.30000000000000023e48 < z

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.7999999999999998e106 < z < -2.24999999999999997e-123 or -2.34999999999999982e-276 < z < 1.59999999999999997e-169 or 9.9999999999999997e-61 < z < 3.30000000000000023e48

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.24999999999999997e-123 < z < -2.34999999999999982e-276 or 1.59999999999999997e-169 < z < 9.9999999999999997e-61

    1. Initial program 99.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+106}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2.25 \cdot 10^{-123}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq -2.35 \cdot 10^{-276}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 1.6 \cdot 10^{-169}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 10^{-60}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+48}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 93.6% accurate, 0.4× speedup?

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

\mathbf{elif}\;y \leq -210 \lor \neg \left(y \leq 1.1 \cdot 10^{-8}\right):\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.7999999999999999e135 < y < -210 or 1.0999999999999999e-8 < y

    1. Initial program 87.3%

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

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

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

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

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

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

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

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

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

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

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

    if -210 < y < 1.0999999999999999e-8

    1. Initial program 86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 93.1% accurate, 0.4× speedup?

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

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

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

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

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


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

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

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

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

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

    if -1.7999999999999999e135 < y < -210

    1. Initial program 93.2%

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

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

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

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

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

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

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

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

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

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

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

    if -210 < y < 6.2e5

    1. Initial program 85.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}{x \cdot \frac{\left(y - z\right) + 1}{z}} \]
      2. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.2e5 < y

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y - x \cdot z}}{z} \]
      4. distribute-lft-out--85.6%

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

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

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

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

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

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

Alternative 5: 64.4% accurate, 0.5× speedup?

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

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

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

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

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


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

    1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.7999999999999998e106 < z < -1.4499999999999999e-115

    1. Initial program 97.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4499999999999999e-115 < 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*88.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+106}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -1.45 \cdot 10^{-115}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq 1:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 93.3% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 95.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y - x \cdot z}}{z} \]
      4. distribute-lft-out--93.8%

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

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

    if -210 < y < 2.4e5

    1. Initial program 85.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}{x \cdot \frac{\left(y - z\right) + 1}{z}} \]
      2. +-commutative99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.4e5 < y

    1. Initial program 86.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y - x \cdot z}}{z} \]
      4. distribute-lft-out--85.6%

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

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

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

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

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

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

Alternative 7: 84.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+82} \lor \neg \left(y \leq 3.4 \cdot 10^{+37}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\

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


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

    1. Initial program 90.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.6999999999999999e82 < y < 3.40000000000000006e37

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} - x} \]
    7. Simplified92.9%

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

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

Alternative 8: 84.4% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 93.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}} \]
    9. Applied egg-rr82.0%

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

    if -1.35e82 < y < 3.5000000000000001e35

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{z} - x} \]
    7. Simplified92.9%

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

    if 3.5000000000000001e35 < y

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{+82}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+35}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 85.1% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 94.6%

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

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

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

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

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

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

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

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

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

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

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

    if -5.4999999999999998e46 < y < 1.59999999999999996e39

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.59999999999999996e39 < y

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+46}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;y \leq 1.6 \cdot 10^{+39}:\\ \;\;\;\;\frac{x}{z} - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 95.6% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{+133}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{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 y < -1e133

    1. Initial program 97.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{x \cdot y - x \cdot z}}{z} \]
      4. distribute-lft-out--97.2%

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

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

    if -1e133 < y

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 93.8% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq 100:\\
\;\;\;\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{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 x < 100

    1. Initial program 90.4%

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

    if 100 < x

    1. Initial program 80.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}{x \cdot \frac{\left(y - z\right) + 1}{z}} \]
      2. +-commutative99.9%

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

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

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

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

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

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

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

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

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

Alternative 12: 65.6% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 75.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < 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*89.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 39.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 88.1%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-x} \]
  7. Simplified35.2%

    \[\leadsto \color{blue}{-x} \]
  8. Final simplification35.2%

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

Developer target: 99.5% accurate, 0.4× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024115 
(FPCore (x y z)
  :name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
  :precision binary64

  :alt
  (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))