?

Average Accuracy: 96.4% → 96.5%
Time: 15.6s
Precision: binary64
Cost: 841

?

\[\frac{x - y}{z - y} \cdot t \]
\[\begin{array}{l} \mathbf{if}\;y \leq -4 \cdot 10^{-44} \lor \neg \left(y \leq 4.4 \cdot 10^{-212}\right):\\ \;\;\;\;t \cdot \frac{x - y}{z - y}\\ \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 -4e-44) (not (<= y 4.4e-212)))
   (* t (/ (- x y) (- z y)))
   (* (- 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 <= -4e-44) || !(y <= 4.4e-212)) {
		tmp = t * ((x - y) / (z - y));
	} 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 <= (-4d-44)) .or. (.not. (y <= 4.4d-212))) then
        tmp = t * ((x - y) / (z - y))
    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 <= -4e-44) || !(y <= 4.4e-212)) {
		tmp = t * ((x - y) / (z - y));
	} 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 <= -4e-44) or not (y <= 4.4e-212):
		tmp = t * ((x - y) / (z - y))
	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 <= -4e-44) || !(y <= 4.4e-212))
		tmp = Float64(t * Float64(Float64(x - y) / Float64(z - y)));
	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 <= -4e-44) || ~((y <= 4.4e-212)))
		tmp = t * ((x - y) / (z - y));
	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, -4e-44], N[Not[LessEqual[y, 4.4e-212]], $MachinePrecision]], N[(t * N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $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 -4 \cdot 10^{-44} \lor \neg \left(y \leq 4.4 \cdot 10^{-212}\right):\\
\;\;\;\;t \cdot \frac{x - y}{z - y}\\

\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.4%
Target96.4%
Herbie96.5%
\[\frac{t}{\frac{z - y}{x - y}} \]

Derivation?

  1. Split input into 2 regimes
  2. if y < -3.99999999999999981e-44 or 4.40000000000000006e-212 < y

    1. Initial program 98.4%

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

    if -3.99999999999999981e-44 < y < 4.40000000000000006e-212

    1. Initial program 91.1%

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

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

      [Start]91.1

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

      associate-*l/ [=>]91.9

      \[ \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 -4 \cdot 10^{-44} \lor \neg \left(y \leq 4.4 \cdot 10^{-212}\right):\\ \;\;\;\;t \cdot \frac{x - y}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy81.6%
Cost1500
\[\begin{array}{l} t_1 := \left(x - y\right) \cdot \frac{t}{z - y}\\ t_2 := \frac{t}{\frac{z - y}{x}}\\ \mathbf{if}\;t \leq -8 \cdot 10^{-120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1.75 \cdot 10^{-221}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{elif}\;t \leq 3.8 \cdot 10^{-289}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 4.2 \cdot 10^{-220}:\\ \;\;\;\;\frac{t \cdot \left(y - x\right)}{y}\\ \mathbf{elif}\;t \leq 2.8 \cdot 10^{-153}:\\ \;\;\;\;\frac{t}{\frac{z}{x - y}}\\ \mathbf{elif}\;t \leq 1.9 \cdot 10^{-126}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 2 \cdot 10^{-109}:\\ \;\;\;\;\frac{t \cdot y}{y - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Accuracy57.7%
Cost1176
\[\begin{array}{l} t_1 := \frac{y \cdot \left(-t\right)}{z}\\ \mathbf{if}\;y \leq -6.6 \cdot 10^{+52}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-113}:\\ \;\;\;\;\frac{t}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{+34}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+118}:\\ \;\;\;\;\frac{t}{\frac{y}{-x}}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+131}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 3
Accuracy57.9%
Cost1044
\[\begin{array}{l} \mathbf{if}\;y \leq -8.5 \cdot 10^{+53}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-113}:\\ \;\;\;\;\frac{t}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 5.7 \cdot 10^{-39}:\\ \;\;\;\;y \cdot \frac{t}{-z}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+34}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+131}:\\ \;\;\;\;t \cdot \frac{-x}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 4
Accuracy57.9%
Cost1044
\[\begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+53}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-113}:\\ \;\;\;\;\frac{t}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 10^{-38}:\\ \;\;\;\;y \cdot \frac{t}{-z}\\ \mathbf{elif}\;y \leq 1.95 \cdot 10^{+34}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+131}:\\ \;\;\;\;\frac{t}{\frac{y}{-x}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 5
Accuracy57.2%
Cost1044
\[\begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{+53}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-114}:\\ \;\;\;\;\frac{t}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{-39}:\\ \;\;\;\;y \cdot \frac{t}{-z}\\ \mathbf{elif}\;y \leq 7.6 \cdot 10^{+31}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 3.05 \cdot 10^{+144}:\\ \;\;\;\;\frac{t}{\frac{-z}{y}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 6
Accuracy67.4%
Cost976
\[\begin{array}{l} t_1 := \frac{t}{\frac{z}{x}}\\ t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -6.9 \cdot 10^{-38}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-113}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-39}:\\ \;\;\;\;\frac{y \cdot \left(-t\right)}{z}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+14}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Accuracy73.3%
Cost976
\[\begin{array}{l} t_1 := \frac{t}{\frac{z}{x - y}}\\ \mathbf{if}\;z \leq -8.8 \cdot 10^{+45}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.6 \cdot 10^{+23}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{+92}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{+120}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Accuracy73.2%
Cost976
\[\begin{array}{l} t_1 := \frac{t}{\frac{z - y}{x}}\\ \mathbf{if}\;y \leq -4.4 \cdot 10^{+52}:\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-92}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{-39}:\\ \;\;\;\;\frac{t \cdot y}{y - z}\\ \mathbf{elif}\;y \leq 6.2:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \end{array} \]
Alternative 9
Accuracy73.1%
Cost976
\[\begin{array}{l} t_1 := \frac{t}{\frac{z - y}{x}}\\ \mathbf{if}\;y \leq -4.2 \cdot 10^{+52}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-92}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3 \cdot 10^{-39}:\\ \;\;\;\;\frac{t \cdot y}{y - z}\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \end{array} \]
Alternative 10
Accuracy58.8%
Cost780
\[\begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+52}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{+34}:\\ \;\;\;\;\frac{t}{\frac{z}{x}}\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+131}:\\ \;\;\;\;t \cdot \frac{-x}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 11
Accuracy72.7%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -2.45 \cdot 10^{-39} \lor \neg \left(y \leq 5.2 \cdot 10^{+49}\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \end{array} \]
Alternative 12
Accuracy73.0%
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{+52}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-93}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \end{array} \]
Alternative 13
Accuracy73.1%
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -3.7 \cdot 10^{+53}:\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \mathbf{elif}\;y \leq 8.5 \cdot 10^{-93}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \end{array} \]
Alternative 14
Accuracy41.5%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{+184} \lor \neg \left(z \leq 4.2 \cdot 10^{+152}\right):\\ \;\;\;\;y \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 15
Accuracy59.6%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -9.5 \cdot 10^{+52}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 2.9 \cdot 10^{+14}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 16
Accuracy60.4%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -4.2 \cdot 10^{+52}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{+14}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 17
Accuracy60.4%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -3.5 \cdot 10^{+54}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 9.2 \cdot 10^{+14}:\\ \;\;\;\;\frac{t}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 18
Accuracy96.4%
Cost576
\[\frac{t}{\frac{z - y}{x - y}} \]
Alternative 19
Accuracy37.9%
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq 4.8 \cdot 10^{+163}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{y}\\ \end{array} \]
Alternative 20
Accuracy38.3%
Cost64
\[t \]

Error

Reproduce?

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