Average Error: 2.2 → 2.2
Time: 12.3s
Precision: binary64
Cost: 576
\[\frac{x - y}{z - y} \cdot t \]
\[\frac{x - y}{z - y} \cdot t \]
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
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) {
	return ((x - y) / (z - y)) * t;
}
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
    code = ((x - y) / (z - y)) * t
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) {
	return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t):
	return ((x - y) / (z - y)) * t
def code(x, y, z, t):
	return ((x - y) / (z - y)) * t
function code(x, y, z, t)
	return Float64(Float64(Float64(x - y) / Float64(z - y)) * t)
end
function code(x, y, z, t)
	return Float64(Float64(Float64(x - y) / Float64(z - y)) * t)
end
function tmp = code(x, y, z, t)
	tmp = ((x - y) / (z - y)) * t;
end
function tmp = code(x, y, z, t)
	tmp = ((x - y) / (z - y)) * t;
end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\frac{x - y}{z - y} \cdot t
\frac{x - y}{z - y} \cdot t

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 2.2

    \[\frac{x - y}{z - y} \cdot t \]
  2. Final simplification2.2

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

Alternatives

Alternative 1
Error20.0
Cost1372
\[\begin{array}{l} t_1 := y \cdot \frac{t}{y - z}\\ t_2 := t \cdot \frac{x}{z - y}\\ \mathbf{if}\;y \leq -1.12 \cdot 10^{+165}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -1.18 \cdot 10^{+156}:\\ \;\;\;\;\frac{t}{\frac{-z}{y}}\\ \mathbf{elif}\;y \leq -1.25 \cdot 10^{+73}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 0.00305:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.35 \cdot 10^{+56}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+159}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 2
Error21.4
Cost1241
\[\begin{array}{l} \mathbf{if}\;y \leq -1.45 \cdot 10^{+165}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -1.18 \cdot 10^{+156}:\\ \;\;\;\;\frac{t}{\frac{-z}{y}}\\ \mathbf{elif}\;y \leq -7.5 \cdot 10^{+87}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 150000000000 \lor \neg \left(y \leq 9.2 \cdot 10^{+35}\right) \land y \leq 5.2 \cdot 10^{+60}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 3
Error17.6
Cost1108
\[\begin{array}{l} t_1 := t \cdot \frac{x}{z - y}\\ t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;y \leq -1 \cdot 10^{+87}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-34}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 8.2 \cdot 10^{+49}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+101}:\\ \;\;\;\;y \cdot \frac{t}{y - z}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error18.4
Cost1108
\[\begin{array}{l} t_1 := \frac{t}{\frac{z}{x - y}}\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.1 \cdot 10^{-53}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;z \leq -1.55 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -9.4 \cdot 10^{-163}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{+32}:\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error18.4
Cost1108
\[\begin{array}{l} t_1 := \frac{t}{\frac{z}{x - y}}\\ \mathbf{if}\;z \leq -5.8 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.1 \cdot 10^{-53}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;z \leq -1.65 \cdot 10^{-88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{-161}:\\ \;\;\;\;\frac{t}{\frac{y - z}{y}}\\ \mathbf{elif}\;z \leq 3.4 \cdot 10^{+32}:\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error18.4
Cost1108
\[\begin{array}{l} t_1 := \frac{t}{\frac{z}{x - y}}\\ \mathbf{if}\;z \leq -5.8 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{-53}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;z \leq -1.12 \cdot 10^{-88}:\\ \;\;\;\;\frac{y - x}{\frac{z}{-t}}\\ \mathbf{elif}\;z \leq -2.65 \cdot 10^{-161}:\\ \;\;\;\;\frac{t}{\frac{y - z}{y}}\\ \mathbf{elif}\;z \leq 3.75 \cdot 10^{+31}:\\ \;\;\;\;t - t \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error16.6
Cost976
\[\begin{array}{l} t_1 := t \cdot \frac{x}{z - y}\\ \mathbf{if}\;x \leq -2.8 \cdot 10^{+142}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{+57}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;x \leq -2.45 \cdot 10^{+39}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{elif}\;x \leq 0.00024:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error25.8
Cost848
\[\begin{array}{l} \mathbf{if}\;y \leq -1.12 \cdot 10^{+165}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -1.18 \cdot 10^{+156}:\\ \;\;\;\;t \cdot \frac{-y}{z}\\ \mathbf{elif}\;y \leq -1.3 \cdot 10^{+79}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 9
Error25.8
Cost848
\[\begin{array}{l} \mathbf{if}\;y \leq -1.12 \cdot 10^{+165}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq -1.18 \cdot 10^{+156}:\\ \;\;\;\;\frac{t}{\frac{-z}{y}}\\ \mathbf{elif}\;y \leq -5.1 \cdot 10^{+78}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 10
Error19.7
Cost844
\[\begin{array}{l} t_1 := \left(x - y\right) \cdot \frac{t}{z}\\ \mathbf{if}\;z \leq -1.15 \cdot 10^{+206}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.3 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \frac{x}{z - y}\\ \mathbf{elif}\;z \leq 1.25 \cdot 10^{+31}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error7.2
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{+236}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;y \leq 4.4 \cdot 10^{+122}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\ \mathbf{else}:\\ \;\;\;\;t \cdot \frac{y}{y - z}\\ \end{array} \]
Alternative 12
Error26.2
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -5.1 \cdot 10^{+78}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.3 \cdot 10^{-33}:\\ \;\;\;\;x \cdot \frac{t}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 13
Error25.6
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -7.5 \cdot 10^{+78}:\\ \;\;\;\;t\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-30}:\\ \;\;\;\;t \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 14
Error39.7
Cost64
\[t \]

Error

Reproduce

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