?

Average Error: 11.1 → 0.3
Time: 11.5s
Precision: binary64
Cost: 1993

?

\[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 \lor \neg \left(t_1 \leq 5 \cdot 10^{+275}\right):\\ \;\;\;\;x + \frac{y}{\frac{a - t}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;t_1 + x\\ \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 (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+275)))
     (+ x (/ y (/ (- a t) (- z t))))
     (+ t_1 x))))
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)) || !(t_1 <= 5e+275)) {
		tmp = x + (y / ((a - t) / (z - t)));
	} else {
		tmp = t_1 + x;
	}
	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) || !(t_1 <= 5e+275)) {
		tmp = x + (y / ((a - t) / (z - t)));
	} else {
		tmp = t_1 + x;
	}
	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) or not (t_1 <= 5e+275):
		tmp = x + (y / ((a - t) / (z - t)))
	else:
		tmp = t_1 + x
	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)) || !(t_1 <= 5e+275))
		tmp = Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t))));
	else
		tmp = Float64(t_1 + x);
	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) || ~((t_1 <= 5e+275)))
		tmp = x + (y / ((a - t) / (z - t)));
	else
		tmp = t_1 + x;
	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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+275]], $MachinePrecision]], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + x), $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 \lor \neg \left(t_1 \leq 5 \cdot 10^{+275}\right):\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z - t}}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.1
Target1.2
Herbie0.3
\[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 5.0000000000000003e275 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t))

    1. Initial program 61.6

      \[x + \frac{y \cdot \left(z - t\right)}{a - t} \]
    2. Simplified0.7

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

      [Start]61.6

      \[ x + \frac{y \cdot \left(z - t\right)}{a - t} \]

      associate-/l* [=>]0.7

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

    if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 5.0000000000000003e275

    1. Initial program 0.2

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

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

Alternatives

Alternative 1
Error20.7
Cost1372
\[\begin{array}{l} t_1 := z \cdot \frac{y}{a - t}\\ \mathbf{if}\;t \leq -1.35 \cdot 10^{-32}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{-212}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.25 \cdot 10^{-175}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{-58}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 5.9 \cdot 10^{-27}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5 \cdot 10^{+110}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t \leq 7.8 \cdot 10^{+124}:\\ \;\;\;\;y \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
Alternative 2
Error10.3
Cost1370
\[\begin{array}{l} t_1 := x + \frac{y}{\frac{a - t}{z}}\\ \mathbf{if}\;z \leq -7.6 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -6.2 \cdot 10^{+71}:\\ \;\;\;\;y \cdot \frac{z - t}{a - t}\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-31} \lor \neg \left(z \leq 4.45 \cdot 10^{-7}\right) \land \left(z \leq 3.2 \cdot 10^{+68} \lor \neg \left(z \leq 8.8 \cdot 10^{+182}\right)\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{t} + -1}\\ \end{array} \]
Alternative 3
Error3.4
Cost969
\[\begin{array}{l} \mathbf{if}\;z \leq -5 \cdot 10^{-94} \lor \neg \left(z \leq 8 \cdot 10^{-38}\right):\\ \;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a - t}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{t} + -1}\\ \end{array} \]
Alternative 4
Error20.1
Cost844
\[\begin{array}{l} \mathbf{if}\;t \leq -1.7 \cdot 10^{-35}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{-212}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 1.65 \cdot 10^{-172}:\\ \;\;\;\;y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;t \leq 1.28 \cdot 10^{-99}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
Alternative 5
Error14.4
Cost844
\[\begin{array}{l} \mathbf{if}\;t \leq -1020000000000:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{-58}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z}}\\ \mathbf{elif}\;t \leq 4.3 \cdot 10^{-27}:\\ \;\;\;\;z \cdot \frac{y}{a - t}\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
Alternative 6
Error14.2
Cost844
\[\begin{array}{l} \mathbf{if}\;t \leq -600000000000:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t \leq 1.55 \cdot 10^{-108}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z}}\\ \mathbf{elif}\;t \leq 1.95 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{y \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
Alternative 7
Error10.5
Cost841
\[\begin{array}{l} \mathbf{if}\;t \leq -4.8 \cdot 10^{+16} \lor \neg \left(t \leq 1.45 \cdot 10^{+107}\right):\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\ \end{array} \]
Alternative 8
Error22.1
Cost712
\[\begin{array}{l} \mathbf{if}\;a \leq 1.35 \cdot 10^{-269}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;a \leq 3.9 \cdot 10^{-184}:\\ \;\;\;\;y \cdot \left(1 - \frac{z}{t}\right)\\ \mathbf{elif}\;a \leq 6.2 \cdot 10^{+202}:\\ \;\;\;\;y + x\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Error1.2
Cost704
\[x + \frac{y}{\frac{a - t}{z - t}} \]
Alternative 10
Error19.6
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -3.05 \cdot 10^{-31}:\\ \;\;\;\;y + x\\ \mathbf{elif}\;t \leq 3.15 \cdot 10^{-100}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y + x\\ \end{array} \]
Alternative 11
Error29.1
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -6.8 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 7.9 \cdot 10^{-162}:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error28.7
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023060 
(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))))