?

Average Error: 10.6 → 4.2
Time: 9.5s
Precision: binary64
Cost: 1992

?

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

\mathbf{elif}\;t_1 \leq 10^{+293}:\\
\;\;\;\;x + t_1\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original10.6
Target1.3
Herbie4.2
\[x + \frac{y}{\frac{a - t}{z - t}} \]

Derivation?

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

    1. Initial program 62.3

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

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

    if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 9.9999999999999992e292

    1. Initial program 0.2

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

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

Alternatives

Alternative 1
Error11.4
Cost840
\[\begin{array}{l} \mathbf{if}\;t \leq -4.3 \cdot 10^{+17}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{+45}:\\ \;\;\;\;x + \frac{y \cdot z}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 2
Error14.9
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -1.9 \cdot 10^{-49}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{-13}:\\ \;\;\;\;x + \frac{y \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 3
Error19.8
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -2.1 \cdot 10^{-68}:\\ \;\;\;\;x + y\\ \mathbf{elif}\;t \leq 1.9 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x + y\\ \end{array} \]
Alternative 4
Error28.5
Cost64
\[x \]

Error

Reproduce?

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

  :herbie-target
  (+ x (/ y (/ (- a t) (- z t))))

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