?

Average Error: 7.2 → 2.8
Time: 14.6s
Precision: binary64
Cost: 1353

?

\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
\[\begin{array}{l} t_1 := z \cdot t - x\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{+51} \lor \neg \left(z \leq 7 \cdot 10^{+78}\right):\\ \;\;\;\;\frac{x + \frac{y}{\frac{t_1}{z}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{z \cdot y - x}{t_1}}{x + 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 (- (* z t) x)))
   (if (or (<= z -3.6e+51) (not (<= z 7e+78)))
     (/ (+ x (/ y (/ t_1 z))) (+ x 1.0))
     (/ (+ x (/ (- (* z y) x) t_1)) (+ x 1.0)))))
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 = (z * t) - x;
	double tmp;
	if ((z <= -3.6e+51) || !(z <= 7e+78)) {
		tmp = (x + (y / (t_1 / z))) / (x + 1.0);
	} else {
		tmp = (x + (((z * y) - x) / t_1)) / (x + 1.0);
	}
	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 = (z * t) - x
    if ((z <= (-3.6d+51)) .or. (.not. (z <= 7d+78))) then
        tmp = (x + (y / (t_1 / z))) / (x + 1.0d0)
    else
        tmp = (x + (((z * y) - x) / t_1)) / (x + 1.0d0)
    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 = (z * t) - x;
	double tmp;
	if ((z <= -3.6e+51) || !(z <= 7e+78)) {
		tmp = (x + (y / (t_1 / z))) / (x + 1.0);
	} else {
		tmp = (x + (((z * y) - x) / t_1)) / (x + 1.0);
	}
	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 = (z * t) - x
	tmp = 0
	if (z <= -3.6e+51) or not (z <= 7e+78):
		tmp = (x + (y / (t_1 / z))) / (x + 1.0)
	else:
		tmp = (x + (((z * y) - x) / t_1)) / (x + 1.0)
	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(z * t) - x)
	tmp = 0.0
	if ((z <= -3.6e+51) || !(z <= 7e+78))
		tmp = Float64(Float64(x + Float64(y / Float64(t_1 / z))) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x + Float64(Float64(Float64(z * y) - x) / t_1)) / Float64(x + 1.0));
	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 = (z * t) - x;
	tmp = 0.0;
	if ((z <= -3.6e+51) || ~((z <= 7e+78)))
		tmp = (x + (y / (t_1 / z))) / (x + 1.0);
	else
		tmp = (x + (((z * y) - x) / t_1)) / (x + 1.0);
	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[(z * t), $MachinePrecision] - x), $MachinePrecision]}, If[Or[LessEqual[z, -3.6e+51], N[Not[LessEqual[z, 7e+78]], $MachinePrecision]], N[(N[(x + N[(y / N[(t$95$1 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(N[(N[(z * y), $MachinePrecision] - x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
t_1 := z \cdot t - x\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+51} \lor \neg \left(z \leq 7 \cdot 10^{+78}\right):\\
\;\;\;\;\frac{x + \frac{y}{\frac{t_1}{z}}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{z \cdot y - x}{t_1}}{x + 1}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.2
Target0.4
Herbie2.8
\[\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 z < -3.60000000000000011e51 or 7.0000000000000003e78 < z

    1. Initial program 18.3

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1} \]
    2. Simplified18.3

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

      [Start]18.3

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

      *-commutative [=>]18.3

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

      \[\leadsto \frac{x + \color{blue}{\frac{y \cdot z}{t \cdot z - x}}}{x + 1} \]
    4. Simplified6.5

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

      [Start]18.8

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

      associate-/l* [=>]6.5

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

    if -3.60000000000000011e51 < z < 7.0000000000000003e78

    1. Initial program 0.5

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

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

Alternatives

Alternative 1
Error21.8
Cost1236
\[\begin{array}{l} t_1 := \frac{x}{x + 1}\\ \mathbf{if}\;x \leq -4.7 \cdot 10^{-132}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -4.6 \cdot 10^{-207}:\\ \;\;\;\;1 - y \cdot \frac{z}{x}\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{-230}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{-129}:\\ \;\;\;\;x \cdot \left(1 + \frac{\frac{-1}{t}}{z}\right)\\ \mathbf{elif}\;x \leq 2.35 \cdot 10^{-77}:\\ \;\;\;\;1 + z \cdot \frac{t - y}{x}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error7.5
Cost1225
\[\begin{array}{l} t_1 := z \cdot t - x\\ \mathbf{if}\;y \leq -2.4 \cdot 10^{-51} \lor \neg \left(y \leq 1.5 \cdot 10^{-71}\right):\\ \;\;\;\;\frac{x + \frac{y}{\frac{t_1}{z}}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - \frac{x}{t_1}}{x + 1}\\ \end{array} \]
Alternative 3
Error21.6
Cost1108
\[\begin{array}{l} t_1 := \frac{x}{x + 1}\\ t_2 := 1 - y \cdot \frac{z}{x}\\ \mathbf{if}\;x \leq -5.8 \cdot 10^{-130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.15 \cdot 10^{-207}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 3.15 \cdot 10^{-230}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{-132}:\\ \;\;\;\;x \cdot \left(1 + \frac{\frac{-1}{t}}{z}\right)\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-80}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error15.1
Cost1104
\[\begin{array}{l} t_1 := \frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{if}\;x \leq -2.5 \cdot 10^{+42}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-207}:\\ \;\;\;\;1 - y \cdot \frac{z}{x}\\ \mathbf{elif}\;x \leq 30.5:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 5
Error15.2
Cost1104
\[\begin{array}{l} t_1 := \frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{if}\;x \leq -2.1 \cdot 10^{+41}:\\ \;\;\;\;1 - y \cdot \frac{\frac{z}{x}}{x}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-149}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-207}:\\ \;\;\;\;1 - y \cdot \frac{z}{x}\\ \mathbf{elif}\;x \leq 1.8:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 6
Error10.9
Cost969
\[\begin{array}{l} \mathbf{if}\;t \leq -3.9 \cdot 10^{-75} \lor \neg \left(t \leq 3.9 \cdot 10^{-78}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;1 - \frac{y}{x + 1} \cdot \frac{z}{x}\\ \end{array} \]
Alternative 7
Error21.7
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -21.5:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{-156}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-207}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{-61}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 8
Error21.7
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -21.5:\\ \;\;\;\;1 + \frac{-1}{x}\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-156}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-207}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-64}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 9
Error21.7
Cost720
\[\begin{array}{l} \mathbf{if}\;x \leq -21.5:\\ \;\;\;\;1 + \frac{-1}{x}\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{-155}:\\ \;\;\;\;x - x \cdot x\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-207}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-61}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 10
Error22.4
Cost716
\[\begin{array}{l} t_1 := \frac{x}{x + 1}\\ \mathbf{if}\;x \leq -2.1 \cdot 10^{-155}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-207}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-233}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error22.1
Cost716
\[\begin{array}{l} t_1 := \frac{x}{x + 1}\\ \mathbf{if}\;x \leq -4.3 \cdot 10^{-131}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-207}:\\ \;\;\;\;1 - y \cdot \frac{z}{x}\\ \mathbf{elif}\;x \leq 3.6 \cdot 10^{-233}:\\ \;\;\;\;\frac{y}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error26.8
Cost592
\[\begin{array}{l} \mathbf{if}\;x \leq -21.5:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq -6.2 \cdot 10^{-155}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.5 \cdot 10^{-283}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 1.22 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]
Alternative 13
Error28.3
Cost64
\[1 \]

Error

Reproduce?

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