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

Percentage Accurate: 88.4% → 99.7%
Time: 9.3s
Alternatives: 10
Speedup: 0.7×

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 10 alternatives:

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

Initial Program: 88.4% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -9.99999999999999928e-35 or 1.99999999999999991e-44 < z

    1. Initial program 79.1%

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

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

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

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

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

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

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

    if -9.99999999999999928e-35 < z < 1.99999999999999991e-44

    1. Initial program 100.0%

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

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

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

Alternative 2: 97.9% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 88.8%

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

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

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

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

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

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

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

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

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

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

    if 1.99999999999999991e158 < (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z)

    1. Initial program 84.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.8% accurate, 0.5× speedup?

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

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

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


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

    1. Initial program 87.1%

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999967e-89 < (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z)

    1. Initial program 89.3%

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

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

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

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

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

Alternative 4: 63.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \frac{x}{z}\\ \mathbf{if}\;z \leq -4.7 \cdot 10^{+126}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-90}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq -8.3 \cdot 10^{-137}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-171}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{-71}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+46}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* y (/ x z))))
   (if (<= z -4.7e+126)
     (- x)
     (if (<= z -1.7e-90)
       (* x (/ y z))
       (if (<= z -8.3e-137)
         (/ x z)
         (if (<= z -1.15e-171)
           t_0
           (if (<= z 6.8e-71) (/ x z) (if (<= z 4.5e+46) t_0 (- x)))))))))
double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -4.7e+126) {
		tmp = -x;
	} else if (z <= -1.7e-90) {
		tmp = x * (y / z);
	} else if (z <= -8.3e-137) {
		tmp = x / z;
	} else if (z <= -1.15e-171) {
		tmp = t_0;
	} else if (z <= 6.8e-71) {
		tmp = x / z;
	} else if (z <= 4.5e+46) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y * (x / z)
    if (z <= (-4.7d+126)) then
        tmp = -x
    else if (z <= (-1.7d-90)) then
        tmp = x * (y / z)
    else if (z <= (-8.3d-137)) then
        tmp = x / z
    else if (z <= (-1.15d-171)) then
        tmp = t_0
    else if (z <= 6.8d-71) then
        tmp = x / z
    else if (z <= 4.5d+46) then
        tmp = t_0
    else
        tmp = -x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = y * (x / z);
	double tmp;
	if (z <= -4.7e+126) {
		tmp = -x;
	} else if (z <= -1.7e-90) {
		tmp = x * (y / z);
	} else if (z <= -8.3e-137) {
		tmp = x / z;
	} else if (z <= -1.15e-171) {
		tmp = t_0;
	} else if (z <= 6.8e-71) {
		tmp = x / z;
	} else if (z <= 4.5e+46) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = y * (x / z)
	tmp = 0
	if z <= -4.7e+126:
		tmp = -x
	elif z <= -1.7e-90:
		tmp = x * (y / z)
	elif z <= -8.3e-137:
		tmp = x / z
	elif z <= -1.15e-171:
		tmp = t_0
	elif z <= 6.8e-71:
		tmp = x / z
	elif z <= 4.5e+46:
		tmp = t_0
	else:
		tmp = -x
	return tmp
