?

Average Error: 2.1 → 2.4
Time: 10.7s
Precision: binary64
Cost: 969

?

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z - y}{\left(x - y\right) \cdot t}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.1
Target2.1
Herbie2.4
\[\frac{t}{\frac{z - y}{x - y}} \]

Derivation?

  1. Split input into 2 regimes
  2. if y < -2.1000000000000001e-299 or 2.6999999999999997e-91 < y

    1. Initial program 1.4

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

    if -2.1000000000000001e-299 < y < 2.6999999999999997e-91

    1. Initial program 5.6

      \[\frac{x - y}{z - y} \cdot t \]
    2. Simplified5.3

      \[\leadsto \color{blue}{\left(x - y\right) \cdot \frac{t}{z - y}} \]
      Proof

      [Start]5.6

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

      associate-*l/ [=>]6.8

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

      associate-*r/ [<=]5.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-299} \lor \neg \left(y \leq 2.7 \cdot 10^{-91}\right):\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{z - y}{\left(x - y\right) \cdot t}}\\ \end{array} \]

Alternatives

Alternative 1
Error16.3
Cost1240
\[\begin{array}{l} t_1 := t \cdot \frac{x}{z - y}\\ t_2 := t \cdot \frac{y}{y - z}\\ \mathbf{if}\;y \leq -8.2 \cdot 10^{+47}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -65000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4.8 \cdot 10^{-46}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -8.8 \cdot 10^{-302}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-126}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 70000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error16.5
Cost1240
\[\begin{array}{l} t_1 := t \cdot \frac{x}{z - y}\\ t_2 := t \cdot \frac{y}{y - z}\\ \mathbf{if}\;y \leq -8.2 \cdot 10^{+47}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -8000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.35 \cdot 10^{-45}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-302}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-126}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 32000000:\\ \;\;\;\;\frac{x \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error16.7
Cost1240
\[\begin{array}{l} t_1 := t \cdot \frac{x}{z - y}\\ t_2 := t \cdot \frac{y}{y - z}\\ \mathbf{if}\;y \leq -8.2 \cdot 10^{+47}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1650:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.7 \cdot 10^{-45}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1.15 \cdot 10^{-301}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-126}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z}\\ \mathbf{elif}\;y \leq 62000000:\\ \;\;\;\;\frac{x \cdot t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error16.9
Cost976
\[\begin{array}{l} t_1 := t \cdot \frac{x}{z - y}\\ t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -8.5 \cdot 10^{-57}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -3 \cdot 10^{-301}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-126}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 14500:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error7.2
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -1.46 \cdot 10^{+206}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+199}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \end{array} \]
Alternative 6
Error16.8
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-58} \lor \neg \left(y \leq 31000\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \end{array} \]
Alternative 7
Error20.6
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -6.9 \cdot 10^{+78}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 100000000:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 8
Error25.7
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{-53}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 28000:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 9
Error25.1
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{-52}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 27000000:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 10
Error25.1
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{-47}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 7800000:\\ \;\;\;\;\frac{t}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 11
Error2.1
Cost576
\[\frac{x - y}{z - y} \cdot t \]
Alternative 12
Error39.4
Cost64
\[t \]

Error

Reproduce?

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

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

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