?

Average Error: 2.1 → 2.1
Time: 45.8s
Precision: binary64
Cost: 840

?

\[\frac{x - y}{z - y} \cdot t \]
\[\begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-162}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-251}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \end{array} \]
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t)
 :precision binary64
 (if (<= y -1.05e-162)
   (* (/ (- x y) (- z y)) t)
   (if (<= y 3.3e-251) (* (- x y) (/ t (- z y))) (/ t (/ (- z y) (- x 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 <= -1.05e-162) {
		tmp = ((x - y) / (z - y)) * t;
	} else if (y <= 3.3e-251) {
		tmp = (x - y) * (t / (z - y));
	} else {
		tmp = t / ((z - y) / (x - 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 <= (-1.05d-162)) then
        tmp = ((x - y) / (z - y)) * t
    else if (y <= 3.3d-251) then
        tmp = (x - y) * (t / (z - y))
    else
        tmp = t / ((z - y) / (x - 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 <= -1.05e-162) {
		tmp = ((x - y) / (z - y)) * t;
	} else if (y <= 3.3e-251) {
		tmp = (x - y) * (t / (z - y));
	} else {
		tmp = t / ((z - y) / (x - 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 <= -1.05e-162:
		tmp = ((x - y) / (z - y)) * t
	elif y <= 3.3e-251:
		tmp = (x - y) * (t / (z - y))
	else:
		tmp = t / ((z - y) / (x - 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 <= -1.05e-162)
		tmp = Float64(Float64(Float64(x - y) / Float64(z - y)) * t);
	elseif (y <= 3.3e-251)
		tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y)));
	else
		tmp = Float64(t / Float64(Float64(z - y) / Float64(x - 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 <= -1.05e-162)
		tmp = ((x - y) / (z - y)) * t;
	elseif (y <= 3.3e-251)
		tmp = (x - y) * (t / (z - y));
	else
		tmp = t / ((z - y) / (x - 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[LessEqual[y, -1.05e-162], N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision], If[LessEqual[y, 3.3e-251], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\frac{x - y}{z - y} \cdot t
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-162}:\\
\;\;\;\;\frac{x - y}{z - y} \cdot t\\

\mathbf{elif}\;y \leq 3.3 \cdot 10^{-251}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Split input into 3 regimes
  2. if y < -1.05e-162

    1. Initial program 1.0

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

    if -1.05e-162 < y < 3.3e-251

    1. Initial program 6.3

      \[\frac{x - y}{z - y} \cdot t \]
    2. Taylor expanded in t around 0 5.3

      \[\leadsto \color{blue}{\frac{t \cdot \left(x - y\right)}{z - y}} \]
    3. Simplified6.5

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

      [Start]5.3

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

      rational.json-simplify-49 [=>]6.5

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

    if 3.3e-251 < y

    1. Initial program 1.7

      \[\frac{x - y}{z - y} \cdot t \]
    2. Applied egg-rr1.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.05 \cdot 10^{-162}:\\ \;\;\;\;\frac{x - y}{z - y} \cdot t\\ \mathbf{elif}\;y \leq 3.3 \cdot 10^{-251}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\ \end{array} \]

Alternatives

Alternative 1
Error21.3
Cost1900
\[\begin{array}{l} t_1 := y \cdot \frac{t}{y - z}\\ t_2 := t \cdot \frac{y - x}{y}\\ t_3 := \frac{x}{z - y} \cdot t\\ t_4 := \frac{t}{z} \cdot \left(x - y\right)\\ \mathbf{if}\;x \leq -6.8 \cdot 10^{+106}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{+82}:\\ \;\;\;\;t\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-12}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-63}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-90}:\\ \;\;\;\;\frac{t \cdot x}{z}\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{-154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-156}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \leq 1.1 \cdot 10^{-104}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.55 \cdot 10^{-36}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 6.9 \cdot 10^{+16}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \leq 6 \cdot 10^{+60}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Error21.4
Cost1900
\[\begin{array}{l} t_1 := y \cdot \frac{t}{y - z}\\ t_2 := t \cdot \frac{y - x}{y}\\ t_3 := \frac{x}{z - y} \cdot t\\ \mathbf{if}\;x \leq -5.7 \cdot 10^{+106}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -7.8 \cdot 10^{+80}:\\ \;\;\;\;t\\ \mathbf{elif}\;x \leq -5.7 \cdot 10^{-11}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-64}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-90}:\\ \;\;\;\;\frac{t \cdot x}{z}\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-129}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.6 \cdot 10^{-131}:\\ \;\;\;\;\frac{y \cdot \left(-t\right)}{z}\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-105}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.3 \cdot 10^{-42}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{x - y}{z} \cdot t\\ \mathbf{elif}\;x \leq 6.6 \cdot 10^{+62}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 3
Error16.6
Cost1240
\[\begin{array}{l} t_1 := t \cdot \frac{y - x}{y}\\ t_2 := \frac{t}{1 - \frac{z}{y}}\\ \mathbf{if}\;y \leq -1.26 \cdot 10^{+27}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-251}:\\ \;\;\;\;\frac{t}{z} \cdot \left(x - y\right)\\ \mathbf{elif}\;y \leq 0.235:\\ \;\;\;\;\frac{x - y}{z} \cdot t\\ \mathbf{elif}\;y \leq 54000000000000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+151}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{+213}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error17.7
Cost1240
\[\begin{array}{l} t_1 := \frac{t}{\frac{z - y}{x}}\\ \mathbf{if}\;x \leq -5.7 \cdot 10^{+106}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.55 \cdot 10^{+82}:\\ \;\;\;\;t\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{z - y} \cdot t\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{-56}:\\ \;\;\;\;t \cdot \frac{y - x}{y}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-91}:\\ \;\;\;\;\frac{t \cdot \left(x - y\right)}{z}\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{+70}:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error17.8
Cost1240
\[\begin{array}{l} \mathbf{if}\;x \leq -5.7 \cdot 10^{+106}:\\ \;\;\;\;\left(\frac{-1}{y - z} \cdot x\right) \cdot t\\ \mathbf{elif}\;x \leq -1.45 \cdot 10^{+81}:\\ \;\;\;\;t\\ \mathbf{elif}\;x \leq -6.6 \cdot 10^{-11}:\\ \;\;\;\;\frac{x}{z - y} \cdot t\\ \mathbf{elif}\;x \leq -4.2 \cdot 10^{-56}:\\ \;\;\;\;t \cdot \frac{y - x}{y}\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-90}:\\ \;\;\;\;\frac{t \cdot \left(x - y\right)}{z}\\ \mathbf{elif}\;x \leq 8.6 \cdot 10^{+70}:\\ \;\;\;\;\frac{t}{1 - \frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{z - y}{x}}\\ \end{array} \]
Alternative 6
Error21.9
Cost976
\[\begin{array}{l} t_1 := t \cdot \frac{y - x}{y}\\ \mathbf{if}\;y \leq -1.2 \cdot 10^{+23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8.4 \cdot 10^{-117}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 5 \cdot 10^{+16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{+42}:\\ \;\;\;\;\frac{-y}{\frac{z}{t}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error18.4
Cost976
\[\begin{array}{l} t_1 := t \cdot \frac{y - x}{y}\\ \mathbf{if}\;y \leq -2.9 \cdot 10^{+21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.55 \cdot 10^{-61}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{elif}\;y \leq 3.8 \cdot 10^{+16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.8 \cdot 10^{+40}:\\ \;\;\;\;\frac{-y}{\frac{z}{t}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error25.7
Cost912
\[\begin{array}{l} \mathbf{if}\;y \leq -3.3 \cdot 10^{+23}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-251}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{-10}:\\ \;\;\;\;\frac{x}{z} \cdot t\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{+83}:\\ \;\;\;\;y \cdot \left(-\frac{t}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 9
Error25.7
Cost912
\[\begin{array}{l} \mathbf{if}\;y \leq -1.45 \cdot 10^{+24}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 5.5 \cdot 10^{-251}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-10}:\\ \;\;\;\;\frac{x}{z} \cdot t\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{+83}:\\ \;\;\;\;\frac{-y}{\frac{z}{t}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 10
Error18.1
Cost844
\[\begin{array}{l} t_1 := t \cdot \frac{y - x}{y}\\ \mathbf{if}\;y \leq -7.1 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-117}:\\ \;\;\;\;x \cdot \frac{t}{z - y}\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+123}:\\ \;\;\;\;y \cdot \frac{t}{y - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error17.3
Cost844
\[\begin{array}{l} t_1 := t \cdot \frac{y - x}{y}\\ \mathbf{if}\;y \leq -5.5 \cdot 10^{+20}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-62}:\\ \;\;\;\;\frac{t}{z} \cdot \left(x - y\right)\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{+119}:\\ \;\;\;\;y \cdot \frac{t}{y - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error7.0
Cost840
\[\begin{array}{l} t_1 := t \cdot \frac{y - x}{y}\\ \mathbf{if}\;y \leq -3.8 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+123}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error2.1
Cost840
\[\begin{array}{l} t_1 := \frac{x - y}{z - y} \cdot t\\ \mathbf{if}\;y \leq -1.8 \cdot 10^{-162}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-251}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error39.1
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{-226}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.5 \cdot 10^{-155}:\\ \;\;\;\;t \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 15
Error26.1
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+22}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-63}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 16
Error39.7
Cost64
\[t \]

Error

Reproduce?

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