function code(x, y, z)
	t_0 = Float64(y * Float64(x / z))
	tmp = 0.0
	if (z <= -4.7e+126)
		tmp = Float64(-x);
	elseif (z <= -1.7e-90)
		tmp = Float64(x * Float64(y / z));
	elseif (z <= -8.3e-137)
		tmp = Float64(x / z);
	elseif (z <= -1.15e-171)
		tmp = t_0;
	elseif (z <= 6.8e-71)
		tmp = Float64(x / z);
	elseif (z <= 4.5e+46)
		tmp = t_0;
	else
		tmp = Float64(-x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = y * (x / z);
	tmp = 0.0;
	if (z <= -4.7e+126)
		tmp = -x;
	elseif (z <= -1.7e-90)
		tmp = x * (y / z);
	elseif (z <= -8.3e-137)
		tmp = x / z;
	elseif (z <= -1.15e-171)
		tmp = t_0;
	elseif (z <= 6.8e-71)
		tmp = x / z;
	elseif (z <= 4.5e+46)
		tmp = t_0;
	else
		tmp = -x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.7e+126], (-x), If[LessEqual[z, -1.7e-90], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -8.3e-137], N[(x / z), $MachinePrecision], If[LessEqual[z, -1.15e-171], t$95$0, If[LessEqual[z, 6.8e-71], N[(x / z), $MachinePrecision], If[LessEqual[z, 4.5e+46], t$95$0, (-x)]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq -8.3 \cdot 10^{-137}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq -1.15 \cdot 10^{-171}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;z \leq 6.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 4.5 \cdot 10^{+46}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if z < -4.6999999999999999e126 or 4.5000000000000001e46 < z

    1. Initial program 73.3%

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

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

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

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

    if -4.6999999999999999e126 < z < -1.69999999999999997e-90

    1. Initial program 88.3%

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999997e-90 < z < -8.30000000000000018e-137 or -1.14999999999999989e-171 < z < 6.80000000000000007e-71

    1. Initial program 100.0%

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

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

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

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

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

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

    if -8.30000000000000018e-137 < z < -1.14999999999999989e-171 or 6.80000000000000007e-71 < z < 4.5000000000000001e46

    1. Initial program 97.3%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.7 \cdot 10^{+126}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -1.7 \cdot 10^{-90}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq -8.3 \cdot 10^{-137}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{-171}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{-71}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 4.5 \cdot 10^{+46}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 5: 63.6% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot \frac{y}{z}\\ \mathbf{if}\;z \leq -4.7 \cdot 10^{+126}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-87}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-70}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+47}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (* x (/ y z))))
   (if (<= z -4.7e+126)
     (- x)
     (if (<= z -2e-87)
       t_0
       (if (<= z 1.02e-70) (/ x z) (if (<= z 5.8e+47) t_0 (- x)))))))
double code(double x, double y, double z) {
	double t_0 = x * (y / z);
	double tmp;
	if (z <= -4.7e+126) {
		tmp = -x;
	} else if (z <= -2e-87) {
		tmp = t_0;
	} else if (z <= 1.02e-70) {
		tmp = x / z;
	} else if (z <= 5.8e+47) {
		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 = x * (y / z)
    if (z <= (-4.7d+126)) then
        tmp = -x
    else if (z <= (-2d-87)) then
        tmp = t_0
    else if (z <= 1.02d-70) then
        tmp = x / z
    else if (z <= 5.8d+47) 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 = x * (y / z);
	double tmp;
	if (z <= -4.7e+126) {
		tmp = -x;
	} else if (z <= -2e-87) {
		tmp = t_0;
	} else if (z <= 1.02e-70) {
		tmp = x / z;
	} else if (z <= 5.8e+47) {
		tmp = t_0;
	} else {
		tmp = -x;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x * (y / z)
	tmp = 0
	if z <= -4.7e+126:
		tmp = -x
	elif z <= -2e-87:
		tmp = t_0
	elif z <= 1.02e-70:
		tmp = x / z
	elif z <= 5.8e+47:
		tmp = t_0
	else:
		tmp = -x
	return tmp
function code(x, y, z)
	t_0 = Float64(x * Float64(y / z))
	tmp = 0.0
	if (z <= -4.7e+126)
		tmp = Float64(-x);
	elseif (z <= -2e-87)
		tmp = t_0;
	elseif (z <= 1.02e-70)
		tmp = Float64(x / z);
	elseif (z <= 5.8e+47)
		tmp = t_0;
	else
		tmp = Float64(-x);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x * (y / z);
	tmp = 0.0;
	if (z <= -4.7e+126)
		tmp = -x;
	elseif (z <= -2e-87)
		tmp = t_0;
	elseif (z <= 1.02e-70)
		tmp = x / z;
	elseif (z <= 5.8e+47)
		tmp = t_0;
	else
		tmp = -x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.7e+126], (-x), If[LessEqual[z, -2e-87], t$95$0, If[LessEqual[z, 1.02e-70], N[(x / z), $MachinePrecision], If[LessEqual[z, 5.8e+47], t$95$0, (-x)]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;z \leq 1.02 \cdot 10^{-70}:\\
\;\;\;\;\frac{x}{z}\\

\mathbf{elif}\;z \leq 5.8 \cdot 10^{+47}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -4.6999999999999999e126 or 5.79999999999999961e47 < z

    1. Initial program 73.3%

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

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

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

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

    if -4.6999999999999999e126 < z < -2.00000000000000004e-87 or 1.0200000000000001e-70 < z < 5.79999999999999961e47

    1. Initial program 91.6%

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

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

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

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

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

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

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

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

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

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

    if -2.00000000000000004e-87 < z < 1.0200000000000001e-70

    1. Initial program 100.0%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -4.7 \cdot 10^{+126}:\\ \;\;\;\;-x\\ \mathbf{elif}\;z \leq -2 \cdot 10^{-87}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{-70}:\\ \;\;\;\;\frac{x}{z}\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{+47}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;-x\\ \end{array} \]

Alternative 6: 85.5% accurate, 1.0× speedup?

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

    1. Initial program 89.5%

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

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

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

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

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

    if -4e10 < y < 7.8000000000000005e44

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 - z}{\frac{z}{x}}} \]
      3. div-sub78.4%

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot x}{z}} - \frac{z}{\frac{z}{x}} \]
      6. *-lft-identity78.6%

        \[\leadsto \frac{\color{blue}{x}}{z} - \frac{z}{\frac{z}{x}} \]
      7. associate-/r/98.4%

        \[\leadsto \frac{x}{z} - \color{blue}{\frac{z}{z} \cdot x} \]
      8. *-inverses98.4%

        \[\leadsto \frac{x}{z} - \color{blue}{1} \cdot x \]
      9. *-lft-identity98.4%

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

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

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

