Numeric.Histogram:binBounds from Chart-1.5.3

Percentage Accurate: 93.2% → 97.9%
Time: 9.9s
Alternatives: 7
Speedup: 1.0×

Specification

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

\\
x + \frac{\left(y - x\right) \cdot z}{t}
\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 7 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: 93.2% accurate, 1.0× speedup?

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

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

Alternative 1: 97.9% accurate, 1.0× speedup?

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

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

    \[x + \frac{\left(y - x\right) \cdot z}{t} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-/l*N/A

      \[\leadsto \mathsf{+.f64}\left(x, \left(\left(y - x\right) \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{+.f64}\left(x, \left(\frac{z}{t} \cdot \color{blue}{\left(y - x\right)}\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(y - x\right)}\right)\right) \]
    4. /-lowering-/.f64N/A

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\color{blue}{y} - x\right)\right)\right) \]
    5. --lowering--.f6499.4%

      \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{\_.f64}\left(y, \color{blue}{x}\right)\right)\right) \]
  4. Applied egg-rr99.4%

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

Alternative 2: 79.6% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+60}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\

\mathbf{elif}\;t \leq 2.65 \cdot 10^{-152}:\\
\;\;\;\;\frac{y - x}{\frac{t}{z}}\\

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


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

    1. Initial program 76.1%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{z}{t}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -1 \cdot \frac{z}{t}\right)}\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(1 + \left(\mathsf{neg}\left(\frac{z}{t}\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(1 - \color{blue}{\frac{z}{t}}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \color{blue}{\left(\frac{z}{t}\right)}\right)\right) \]
      5. /-lowering-/.f6491.8%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
    5. Simplified91.8%

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

    if -1.45e60 < t < 2.6500000000000001e-152

    1. Initial program 97.4%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(\frac{y}{t} - \frac{x}{t}\right)} \]
    4. Step-by-step derivation
      1. div-subN/A

        \[\leadsto z \cdot \frac{y - x}{\color{blue}{t}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{y - x}{t}\right)}\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(\left(y - x\right), \color{blue}{t}\right)\right) \]
      4. --lowering--.f6484.6%

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, x\right), t\right)\right) \]
    5. Simplified84.6%

      \[\leadsto \color{blue}{z \cdot \frac{y - x}{t}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{y - x}{t} \cdot \color{blue}{z} \]
      2. associate-/r/N/A

        \[\leadsto \frac{y - x}{\color{blue}{\frac{t}{z}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y - x\right), \color{blue}{\left(\frac{t}{z}\right)}\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, x\right), \left(\frac{\color{blue}{t}}{z}\right)\right) \]
      5. /-lowering-/.f6491.7%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, x\right), \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right) \]
    7. Applied egg-rr91.7%

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

    if 2.6500000000000001e-152 < t

    1. Initial program 88.9%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(\frac{y \cdot z}{t}\right)}\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(y \cdot z\right), \color{blue}{t}\right)\right) \]
      2. *-lowering-*.f6478.3%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, z\right), t\right)\right) \]
    5. Simplified78.3%

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

        \[\leadsto \mathsf{+.f64}\left(x, \left(y \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(y \cdot \frac{1}{\color{blue}{\frac{t}{z}}}\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\frac{y}{\color{blue}{\frac{t}{z}}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(y, \color{blue}{\left(\frac{t}{z}\right)}\right)\right) \]
      5. /-lowering-/.f6485.3%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    7. Applied egg-rr85.3%

      \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 86.4% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+43}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;x \leq 3.4 \cdot 10^{+55}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -7.2000000000000002e43 or 3.3999999999999998e55 < x

    1. Initial program 89.1%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{z}{t}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -1 \cdot \frac{z}{t}\right)}\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(1 + \left(\mathsf{neg}\left(\frac{z}{t}\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(1 - \color{blue}{\frac{z}{t}}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \color{blue}{\left(\frac{z}{t}\right)}\right)\right) \]
      5. /-lowering-/.f6491.6%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
    5. Simplified91.6%

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

    if -7.2000000000000002e43 < x < 3.3999999999999998e55

    1. Initial program 91.1%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \mathsf{+.f64}\left(x, \color{blue}{\left(\frac{y \cdot z}{t}\right)}\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\left(y \cdot z\right), \color{blue}{t}\right)\right) \]
      2. *-lowering-*.f6480.3%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(\mathsf{*.f64}\left(y, z\right), t\right)\right) \]
    5. Simplified80.3%

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

        \[\leadsto \mathsf{+.f64}\left(x, \left(y \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(y \cdot \frac{1}{\color{blue}{\frac{t}{z}}}\right)\right) \]
      3. un-div-invN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\frac{y}{\color{blue}{\frac{t}{z}}}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(y, \color{blue}{\left(\frac{t}{z}\right)}\right)\right) \]
      5. /-lowering-/.f6487.2%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right)\right) \]
    7. Applied egg-rr87.2%

      \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 72.6% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;y \leq 1.65 \cdot 10^{+223}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\

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


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

    1. Initial program 83.6%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in z around inf

      \[\leadsto \color{blue}{z \cdot \left(\frac{y}{t} - \frac{x}{t}\right)} \]
    4. Step-by-step derivation
      1. div-subN/A

        \[\leadsto z \cdot \frac{y - x}{\color{blue}{t}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \color{blue}{\left(\frac{y - x}{t}\right)}\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(\left(y - x\right), \color{blue}{t}\right)\right) \]
      4. --lowering--.f6480.5%

        \[\leadsto \mathsf{*.f64}\left(z, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(y, x\right), t\right)\right) \]
    5. Simplified80.5%

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

    if -7.50000000000000072e41 < y < 1.65e223

    1. Initial program 92.8%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{z}{t}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -1 \cdot \frac{z}{t}\right)}\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(1 + \left(\mathsf{neg}\left(\frac{z}{t}\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(1 - \color{blue}{\frac{z}{t}}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \color{blue}{\left(\frac{z}{t}\right)}\right)\right) \]
      5. /-lowering-/.f6480.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
    5. Simplified80.1%

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

    if 1.65e223 < y

    1. Initial program 82.4%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\left(y - x\right) \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\frac{z}{t} \cdot \color{blue}{\left(y - x\right)}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(y - x\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\color{blue}{y} - x\right)\right)\right) \]
      5. --lowering--.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{\_.f64}\left(y, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.7%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{z}{t}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(\frac{z}{t}\right)}\right) \]
      3. /-lowering-/.f6493.6%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right) \]
    7. Simplified93.6%

      \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    8. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto y \cdot \frac{1}{\color{blue}{\frac{t}{z}}} \]
      2. div-invN/A

        \[\leadsto \frac{y}{\color{blue}{\frac{t}{z}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(y, \color{blue}{\left(\frac{t}{z}\right)}\right) \]
      4. /-lowering-/.f6493.8%

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right) \]
    9. Applied egg-rr93.8%

      \[\leadsto \color{blue}{\frac{y}{\frac{t}{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 73.0% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.2 \cdot 10^{+115}:\\
\;\;\;\;\frac{z}{t} \cdot y\\

\mathbf{elif}\;y \leq 9 \cdot 10^{+224}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\

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


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

    1. Initial program 86.8%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\left(y - x\right) \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\frac{z}{t} \cdot \color{blue}{\left(y - x\right)}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(y - x\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\color{blue}{y} - x\right)\right)\right) \]
      5. --lowering--.f6499.9%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{\_.f64}\left(y, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.9%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{z}{t}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(\frac{z}{t}\right)}\right) \]
      3. /-lowering-/.f6487.7%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right) \]
    7. Simplified87.7%

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

    if -3.2e115 < y < 8.9999999999999995e224

    1. Initial program 91.5%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(1 + -1 \cdot \frac{z}{t}\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -1 \cdot \frac{z}{t}\right)}\right) \]
      2. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(1 + \left(\mathsf{neg}\left(\frac{z}{t}\right)\right)\right)\right) \]
      3. unsub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(1 - \color{blue}{\frac{z}{t}}\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \color{blue}{\left(\frac{z}{t}\right)}\right)\right) \]
      5. /-lowering-/.f6478.8%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(1, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right)\right) \]
    5. Simplified78.8%

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

    if 8.9999999999999995e224 < y

    1. Initial program 82.4%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-/l*N/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\left(y - x\right) \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(x, \left(\frac{z}{t} \cdot \color{blue}{\left(y - x\right)}\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(y - x\right)}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\color{blue}{y} - x\right)\right)\right) \]
      5. --lowering--.f6499.7%

        \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{\_.f64}\left(y, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.7%

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

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

        \[\leadsto y \cdot \color{blue}{\frac{z}{t}} \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(\frac{z}{t}\right)}\right) \]
      3. /-lowering-/.f6493.6%

        \[\leadsto \mathsf{*.f64}\left(y, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right) \]
    7. Simplified93.6%

      \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    8. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto y \cdot \frac{1}{\color{blue}{\frac{t}{z}}} \]
      2. div-invN/A

        \[\leadsto \frac{y}{\color{blue}{\frac{t}{z}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(y, \color{blue}{\left(\frac{t}{z}\right)}\right) \]
      4. /-lowering-/.f6493.8%

        \[\leadsto \mathsf{/.f64}\left(y, \mathsf{/.f64}\left(t, \color{blue}{z}\right)\right) \]
    9. Applied egg-rr93.8%

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

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

Alternative 6: 55.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+55}:\\
\;\;\;\;x\\

\mathbf{elif}\;t \leq 1.46 \cdot 10^{+90}:\\
\;\;\;\;\frac{z}{t} \cdot y\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t < -4.40000000000000021e55 or 1.45999999999999994e90 < t

    1. Initial program 78.3%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{x} \]
    4. Step-by-step derivation
      1. Simplified72.0%

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

      if -4.40000000000000021e55 < t < 1.45999999999999994e90

      1. Initial program 97.5%

        \[x + \frac{\left(y - x\right) \cdot z}{t} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. associate-/l*N/A

          \[\leadsto \mathsf{+.f64}\left(x, \left(\left(y - x\right) \cdot \color{blue}{\frac{z}{t}}\right)\right) \]
        2. *-commutativeN/A

          \[\leadsto \mathsf{+.f64}\left(x, \left(\frac{z}{t} \cdot \color{blue}{\left(y - x\right)}\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\left(\frac{z}{t}\right), \color{blue}{\left(y - x\right)}\right)\right) \]
        4. /-lowering-/.f64N/A

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \left(\color{blue}{y} - x\right)\right)\right) \]
        5. --lowering--.f6499.9%

          \[\leadsto \mathsf{+.f64}\left(x, \mathsf{*.f64}\left(\mathsf{/.f64}\left(z, t\right), \mathsf{\_.f64}\left(y, \color{blue}{x}\right)\right)\right) \]
      4. Applied egg-rr99.9%

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

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

          \[\leadsto y \cdot \color{blue}{\frac{z}{t}} \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{\left(\frac{z}{t}\right)}\right) \]
        3. /-lowering-/.f6455.8%

          \[\leadsto \mathsf{*.f64}\left(y, \mathsf{/.f64}\left(z, \color{blue}{t}\right)\right) \]
      7. Simplified55.8%

        \[\leadsto \color{blue}{y \cdot \frac{z}{t}} \]
    5. Recombined 2 regimes into one program.
    6. Final simplification61.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -4.4 \cdot 10^{+55}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.46 \cdot 10^{+90}:\\ \;\;\;\;\frac{z}{t} \cdot y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
    7. Add Preprocessing

    Alternative 7: 38.6% accurate, 9.0× speedup?

    \[\begin{array}{l} \\ x \end{array} \]
    (FPCore (x y z t) :precision binary64 x)
    double code(double x, double y, double z, double t) {
    	return x;
    }
    
    real(8) function code(x, y, z, t)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        code = x
    end function
    
    public static double code(double x, double y, double z, double t) {
    	return x;
    }
    
    def code(x, y, z, t):
    	return x
    
    function code(x, y, z, t)
    	return x
    end
    
    function tmp = code(x, y, z, t)
    	tmp = x;
    end
    
    code[x_, y_, z_, t_] := x
    
    \begin{array}{l}
    
    \\
    x
    \end{array}
    
    Derivation
    1. Initial program 90.3%

      \[x + \frac{\left(y - x\right) \cdot z}{t} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0

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

        \[\leadsto \color{blue}{x} \]
      2. Add Preprocessing

      Developer Target 1: 97.8% accurate, 0.5× speedup?

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

      Reproduce

      ?
      herbie shell --seed 2024161 
      (FPCore (x y z t)
        :name "Numeric.Histogram:binBounds from Chart-1.5.3"
        :precision binary64
      
        :alt
        (! :herbie-platform default (if (< x -1805102239106601/200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- x (* (/ z t) (- x y))) (if (< x 855006432740143/2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z))))))
      
        (+ x (/ (* (- y x) z) t)))