?

Average Error: 2.1 → 2.1
Time: 8.0s
Precision: binary64
Cost: 841

?

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

\mathbf{else}:\\
\;\;\;\;t + \frac{x}{\frac{y}{z - t}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.1
Target2.5
Herbie2.1
\[\begin{array}{l} \mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if t < -1.35000000000000005e-160 or 3.5000000000000001e-203 < t

    1. Initial program 1.2

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

    if -1.35000000000000005e-160 < t < 3.5000000000000001e-203

    1. Initial program 5.3

      \[\frac{x}{y} \cdot \left(z - t\right) + t \]
    2. Applied egg-rr5.3

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

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

Alternatives

Alternative 1
Error22.1
Cost1945
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-21}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 10000000000:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{+51} \lor \neg \left(\frac{x}{y} \leq 5 \cdot 10^{+134}\right) \land \frac{x}{y} \leq 10^{+184}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \end{array} \]
Alternative 2
Error22.2
Cost1945
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-21}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 10000000000:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{+51}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+134} \lor \neg \left(\frac{x}{y} \leq 10^{+184}\right):\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{y} \cdot \left(-x\right)\\ \end{array} \]
Alternative 3
Error14.3
Cost969
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-32} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-21}\right):\\ \;\;\;\;x \cdot \frac{z - t}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 4
Error6.6
Cost969
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+19} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-21}\right):\\ \;\;\;\;x \cdot \frac{z - t}{y}\\ \mathbf{else}:\\ \;\;\;\;t + \frac{x \cdot z}{y}\\ \end{array} \]
Alternative 5
Error6.6
Cost968
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+19}:\\ \;\;\;\;x \cdot \frac{z - t}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-14}:\\ \;\;\;\;t + \frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\ \end{array} \]
Alternative 6
Error21.9
Cost841
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{-25} \lor \neg \left(\frac{x}{y} \leq 4 \cdot 10^{-21}\right):\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 7
Error2.1
Cost576
\[t + \frac{x}{y} \cdot \left(z - t\right) \]
Alternative 8
Error31.9
Cost64
\[t \]

Error

Reproduce?

herbie shell --seed 2023039 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

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