Average Error: 2.3 → 2.3
Time: 8.6s
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.3
Target2.4
Herbie2.3
\[\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.3

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

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

Alternatives

Alternative 1
Error23.5
Cost1684
\[\begin{array}{l} t_1 := x \cdot \frac{-t}{y}\\ t_2 := \frac{z}{\frac{y}{x}}\\ \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-12}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-121}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 4 \cdot 10^{+29}:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+89}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+130}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error23.2
Cost1684
\[\begin{array}{l} t_1 := \frac{z}{\frac{y}{x}}\\ \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-121}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 10000000:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+89}:\\ \;\;\;\;t \cdot \frac{x}{-y}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+130}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{-t}{y}\\ \end{array} \]
Alternative 3
Error23.3
Cost1684
\[\begin{array}{l} t_1 := \frac{z}{\frac{y}{x}}\\ \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-121}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 10000000:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+89}:\\ \;\;\;\;t \cdot \frac{x}{-y}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+218}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{-t}}\\ \end{array} \]
Alternative 4
Error23.3
Cost1684
\[\begin{array}{l} t_1 := \frac{z}{\frac{y}{x}}\\ \mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{-12}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 2 \cdot 10^{-121}:\\ \;\;\;\;t\\ \mathbf{elif}\;\frac{x}{y} \leq 10000000:\\ \;\;\;\;\frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+89}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+218}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{-t}}\\ \end{array} \]
Alternative 5
Error12.1
Cost1164
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq 10000000:\\ \;\;\;\;t + \frac{x}{y} \cdot z\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+89}:\\ \;\;\;\;\frac{-t}{\frac{y}{x}}\\ \mathbf{elif}\;\frac{x}{y} \leq 5 \cdot 10^{+218}:\\ \;\;\;\;\frac{z}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{-t}}\\ \end{array} \]
Alternative 6
Error4.6
Cost968
\[\begin{array}{l} t_1 := \frac{x}{\frac{y}{z - t}}\\ \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;\frac{x}{y} \leq 100000:\\ \;\;\;\;t + \frac{x}{y} \cdot z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error4.8
Cost968
\[\begin{array}{l} \mathbf{if}\;\frac{x}{y} \leq -1 \cdot 10^{+24}:\\ \;\;\;\;\frac{x}{\frac{y}{z - t}}\\ \mathbf{elif}\;\frac{x}{y} \leq 50000000000000:\\ \;\;\;\;t + \frac{x}{y} \cdot z\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \left(z - t\right)}{y}\\ \end{array} \]
Alternative 8
Error27.1
Cost848
\[\begin{array}{l} t_1 := \frac{x}{y} \cdot z\\ \mathbf{if}\;t \leq -1.8 \cdot 10^{-81}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq -5.4 \cdot 10^{-152}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -1.3 \cdot 10^{-169}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 20000000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 9
Error27.1
Cost848
\[\begin{array}{l} t_1 := \frac{z}{\frac{y}{x}}\\ \mathbf{if}\;t \leq -2.65 \cdot 10^{-83}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq -5.4 \cdot 10^{-152}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -9 \cdot 10^{-170}:\\ \;\;\;\;t\\ \mathbf{elif}\;t \leq 22500000000:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t\\ \end{array} \]
Alternative 10
Error8.9
Cost712
\[\begin{array}{l} t_1 := t + \frac{x}{y} \cdot z\\ \mathbf{if}\;z \leq -1.38 \cdot 10^{-177}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 8.5 \cdot 10^{-99}:\\ \;\;\;\;t - x \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error8.2
Cost712
\[\begin{array}{l} t_1 := t + \frac{x}{y} \cdot z\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{-83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 9 \cdot 10^{-101}:\\ \;\;\;\;t - \frac{t}{\frac{y}{x}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error32.1
Cost64
\[t \]

Error

Reproduce

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