?

Average Accuracy: 97.0% → 97.4%
Time: 13.5s
Precision: binary64
Cost: 1348

?

\[\frac{x - y}{z - y} \cdot t \]
\[\begin{array}{l} t_1 := \frac{x - y}{z - y} \cdot t\\ \mathbf{if}\;t_1 \leq 10^{+273}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{y - z}{t}}{y - x}}\\ \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)) t)))
   (if (<= t_1 1e+273) t_1 (/ 1.0 (/ (/ (- y z) t) (- y x))))))
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)) * t;
	double tmp;
	if (t_1 <= 1e+273) {
		tmp = t_1;
	} else {
		tmp = 1.0 / (((y - z) / t) / (y - x));
	}
	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)) * t
    if (t_1 <= 1d+273) then
        tmp = t_1
    else
        tmp = 1.0d0 / (((y - z) / t) / (y - x))
    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)) * t;
	double tmp;
	if (t_1 <= 1e+273) {
		tmp = t_1;
	} else {
		tmp = 1.0 / (((y - z) / t) / (y - x));
	}
	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)) * t
	tmp = 0
	if t_1 <= 1e+273:
		tmp = t_1
	else:
		tmp = 1.0 / (((y - z) / t) / (y - x))
	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(Float64(x - y) / Float64(z - y)) * t)
	tmp = 0.0
	if (t_1 <= 1e+273)
		tmp = t_1;
	else
		tmp = Float64(1.0 / Float64(Float64(Float64(y - z) / t) / Float64(y - x)));
	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)) * t;
	tmp = 0.0;
	if (t_1 <= 1e+273)
		tmp = t_1;
	else
		tmp = 1.0 / (((y - z) / t) / (y - x));
	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[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+273], t$95$1, N[(1.0 / N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
t_1 := \frac{x - y}{z - y} \cdot t\\
\mathbf{if}\;t_1 \leq 10^{+273}:\\
\;\;\;\;t_1\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original97.0%
Target96.9%
Herbie97.4%
\[\frac{t}{\frac{z - y}{x - y}} \]

Derivation?

  1. Split input into 2 regimes
  2. if (*.f64 (/.f64 (-.f64 x y) (-.f64 z y)) t) < 9.99999999999999945e272

    1. Initial program 97.5%

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

    if 9.99999999999999945e272 < (*.f64 (/.f64 (-.f64 x y) (-.f64 z y)) t)

    1. Initial program 76.9%

      \[\frac{x - y}{z - y} \cdot t \]
    2. Simplified76.9%

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

      [Start]76.9

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

      sub-neg [=>]76.9

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

      +-commutative [=>]76.9

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

      neg-sub0 [=>]76.9

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

      associate-+l- [=>]76.9

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

      sub0-neg [=>]76.9

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

      neg-mul-1 [=>]76.9

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

      sub-neg [=>]76.9

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

      +-commutative [=>]76.9

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

      neg-sub0 [=>]76.9

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

      associate-+l- [=>]76.9

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

      sub0-neg [=>]76.9

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

      neg-mul-1 [=>]76.9

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

      times-frac [=>]76.9

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

      metadata-eval [=>]76.9

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

      *-lft-identity [=>]76.9

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

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

      [Start]76.9

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

      associate-/r/ [<=]91.2

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

      *-un-lft-identity [=>]91.2

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

      associate-/l* [=>]91.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x - y}{z - y} \cdot t \leq 10^{+273}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{y - z}{t}}{y - x}}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy97.5%
Cost1220
\[\begin{array}{l} t_1 := \frac{x - y}{z - y} \cdot t\\ \mathbf{if}\;t_1 \leq 4 \cdot 10^{+305}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot t}{z - y}\\ \end{array} \]
Alternative 2
Accuracy63.1%
Cost976
\[\begin{array}{l} t_1 := \left(y - x\right) \cdot \frac{t}{y}\\ \mathbf{if}\;y \leq -1.15 \cdot 10^{+167}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-45}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+156}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 3
Accuracy68.7%
Cost976
\[\begin{array}{l} t_1 := \left(y - x\right) \cdot \frac{t}{y}\\ \mathbf{if}\;y \leq -1.55 \cdot 10^{+169}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -5.5 \cdot 10^{+33}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-44}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{+156}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 4
Accuracy73.5%
Cost844
\[\begin{array}{l} t_1 := t \cdot \frac{y - x}{y}\\ \mathbf{if}\;y \leq -3 \cdot 10^{+33}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.25 \cdot 10^{-42}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 5.1 \cdot 10^{+98}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Accuracy73.2%
Cost844
\[\begin{array}{l} t_1 := t \cdot \frac{y - x}{y}\\ \mathbf{if}\;y \leq -3.6 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.25 \cdot 10^{-88}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+98}:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Accuracy73.2%
Cost844
\[\begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{+32}:\\ \;\;\;\;\frac{t}{\frac{y}{y - x}}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-89}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+100}:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y - x}{y}\\ \end{array} \]
Alternative 7
Accuracy73.1%
Cost844
\[\begin{array}{l} \mathbf{if}\;y \leq -3.9 \cdot 10^{+33}:\\ \;\;\;\;\frac{t}{\frac{y}{y - x}}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-89}:\\ \;\;\;\;\frac{y - x}{\frac{z}{-t}}\\ \mathbf{elif}\;y \leq 1.24 \cdot 10^{+98}:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y - x}{y}\\ \end{array} \]
Alternative 8
Accuracy88.9%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{+169} \lor \neg \left(y \leq 10^{+136}\right):\\ \;\;\;\;t \cdot \frac{y - x}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \end{array} \]
Alternative 9
Accuracy74.1%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{+33} \lor \neg \left(y \leq 3.2 \cdot 10^{-43}\right):\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \end{array} \]
Alternative 10
Accuracy59.6%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -4.6 \cdot 10^{+32}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 4.6 \cdot 10^{-44}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 11
Accuracy37.3%
Cost64
\[t \]

Error

Reproduce?

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