?

Average Accuracy: 96.4% → 97.7%
Time: 15.1s
Precision: binary64
Cost: 1865

?

\[\frac{x - y}{z - y} \cdot t \]
\[\begin{array}{l} t_1 := \frac{x - y}{z - y}\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{-137} \lor \neg \left(t_1 \leq 10^{-171}\right):\\ \;\;\;\;\frac{t}{\frac{y}{y - x} - \frac{z}{y - x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (/ (- x y) (- z y))))
   (if (or (<= t_1 -1e-137) (not (<= t_1 1e-171)))
     (/ t (- (/ y (- y x)) (/ z (- y x))))
     (/ (* (- x y) t) z))))
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 t_1 = (x - y) / (z - y);
	double tmp;
	if ((t_1 <= -1e-137) || !(t_1 <= 1e-171)) {
		tmp = t / ((y / (y - x)) - (z / (y - x)));
	} else {
		tmp = ((x - y) * t) / z;
	}
	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) :: t_1
    real(8) :: tmp
    t_1 = (x - y) / (z - y)
    if ((t_1 <= (-1d-137)) .or. (.not. (t_1 <= 1d-171))) then
        tmp = t / ((y / (y - x)) - (z / (y - x)))
    else
        tmp = ((x - y) * t) / z
    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 t_1 = (x - y) / (z - y);
	double tmp;
	if ((t_1 <= -1e-137) || !(t_1 <= 1e-171)) {
		tmp = t / ((y / (y - x)) - (z / (y - x)));
	} else {
		tmp = ((x - y) * t) / z;
	}
	return tmp;
}
def code(x, y, z, t):
	return ((x - y) / (z - y)) * t
def code(x, y, z, t):
	t_1 = (x - y) / (z - y)
	tmp = 0
	if (t_1 <= -1e-137) or not (t_1 <= 1e-171):
		tmp = t / ((y / (y - x)) - (z / (y - x)))
	else:
		tmp = ((x - y) * t) / z
	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)
	t_1 = Float64(Float64(x - y) / Float64(z - y))
	tmp = 0.0
	if ((t_1 <= -1e-137) || !(t_1 <= 1e-171))
		tmp = Float64(t / Float64(Float64(y / Float64(y - x)) - Float64(z / Float64(y - x))));
	else
		tmp = Float64(Float64(Float64(x - y) * t) / z);
	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)
	t_1 = (x - y) / (z - y);
	tmp = 0.0;
	if ((t_1 <= -1e-137) || ~((t_1 <= 1e-171)))
		tmp = t / ((y / (y - x)) - (z / (y - x)));
	else
		tmp = ((x - y) * t) / z;
	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_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e-137], N[Not[LessEqual[t$95$1, 1e-171]], $MachinePrecision]], N[(t / N[(N[(y / N[(y - x), $MachinePrecision]), $MachinePrecision] - N[(z / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - y), $MachinePrecision] * t), $MachinePrecision] / z), $MachinePrecision]]]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{-137} \lor \neg \left(t_1 \leq 10^{-171}\right):\\
\;\;\;\;\frac{t}{\frac{y}{y - x} - \frac{z}{y - x}}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original96.4%
Target96.4%
Herbie97.7%
\[\frac{t}{\frac{z - y}{x - y}} \]

Derivation?

  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 x y) (-.f64 z y)) < -9.99999999999999978e-138 or 9.9999999999999998e-172 < (/.f64 (-.f64 x y) (-.f64 z y))

    1. Initial program 97.5%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Simplified97.5%

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

      [Start]97.5

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

      sub-neg [=>]97.5

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

      +-commutative [=>]97.5

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

      neg-sub0 [=>]97.5

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

      associate-+l- [=>]97.5

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

      sub0-neg [=>]97.5

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

      neg-mul-1 [=>]97.5

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

      sub-neg [=>]97.5

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

      +-commutative [=>]97.5

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

      neg-sub0 [=>]97.5

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

      associate-+l- [=>]97.5

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

      sub0-neg [=>]97.5

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

      neg-mul-1 [=>]97.5

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

      times-frac [=>]97.5

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

      metadata-eval [=>]97.5

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

      *-lft-identity [=>]97.5

      \[ \color{blue}{\frac{y - x}{y - z}} \cdot t \]
    3. Applied egg-rr97.3%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y - z}{y - x}}{t}}} \]
    4. Applied egg-rr97.3%

      \[\leadsto \frac{1}{\frac{\color{blue}{\frac{y}{y - x} - \frac{z}{y - x}}}{t}} \]
    5. Taylor expanded in t around 0 97.7%

      \[\leadsto \color{blue}{\frac{t}{\frac{y}{y - x} - \frac{z}{y - x}}} \]

    if -9.99999999999999978e-138 < (/.f64 (-.f64 x y) (-.f64 z y)) < 9.9999999999999998e-172

    1. Initial program 90.6%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Simplified97.7%

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

      [Start]90.6

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

      associate-*l/ [=>]97.6

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

      associate-*r/ [<=]97.7

      \[ \color{blue}{\left(x - y\right) \cdot \frac{t}{z - y}} \]
    3. Taylor expanded in z around inf 97.6%

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

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

