?

Average Accuracy: 96.6% → 96.5%
Time: 14.4s
Precision: binary64
Cost: 841

?

\[\frac{x - y}{z - y} \cdot t \]
\[\begin{array}{l} \mathbf{if}\;y \leq -9.8 \cdot 10^{-64} \lor \neg \left(y \leq -9.4 \cdot 10^{-266}\right):\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t)
 :precision binary64
 (if (or (<= y -9.8e-64) (not (<= y -9.4e-266)))
   (* (/ (- x y) (- z y)) t)
   (* (- x y) (/ t (- z y)))))
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 <= -9.8e-64) || !(y <= -9.4e-266)) {
		tmp = ((x - y) / (z - y)) * t;
	} else {
		tmp = (x - y) * (t / (z - y));
	}
	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 <= (-9.8d-64)) .or. (.not. (y <= (-9.4d-266)))) then
        tmp = ((x - y) / (z - y)) * t
    else
        tmp = (x - y) * (t / (z - y))
    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 <= -9.8e-64) || !(y <= -9.4e-266)) {
		tmp = ((x - y) / (z - y)) * t;
	} else {
		tmp = (x - y) * (t / (z - y));
	}
	return tmp;
}
def code(x, y, z, t):
	return ((x - y) / (z - y)) * t
def code(x, y, z, t):
	tmp = 0
	if (y <= -9.8e-64) or not (y <= -9.4e-266):
		tmp = ((x - y) / (z - y)) * t
	else:
		tmp = (x - y) * (t / (z - y))
	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 <= -9.8e-64) || !(y <= -9.4e-266))
		tmp = Float64(Float64(Float64(x - y) / Float64(z - y)) * t);
	else
		tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y)));
	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 <= -9.8e-64) || ~((y <= -9.4e-266)))
		tmp = ((x - y) / (z - y)) * t;
	else
		tmp = (x - y) * (t / (z - y));
	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, -9.8e-64], N[Not[LessEqual[y, -9.4e-266]], $MachinePrecision]], N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{-64} \lor \neg \left(y \leq -9.4 \cdot 10^{-266}\right):\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original96.6%
Target96.7%
Herbie96.5%
\[\frac{t}{\frac{z - y}{x - y}} \]

Derivation?

  1. Split input into 2 regimes
  2. if y < -9.8000000000000003e-64 or -9.40000000000000054e-266 < y

    1. Initial program 97.5%

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

    if -9.8000000000000003e-64 < y < -9.40000000000000054e-266

    1. Initial program 92.0%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Simplified91.4%

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

      [Start]92.0

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

      associate-*l/ [=>]90.8

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

      associate-*r/ [<=]91.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.8 \cdot 10^{-64} \lor \neg \left(y \leq -9.4 \cdot 10^{-266}\right):\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy72.0%
Cost976
\[\begin{array}{l} t_1 := \frac{z - y}{t}\\ t_2 := \frac{x}{t_1}\\ \mathbf{if}\;y \leq -8500000000000:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-146}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-48}:\\ \;\;\;\;\frac{-y}{t_1}\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{+22}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \end{array} \]
Alternative 2
Accuracy89.2%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{+160} \lor \neg \left(y \leq 2.6 \cdot 10^{+121}\right):\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array} \]
Alternative 3
Accuracy69.0%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -4.4 \cdot 10^{-90} \lor \neg \left(y \leq 3.7 \cdot 10^{-58}\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \end{array} \]
Alternative 4
Accuracy73.8%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -50000 \lor \neg \left(y \leq 8 \cdot 10^{-59}\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \end{array} \]
Alternative 5
Accuracy73.9%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -400000000000 \lor \neg \left(y \leq 4.1 \cdot 10^{-57}\right):\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \end{array} \]
Alternative 6
Accuracy73.9%
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -0.155:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-57}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \end{array} \]
Alternative 7
Accuracy74.0%
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -8500:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 4.1 \cdot 10^{-57}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \end{array} \]
Alternative 8
Accuracy59.7%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -0.00031:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-69}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 9
Accuracy61.3%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -0.0058:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+22}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 10
Accuracy37.8%
Cost64
\[t \]

Error

Reproduce?

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