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

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.0
Target2.2
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;z < 2.759456554562692 \cdot 10^{-282}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \mathbf{elif}\;z < 2.326994450874436 \cdot 10^{-110}:\\ \;\;\;\;x \cdot \frac{z - t}{y} + t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(z - t\right) + t\\ \end{array} \]

Derivation

  1. Initial program 2.0

    \[\frac{x}{y} \cdot \left(z - t\right) + t \]
  2. Final simplification2.0

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

Alternatives

Alternative 1
Error18.3
Cost1504
\[\begin{array}{l} t_1 := x \cdot \frac{z}{y}\\ t_2 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;t \leq -2.1791262314219184 \cdot 10^{-110}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -3.481118729392959 \cdot 10^{-161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.3681274860947253 \cdot 10^{-199}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.4934893572212957 \cdot 10^{-238}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{elif}\;t \leq 1.8430195711356358 \cdot 10^{-178}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 4.038765515434759 \cdot 10^{-150}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.4316014053522465 \cdot 10^{-95}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 3.0160574232020522 \cdot 10^{-83}:\\ \;\;\;\;\frac{x}{\frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Error18.3
Cost1504
\[\begin{array}{l} t_1 := x \cdot \frac{z}{y}\\ t_2 := t - \frac{t}{\frac{y}{x}}\\ t_3 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;t \leq -2.1791262314219184 \cdot 10^{-110}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq -3.481118729392959 \cdot 10^{-161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.3681274860947253 \cdot 10^{-199}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 1.4934893572212957 \cdot 10^{-238}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{elif}\;t \leq 1.8430195711356358 \cdot 10^{-178}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 4.038765515434759 \cdot 10^{-150}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.4316014053522465 \cdot 10^{-95}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 3.0160574232020522 \cdot 10^{-83}:\\ \;\;\;\;\frac{x}{\frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error27.4
Cost1376
\[\begin{array}{l} t_1 := x \cdot \frac{z}{y}\\ \mathbf{if}\;t \leq -2.1791262314219184 \cdot 10^{-110}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq -5.7053288956628074 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.3681274860947253 \cdot 10^{-199}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 1.4934893572212957 \cdot 10^{-238}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{elif}\;t \leq 1.8430195711356358 \cdot 10^{-178}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 4.038765515434759 \cdot 10^{-150}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 5.570711643575276 \cdot 10^{-106}:\\ \;\;\;\;\left(-x\right) \cdot \frac{t}{y}\\ \mathbf{elif}\;t \leq 3.0160574232020522 \cdot 10^{-83}:\\ \;\;\;\;\frac{x}{\frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 4
Error22.0
Cost1360
\[\begin{array}{l} t_1 := t \cdot \left(-\frac{x}{y}\right)\\ \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq -5 \cdot 10^{+52}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq -10000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{-10}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \end{array} \]
Alternative 5
Error26.9
Cost1112
\[\begin{array}{l} t_1 := \frac{x}{\frac{y}{z}}\\ \mathbf{if}\;t \leq -2.1791262314219184 \cdot 10^{-110}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq -5.7053288956628074 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.3681274860947253 \cdot 10^{-199}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 1.4934893572212957 \cdot 10^{-238}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.8430195711356358 \cdot 10^{-178}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 3.0160574232020522 \cdot 10^{-83}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 6
Error26.9
Cost1112
\[\begin{array}{l} t_1 := \frac{x}{\frac{y}{z}}\\ \mathbf{if}\;t \leq -2.1791262314219184 \cdot 10^{-110}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq -5.7053288956628074 \cdot 10^{-182}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -2.3681274860947253 \cdot 10^{-199}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 1.4934893572212957 \cdot 10^{-238}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{elif}\;t \leq 1.8430195711356358 \cdot 10^{-178}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 3.0160574232020522 \cdot 10^{-83}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 7
Error26.9
Cost1112
\[\begin{array}{l} \mathbf{if}\;t \leq -2.1791262314219184 \cdot 10^{-110}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq -5.7053288956628074 \cdot 10^{-182}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{elif}\;t \leq -2.3681274860947253 \cdot 10^{-199}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 1.4934893572212957 \cdot 10^{-238}:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{elif}\;t \leq 1.8430195711356358 \cdot 10^{-178}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 3.0160574232020522 \cdot 10^{-83}:\\ \;\;\;\;\frac{x}{\frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 8
Error14.6
Cost968
\[\begin{array}{l} t_1 := \frac{x \cdot \left(z - t\right)}{y}\\ \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{-10}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error12.6
Cost968
\[\begin{array}{l} t_1 := \frac{x}{y} \cdot \left(z - t\right)\\ \mathbf{if}\;\frac{x}{y} \leq -50000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{-10}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error4.5
Cost968
\[\begin{array}{l} t_1 := \frac{x}{y} \cdot \left(z - t\right)\\ \mathbf{if}\;\frac{x}{y} \leq -10000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{-10}:\\ \;\;\;\;t + \frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error22.5
Cost840
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -50000:\\ \;\;\;\;\frac{x \cdot z}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{-10}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \end{array} \]
Alternative 12
Error1.9
Cost576
\[t + \frac{z - t}{\frac{y}{x}} \]
Alternative 13
Error31.5
Cost64
\[t \]

Error

Reproduce

herbie shell --seed 2022308 
(FPCore (x y z t)
  :name "Numeric.Signal.Multichannel:$cget from hsignal-0.2.7.1"
  :precision binary64

  :herbie-target
  (if (< z 2.759456554562692e-282) (+ (* (/ x y) (- z t)) t) (if (< z 2.326994450874436e-110) (+ (* x (/ (- z t) y)) t) (+ (* (/ x y) (- z t)) t)))

  (+ (* (/ x y) (- z t)) t))