Alternatives

Alternative 1
Accuracy96.7%
Cost1993
\[\begin{array}{l} t_1 := \frac{x - y}{z - y} \cdot t\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{-293} \lor \neg \left(t_1 \leq 2 \cdot 10^{-312}\right):\\ \;\;\;\;\frac{1}{\frac{\frac{y - z}{y - x}}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array} \]
Alternative 2
Accuracy97.6%
Cost1609
\[\begin{array}{l} t_1 := \frac{x - y}{z - y}\\ \mathbf{if}\;t_1 \leq -1 \cdot 10^{-137} \lor \neg \left(t_1 \leq 10^{-251}\right):\\ \;\;\;\;t_1 \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x - y\right) \cdot t}{z}\\ \end{array} \]
Alternative 3
Accuracy69.7%
Cost1241
\[\begin{array}{l} t_1 := t \cdot \frac{y}{y - z}\\ t_2 := x \cdot \frac{t}{z - y}\\ \mathbf{if}\;x \leq -2.45 \cdot 10^{+44}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1500000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.8 \cdot 10^{-46}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 13500000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 10^{+107} \lor \neg \left(x \leq 2 \cdot 10^{+190}\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \end{array} \]
Alternative 4
Accuracy69.7%
Cost1241
\[\begin{array}{l} t_1 := t \cdot \frac{y}{y - z}\\ t_2 := x \cdot \frac{t}{z - y}\\ \mathbf{if}\;x \leq -2.9 \cdot 10^{+44}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4150000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.8 \cdot 10^{-46}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 5200000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.5 \cdot 10^{+106} \lor \neg \left(x \leq 1.68 \cdot 10^{+190}\right):\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \end{array} \]
Alternative 5
Accuracy69.6%
Cost1241
\[\begin{array}{l} t_1 := x \cdot \frac{t}{z - y}\\ \mathbf{if}\;x \leq -3.3 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -222000:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{elif}\;x \leq -3.55 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 28000000000:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+106} \lor \neg \left(x \leq 2.8 \cdot 10^{+191}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \end{array} \]
Alternative 6
Accuracy72.1%
Cost1241
\[\begin{array}{l} t_1 := \frac{t}{\frac{z - y}{x}}\\ \mathbf{if}\;x \leq -2.9 \cdot 10^{+44}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -62000:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-48}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{elif}\;x \leq 48000000:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \mathbf{elif}\;x \leq 6.5 \cdot 10^{+105} \lor \neg \left(x \leq 1.68 \cdot 10^{+190}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \end{array} \]
Alternative 7
Accuracy74.9%
Cost1108
\[\begin{array}{l} t_1 := \frac{t}{\frac{z}{x - y}}\\ t_2 := \frac{t}{1 - \frac{z}{y}}\\ \mathbf{if}\;y \leq -2.25 \cdot 10^{-30}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -7.8 \cdot 10^{-177}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-198}:\\ \;\;\;\;\frac{x}{\frac{z - y}{t}}\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{-133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.7 \cdot 10^{+68}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Accuracy71.9%
Cost978
\[\begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{-31} \lor \neg \left(y \leq 1.26 \cdot 10^{-51} \lor \neg \left(y \leq 7.2 \cdot 10^{-12}\right) \land y \leq 3.05 \cdot 10^{+81}\right):\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \end{array} \]
Alternative 9
Accuracy72.6%
Cost844
\[\begin{array}{l} t_1 := \frac{t}{\frac{z}{x - y}}\\ \mathbf{if}\;z \leq -3.6 \cdot 10^{+76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.3 \cdot 10^{-85}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{elif}\;z \leq 6 \cdot 10^{+67}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Accuracy89.1%
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{+139}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{+189}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \end{array} \]
Alternative 11
Accuracy58.2%
Cost780
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-25}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-114}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 10^{+65}:\\ \;\;\;\;x \cdot \frac{-t}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 12
Accuracy58.2%
Cost780
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-25}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 3.1 \cdot 10^{-113}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+65}:\\ \;\;\;\;\frac{x}{\frac{y}{-t}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 13
Accuracy65.4%
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{+135}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 3.45 \cdot 10^{+81}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 14
Accuracy60.0%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-25}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 6 \cdot 10^{-52}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 15
Accuracy37.8%
Cost64
\[t \]

Error

Reproduce?

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