?

Average Error: 2.1 → 2.0
Time: 21.9s
Precision: binary64
Cost: 576

?

\[\frac{x}{y} \cdot \left(z - t\right) + t \]
\[\frac{z - t}{\frac{y}{x}} + t \]
(FPCore (x y z t) :precision binary64 (+ (* (/ x y) (- z t)) t))
(FPCore (x y z t) :precision binary64 (+ (/ (- z t) (/ y x)) 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 ((z - t) / (y / x)) + 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 = ((z - t) / (y / x)) + 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 ((z - t) / (y / x)) + t;
}
def code(x, y, z, t):
	return ((x / y) * (z - t)) + t
def code(x, y, z, t):
	return ((z - t) / (y / x)) + 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(Float64(Float64(z - t) / Float64(y / x)) + t)
end
function tmp = code(x, y, z, t)
	tmp = ((x / y) * (z - t)) + t;
end
function tmp = code(x, y, z, t)
	tmp = ((z - t) / (y / x)) + 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[(N[(N[(z - t), $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision] + t), $MachinePrecision]
\frac{x}{y} \cdot \left(z - t\right) + t
\frac{z - t}{\frac{y}{x}} + t

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.1
Target2.4
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.1

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

    \[\leadsto \color{blue}{\frac{z - t}{\frac{y}{x}}} + t \]
  3. Final simplification2.0

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

Alternatives

Alternative 1
Error23.0
Cost1944
\[\begin{array}{l} t_1 := t \cdot \left(-\frac{x}{y}\right)\\ \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+96}:\\ \;\;\;\;\frac{z \cdot x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -2 \cdot 10^{+41}:\\ \;\;\;\;-\frac{t \cdot x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 0.04:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+63}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error22.8
Cost1684
\[\begin{array}{l} t_1 := t \cdot \left(-\frac{x}{y}\right)\\ \mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+163}:\\ \;\;\;\;x \cdot \frac{-t}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 0.04:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+32}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+63}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error22.8
Cost1684
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+163}:\\ \;\;\;\;x \cdot \frac{-t}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 0.04:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+32}:\\ \;\;\;\;t \cdot \left(-\frac{x}{y}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+63}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \end{array} \]
Alternative 4
Error13.8
Cost1684
\[\begin{array}{l} t_1 := x \cdot \frac{z}{y}\\ \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+96}:\\ \;\;\;\;\frac{z \cdot x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -1 \cdot 10^{+36}:\\ \;\;\;\;t \cdot \left(-\frac{x}{y}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{-5}:\\ \;\;\;\;t_1 + t\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{+32}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+63}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \end{array} \]
Alternative 5
Error23.2
Cost1424
\[\begin{array}{l} t_1 := -\frac{t \cdot x}{y}\\ \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+96}:\\ \;\;\;\;\frac{z \cdot x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq -2 \cdot 10^{+41}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq -4 \cdot 10^{-6}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x}{y} \leq 2:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error22.1
Cost840
\[\begin{array}{l} t_1 := z \cdot \frac{x}{y}\\ \mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{-37}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error22.0
Cost840
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{-6}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq 10^{-37}:\\ \;\;\;\;t\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \end{array} \]
Alternative 8
Error18.3
Cost712
\[\begin{array}{l} t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{if}\;t \leq -5.2 \cdot 10^{-207}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.28 \cdot 10^{-191}:\\ \;\;\;\;z \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error8.8
Cost712
\[\begin{array}{l} t_1 := z \cdot \frac{x}{y} + t\\ \mathbf{if}\;z \leq -1.45 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-89}:\\ \;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error27.1
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -5.6 \cdot 10^{-207}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 10^{-150}:\\ \;\;\;\;x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 11
Error2.1
Cost576
\[\frac{x}{y} \cdot \left(z - t\right) + t \]
Alternative 12
Error31.6
Cost64
\[t \]

Error

Reproduce?

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