?

Average Error: 2.0 → 0.2
Time: 16.6s
Precision: binary64
Cost: 832

?

\[x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}} \]
\[x + a \cdot \frac{z - y}{\left(t - z\right) + 1} \]
(FPCore (x y z t a)
 :precision binary64
 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
(FPCore (x y z t a)
 :precision binary64
 (+ x (* a (/ (- z y) (+ (- t z) 1.0)))))
double code(double x, double y, double z, double t, double a) {
	return x - ((y - z) / (((t - z) + 1.0) / a));
}
double code(double x, double y, double z, double t, double a) {
	return x + (a * ((z - y) / ((t - z) + 1.0)));
}
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
real(8) function code(x, y, z, t, a)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    code = x + (a * ((z - y) / ((t - z) + 1.0d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
	return x - ((y - z) / (((t - z) + 1.0) / a));
}
public static double code(double x, double y, double z, double t, double a) {
	return x + (a * ((z - y) / ((t - z) + 1.0)));
}
def code(x, y, z, t, a):
	return x - ((y - z) / (((t - z) + 1.0) / a))
def code(x, y, z, t, a):
	return x + (a * ((z - y) / ((t - z) + 1.0)))
function code(x, y, z, t, a)
	return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)))
end
function code(x, y, z, t, a)
	return Float64(x + Float64(a * Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0))))
end
function tmp = code(x, y, z, t, a)
	tmp = x - ((y - z) / (((t - z) + 1.0) / a));
end
function tmp = code(x, y, z, t, a)
	tmp = x + (a * ((z - y) / ((t - z) + 1.0)));
end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
x + a \cdot \frac{z - y}{\left(t - z\right) + 1}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original2.0
Target0.2
Herbie0.2
\[x - \frac{y - z}{\left(t - z\right) + 1} \cdot a \]

Derivation?

  1. Initial program 2.0

    \[x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}} \]
  2. Simplified0.2

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

    [Start]2.0

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

    associate-/r/ [=>]0.2

    \[ x - \color{blue}{\frac{y - z}{\left(t - z\right) + 1} \cdot a} \]
  3. Final simplification0.2

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

Alternatives