Alternative 7: 85.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 4.8 \cdot 10^{+43}:\\
\;\;\;\;\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 < -2e12

    1. Initial program 92.7%

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

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

    if -2e12 < y < 4.80000000000000046e43

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 - z}{\frac{z}{x}}} \]
      3. div-sub78.4%

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot x}{z}} - \frac{z}{\frac{z}{x}} \]
      6. *-lft-identity78.6%

        \[\leadsto \frac{\color{blue}{x}}{z} - \frac{z}{\frac{z}{x}} \]
      7. associate-/r/98.4%

        \[\leadsto \frac{x}{z} - \color{blue}{\frac{z}{z} \cdot x} \]
      8. *-inverses98.4%

        \[\leadsto \frac{x}{z} - \color{blue}{1} \cdot x \]
      9. *-lft-identity98.4%

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

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

    if 4.80000000000000046e43 < y

    1. Initial program 86.3%

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

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

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

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

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

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

Alternative 8: 85.1% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;y \leq 4.4 \cdot 10^{+43}:\\
\;\;\;\;\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.1e13

    1. Initial program 92.7%

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

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

    if -5.1e13 < y < 4.40000000000000001e43

    1. Initial program 86.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 - z}{\frac{z}{x}}} \]
      3. div-sub78.4%

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot x}{z}} - \frac{z}{\frac{z}{x}} \]
      6. *-lft-identity78.6%

        \[\leadsto \frac{\color{blue}{x}}{z} - \frac{z}{\frac{z}{x}} \]
      7. associate-/r/98.4%

        \[\leadsto \frac{x}{z} - \color{blue}{\frac{z}{z} \cdot x} \]
      8. *-inverses98.4%

        \[\leadsto \frac{x}{z} - \color{blue}{1} \cdot x \]
      9. *-lft-identity98.4%

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

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

    if 4.40000000000000001e43 < y

    1. Initial program 86.3%

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

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

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

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

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

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

Alternative 9: 65.3% accurate, 1.3× speedup?

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

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

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

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


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

    1. Initial program 75.1%

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

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

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

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

    if -1 < z < 9.8e5

    1. Initial program 99.9%

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

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

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

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

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

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

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

Alternative 10: 39.0% accurate, 4.5× speedup?

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

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

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

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

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

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

    \[\leadsto -x \]

Developer target: 99.6% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}

Reproduce

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

  :herbie-target
  (if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))

  (/ (* x (+ (- y z) 1.0)) z))