?

Average Accuracy: 88.8% → 98.6%
Time: 20.9s
Precision: binary64
Cost: 3401

?

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

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original88.8%
Target99.4%
Herbie98.6%
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1} \]

Derivation?

  1. Split input into 2 regimes
  2. if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -1.5e28 or 5.00000000000000027e31 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1))

    1. Initial program 57.8%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Simplified57.8%

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

      [Start]57.8

      \[ \frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]

      *-commutative [=>]57.8

      \[ \frac{x + \frac{y \cdot z - x}{\color{blue}{z \cdot t} - x}}{x + 1} \]
    3. Taylor expanded in y around inf 57.8%

      \[\leadsto \frac{x + \color{blue}{\frac{y \cdot z}{t \cdot z - x}}}{x + 1} \]
    4. Simplified89.7%

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

      [Start]57.8

      \[ \frac{x + \frac{y \cdot z}{t \cdot z - x}}{x + 1} \]

      associate-/l* [=>]89.7

      \[ \frac{x + \color{blue}{\frac{y}{\frac{t \cdot z - x}{z}}}}{x + 1} \]
    5. Taylor expanded in t around 0 97.8%

      \[\leadsto \frac{x + \frac{y}{\color{blue}{t + -1 \cdot \frac{x}{z}}}}{x + 1} \]
    6. Simplified97.8%

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

      [Start]97.8

      \[ \frac{x + \frac{y}{t + -1 \cdot \frac{x}{z}}}{x + 1} \]

      neg-mul-1 [<=]97.8

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

      sub-neg [<=]97.8

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

    if -1.5e28 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 5.00000000000000027e31

    1. Initial program 98.8%

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

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

Alternatives

Alternative 1
Accuracy98.6%
Cost2628
\[\begin{array}{l} t_1 := z \cdot t - x\\ \mathbf{if}\;\frac{x + \frac{y \cdot z - x}{t_1}}{x + 1} \leq 2 \cdot 10^{+33}:\\ \;\;\;\;\frac{y \cdot \frac{z}{t_1} + \left(x - \frac{x}{t_1}\right)}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\ \end{array} \]
Alternative 2
Accuracy75.1%
Cost1368
\[\begin{array}{l} t_1 := 1 - \frac{z}{x} \cdot \frac{y}{x}\\ t_2 := \frac{x + \frac{y}{t}}{x + 1}\\ t_3 := \frac{y}{\frac{x}{z}}\\ \mathbf{if}\;t \leq -3.6 \cdot 10^{-62}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -5.4 \cdot 10^{-300}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.5 \cdot 10^{-289}:\\ \;\;\;\;\frac{1 - t_3}{x + 1}\\ \mathbf{elif}\;t \leq 2.4 \cdot 10^{-144}:\\ \;\;\;\;1 - \frac{t_3}{x}\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{-98}:\\ \;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(t - \frac{x}{z}\right)}\\ \mathbf{elif}\;t \leq 6.8 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Accuracy75.1%
Cost1368
\[\begin{array}{l} t_1 := 1 - \frac{z}{x} \cdot \frac{y}{x}\\ t_2 := \frac{y}{\frac{x}{z}}\\ \mathbf{if}\;t \leq -8.6 \cdot 10^{-67}:\\ \;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{t}}{x + 1}\\ \mathbf{elif}\;t \leq -7.5 \cdot 10^{-301}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 7.8 \cdot 10^{-290}:\\ \;\;\;\;\frac{1 - t_2}{x + 1}\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-144}:\\ \;\;\;\;1 - \frac{t_2}{x}\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{-98}:\\ \;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(t - \frac{x}{z}\right)}\\ \mathbf{elif}\;t \leq 1.5 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
Alternative 4
Accuracy75.7%
Cost1104
\[\begin{array}{l} t_1 := 1 - \frac{z}{x} \cdot \frac{y}{x}\\ t_2 := \frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{if}\;t \leq -5 \cdot 10^{-65}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2.9 \cdot 10^{-144}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{-98}:\\ \;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(t - \frac{x}{z}\right)}\\ \mathbf{elif}\;t \leq 8.6 \cdot 10^{-40}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Accuracy89.6%
Cost1097
\[\begin{array}{l} \mathbf{if}\;z \leq -8.2 \cdot 10^{-125} \lor \neg \left(z \leq 1.35 \cdot 10^{-118}\right):\\ \;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - \frac{y \cdot z}{x}\right) + 1}{x + 1}\\ \end{array} \]
Alternative 6
Accuracy90.3%
Cost1097
\[\begin{array}{l} \mathbf{if}\;y \leq -5.8 \cdot 10^{-41} \lor \neg \left(y \leq 3.3 \cdot 10^{-187}\right):\\ \;\;\;\;\frac{x + \frac{y}{t - \frac{x}{z}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\ \end{array} \]
Alternative 7
Accuracy82.6%
Cost1096
\[\begin{array}{l} \mathbf{if}\;t \leq -5 \cdot 10^{-43}:\\ \;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{t}}{x + 1}\\ \mathbf{elif}\;t \leq 6.8 \cdot 10^{-40}:\\ \;\;\;\;\frac{\left(x - \frac{y}{\frac{x}{z}}\right) + 1}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
Alternative 8
Accuracy60.4%
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-50} \lor \neg \left(x \leq 1.5 \cdot 10^{-103}\right):\\ \;\;\;\;1 - \frac{\frac{y}{\frac{x}{z}}}{x}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x}{z \cdot t}\\ \end{array} \]
Alternative 9
Accuracy76.6%
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+38} \lor \neg \left(x \leq 1.75 \cdot 10^{+59}\right):\\ \;\;\;\;1 - \frac{\frac{y}{\frac{x}{z}}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
Alternative 10
Accuracy76.8%
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq -2.1 \cdot 10^{+38} \lor \neg \left(x \leq 5 \cdot 10^{+65}\right):\\ \;\;\;\;1 - \frac{z}{x} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \end{array} \]
Alternative 11
Accuracy63.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -4.6 \cdot 10^{-121} \lor \neg \left(z \leq 7 \cdot 10^{-76}\right):\\ \;\;\;\;\frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 12
Accuracy57.7%
Cost328
\[\begin{array}{l} \mathbf{if}\;x \leq -2.15 \cdot 10^{-219}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 5.3 \cdot 10^{-101}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 13
Accuracy56.1%
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023151 
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

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

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