Alternative 1
Error7.8
Cost1628
\[\begin{array}{l} t_1 := \left(t - z\right) + 1\\ t_2 := x + \frac{a}{\frac{t_1}{z}}\\ t_3 := x - \frac{a}{\frac{t_1}{y}}\\ \mathbf{if}\;y \leq -3.6 \cdot 10^{+96}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y \leq -2400000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.1 \cdot 10^{-42}:\\ \;\;\;\;x - \frac{y - z}{\frac{t + 1}{a}}\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-158}:\\ \;\;\;\;x + a \cdot \frac{z - y}{1 - z}\\ \mathbf{elif}\;y \leq 1.85 \cdot 10^{-14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+78}:\\ \;\;\;\;x - \frac{a}{\frac{t + 1}{y}}\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+124}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Error18.9
Cost1236
\[\begin{array}{l} \mathbf{if}\;z \leq -6.8 \cdot 10^{+34}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq -1.06 \cdot 10^{-186}:\\ \;\;\;\;x - y \cdot \frac{a}{t}\\ \mathbf{elif}\;z \leq 2.35 \cdot 10^{-279}:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 2.55 \cdot 10^{-24}:\\ \;\;\;\;x - \frac{y \cdot a}{t}\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+181}:\\ \;\;\;\;x - y \cdot \frac{a}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]
Alternative 3
Error15.9
Cost1236
\[\begin{array}{l} t_1 := x - \left(a - y \cdot \frac{a}{z}\right)\\ \mathbf{if}\;z \leq -8500:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.9 \cdot 10^{-187}:\\ \;\;\;\;x - y \cdot \frac{a}{t}\\ \mathbf{elif}\;z \leq 8 \cdot 10^{-281}:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 1.62 \cdot 10^{-21}:\\ \;\;\;\;x - \frac{y \cdot a}{t}\\ \mathbf{elif}\;z \leq 33500000000:\\ \;\;\;\;x - y \cdot \frac{a}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error15.8
Cost1236
\[\begin{array}{l} t_1 := x - \left(a - y \cdot \frac{a}{z}\right)\\ \mathbf{if}\;z \leq -1450:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.2 \cdot 10^{-188}:\\ \;\;\;\;x + \frac{-1}{\frac{\frac{t}{y}}{a}}\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{-277}:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{-22}:\\ \;\;\;\;x - \frac{y \cdot a}{t}\\ \mathbf{elif}\;z \leq 16500000000:\\ \;\;\;\;x - y \cdot \frac{a}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error15.8
Cost1236
\[\begin{array}{l} t_1 := x - \left(a - y \cdot \frac{a}{z}\right)\\ \mathbf{if}\;z \leq -480000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-189}:\\ \;\;\;\;x - \frac{a}{\frac{t}{y - z}}\\ \mathbf{elif}\;z \leq 3.7 \cdot 10^{-280}:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 6.3 \cdot 10^{-24}:\\ \;\;\;\;x - \frac{y \cdot a}{t}\\ \mathbf{elif}\;z \leq 1400000000000:\\ \;\;\;\;x - y \cdot \frac{a}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error18.6
Cost1108
\[\begin{array}{l} t_1 := x - y \cdot \frac{a}{t}\\ \mathbf{if}\;z \leq -3.3 \cdot 10^{+35}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{-187}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 3.9 \cdot 10^{-279}:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{-21}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+181}:\\ \;\;\;\;x + y \cdot \frac{a}{z}\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]
Alternative 7
Error18.6
Cost1108
\[\begin{array}{l} \mathbf{if}\;z \leq -1.45 \cdot 10^{+35}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq -7 \cdot 10^{-187}:\\ \;\;\;\;x - y \cdot \frac{a}{t}\\ \mathbf{elif}\;z \leq 1.85 \cdot 10^{-278}:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 6.8 \cdot 10^{-21}:\\ \;\;\;\;x - \frac{y}{\frac{t}{a}}\\ \mathbf{elif}\;z \leq 1.95 \cdot 10^{+181}:\\ \;\;\;\;x + y \cdot \frac{a}{z}\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]
Alternative 8
Error19.1
Cost1108
\[\begin{array}{l} \mathbf{if}\;z \leq -1.36 \cdot 10^{+35}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{-187}:\\ \;\;\;\;x - y \cdot \frac{a}{t}\\ \mathbf{elif}\;z \leq 4.8 \cdot 10^{-280}:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 0.34:\\ \;\;\;\;x - \frac{y \cdot a}{t}\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{+181}:\\ \;\;\;\;x + y \cdot \frac{a}{z}\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]
Alternative 9
Error6.7
Cost969
\[\begin{array}{l} \mathbf{if}\;t \leq -190000000000 \lor \neg \left(t \leq 5.6 \cdot 10^{+130}\right):\\ \;\;\;\;x - \frac{a}{\frac{t}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{a}{1 - z} \cdot \left(z - y\right)\\ \end{array} \]
Alternative 10
Error5.9
Cost969
\[\begin{array}{l} \mathbf{if}\;t \leq -170000000 \lor \neg \left(t \leq 5.8 \cdot 10^{+130}\right):\\ \;\;\;\;x - \frac{a}{\frac{t}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;x + a \cdot \frac{z - y}{1 - z}\\ \end{array} \]
Alternative 11
Error5.4
Cost969
\[\begin{array}{l} \mathbf{if}\;z \leq -32000 \lor \neg \left(z \leq 2.05 \cdot 10^{-20}\right):\\ \;\;\;\;x + a \cdot \frac{z - y}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y - z}{\frac{t + 1}{a}}\\ \end{array} \]
Alternative 12
Error18.2
Cost844
\[\begin{array}{l} \mathbf{if}\;z \leq -1.1 \cdot 10^{+47}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq 90000:\\ \;\;\;\;x - y \cdot a\\ \mathbf{elif}\;z \leq 2.05 \cdot 10^{+181}:\\ \;\;\;\;x + y \cdot \frac{a}{z}\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]
Alternative 13
Error7.5
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -480000 \lor \neg \left(z \leq 2.7\right):\\ \;\;\;\;x - \left(a - y \cdot \frac{a}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{a}{\frac{t + 1}{y}}\\ \end{array} \]
Alternative 14
Error17.4
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -1.1 \cdot 10^{+47}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq 2:\\ \;\;\;\;x - y \cdot a\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]
Alternative 15
Error19.5
Cost456
\[\begin{array}{l} \mathbf{if}\;z \leq -4.2 \cdot 10^{+47}:\\ \;\;\;\;x - a\\ \mathbf{elif}\;z \leq 0.00017:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x - a\\ \end{array} \]
Alternative 16
Error27.6
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023039 
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (- x (* (/ (- y z) (+ (- t z) 1.0)) a))

  (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))