?

Average Error: 10.8 → 4.8
Time: 17.7s
Precision: binary64
Cost: 1992

?

\[x + \frac{\left(y - z\right) \cdot t}{a - z} \]
\[\begin{array}{l} t_1 := \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;x + t\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+238}:\\ \;\;\;\;x + t_1\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
(FPCore (x y z t a)
 :precision binary64
 (let* ((t_1 (/ (* (- y z) t) (- a z))))
   (if (<= t_1 (- INFINITY)) (+ x t) (if (<= t_1 2e+238) (+ x t_1) (+ x t)))))
double code(double x, double y, double z, double t, double a) {
	return x + (((y - z) * t) / (a - z));
}
double code(double x, double y, double z, double t, double a) {
	double t_1 = ((y - z) * t) / (a - z);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = x + t;
	} else if (t_1 <= 2e+238) {
		tmp = x + t_1;
	} else {
		tmp = x + t;
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
	return x + (((y - z) * t) / (a - z));
}
public static double code(double x, double y, double z, double t, double a) {
	double t_1 = ((y - z) * t) / (a - z);
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = x + t;
	} else if (t_1 <= 2e+238) {
		tmp = x + t_1;
	} else {
		tmp = x + t;
	}
	return tmp;
}
def code(x, y, z, t, a):
	return x + (((y - z) * t) / (a - z))
def code(x, y, z, t, a):
	t_1 = ((y - z) * t) / (a - z)
	tmp = 0
	if t_1 <= -math.inf:
		tmp = x + t
	elif t_1 <= 2e+238:
		tmp = x + t_1
	else:
		tmp = x + t
	return tmp
function code(x, y, z, t, a)
	return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z)))
end
function code(x, y, z, t, a)
	t_1 = Float64(Float64(Float64(y - z) * t) / Float64(a - z))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(x + t);
	elseif (t_1 <= 2e+238)
		tmp = Float64(x + t_1);
	else
		tmp = Float64(x + t);
	end
	return tmp
end
function tmp = code(x, y, z, t, a)
	tmp = x + (((y - z) * t) / (a - z));
end
function tmp_2 = code(x, y, z, t, a)
	t_1 = ((y - z) * t) / (a - z);
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = x + t;
	elseif (t_1 <= 2e+238)
		tmp = x + t_1;
	else
		tmp = x + t;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + t), $MachinePrecision], If[LessEqual[t$95$1, 2e+238], N[(x + t$95$1), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
x + \frac{\left(y - z\right) \cdot t}{a - z}
\begin{array}{l}
t_1 := \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + t\\

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+238}:\\
\;\;\;\;x + t_1\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.8
Target0.6
Herbie4.8
\[\begin{array}{l} \mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\ \;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot t\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < -inf.0 or 2.0000000000000001e238 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z))

    1. Initial program 58.5

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

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

    if -inf.0 < (/.f64 (*.f64 (-.f64 y z) t) (-.f64 a z)) < 2.0000000000000001e238

    1. Initial program 0.2

      \[x + \frac{\left(y - z\right) \cdot t}{a - z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.8

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

Alternatives

Alternative 1
Error18.3
Cost1368
\[\begin{array}{l} t_1 := x + \frac{y \cdot t}{a - z}\\ \mathbf{if}\;y \leq -1.65 \cdot 10^{+34}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.65 \cdot 10^{-173}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-230}:\\ \;\;\;\;x + \frac{t \cdot \left(y - z\right)}{a}\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+40}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+141}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.02 \cdot 10^{+215}:\\ \;\;\;\;t \cdot \frac{y}{a} + x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error14.9
Cost1172
\[\begin{array}{l} \mathbf{if}\;z \leq -7.8 \cdot 10^{-7}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{-76}:\\ \;\;\;\;t \cdot \frac{y}{a} + x\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-36}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 8.2 \cdot 10^{-7}:\\ \;\;\;\;\frac{y \cdot t}{a - z}\\ \mathbf{elif}\;z \leq 6.4 \cdot 10^{+24}:\\ \;\;\;\;x + \left(-\frac{y \cdot t}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 3
Error13.0
Cost972
\[\begin{array}{l} t_1 := \left(t + x\right) - \frac{y \cdot t}{z}\\ \mathbf{if}\;z \leq -9 \cdot 10^{+92}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.05 \cdot 10^{-106}:\\ \;\;\;\;x + \frac{t \cdot \left(-z\right)}{a - z}\\ \mathbf{elif}\;z \leq 1.8 \cdot 10^{-24}:\\ \;\;\;\;x + \frac{t \cdot \left(y - z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error13.8
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -4.4 \cdot 10^{-60}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 9.5 \cdot 10^{-6}:\\ \;\;\;\;x + \frac{t \cdot \left(y - z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 5
Error13.7
Cost840
\[\begin{array}{l} \mathbf{if}\;z \leq -2.8 \cdot 10^{-57}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-13}:\\ \;\;\;\;x + \frac{t \cdot \left(y - z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(t + x\right) - \frac{y \cdot t}{z}\\ \end{array} \]
Alternative 6
Error21.6
Cost712
\[\begin{array}{l} \mathbf{if}\;a \leq -3.2 \cdot 10^{+202}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -2.4 \cdot 10^{+139}:\\ \;\;\;\;t \cdot \frac{y - z}{a}\\ \mathbf{elif}\;a \leq 5.5 \cdot 10^{+119}:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error14.7
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -3.2 \cdot 10^{-56}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-77}:\\ \;\;\;\;x + \frac{y \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 8
Error14.1
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -7.3 \cdot 10^{-6}:\\ \;\;\;\;x + t\\ \mathbf{elif}\;z \leq 5 \cdot 10^{-77}:\\ \;\;\;\;t \cdot \frac{y}{a} + x\\ \mathbf{else}:\\ \;\;\;\;x + t\\ \end{array} \]
Alternative 9
Error21.3
Cost324
\[\begin{array}{l} \mathbf{if}\;a \leq 9 \cdot 10^{+119}:\\ \;\;\;\;x + t\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error29.0
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023077 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
  :precision binary64

  :herbie-target
  (if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))

  (+ x (/ (* (- y z) t) (- a z))))