Average Error: 1.9 → 1.9
Time: 9.9s
Precision: binary64
Cost: 960
\[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
\[\left(z \cdot a\right) \cdot b + \left(t \cdot a + \left(x + y \cdot z\right)\right) \]
(FPCore (x y z t a b)
 :precision binary64
 (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))
(FPCore (x y z t a b)
 :precision binary64
 (+ (* (* z a) b) (+ (* t a) (+ x (* y z)))))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
double code(double x, double y, double z, double t, double a, double b) {
	return ((z * a) * b) + ((t * a) + (x + (y * z)));
}
real(8) function code(x, y, z, t, a, b)
    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
    real(8), intent (in) :: b
    code = ((x + (y * z)) + (t * a)) + ((a * z) * b)
end function
real(8) function code(x, y, z, t, a, b)
    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
    real(8), intent (in) :: b
    code = ((z * a) * b) + ((t * a) + (x + (y * z)))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((x + (y * z)) + (t * a)) + ((a * z) * b);
}
public static double code(double x, double y, double z, double t, double a, double b) {
	return ((z * a) * b) + ((t * a) + (x + (y * z)));
}
def code(x, y, z, t, a, b):
	return ((x + (y * z)) + (t * a)) + ((a * z) * b)
def code(x, y, z, t, a, b):
	return ((z * a) * b) + ((t * a) + (x + (y * z)))
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x + Float64(y * z)) + Float64(t * a)) + Float64(Float64(a * z) * b))
end
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(z * a) * b) + Float64(Float64(t * a) + Float64(x + Float64(y * z))))
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((x + (y * z)) + (t * a)) + ((a * z) * b);
end
function tmp = code(x, y, z, t, a, b)
	tmp = ((z * a) * b) + ((t * a) + (x + (y * z)));
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision] + N[(t * a), $MachinePrecision]), $MachinePrecision] + N[(N[(a * z), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(z * a), $MachinePrecision] * b), $MachinePrecision] + N[(N[(t * a), $MachinePrecision] + N[(x + N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b
\left(z \cdot a\right) \cdot b + \left(t \cdot a + \left(x + y \cdot z\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original1.9
Target0.3
Herbie1.9
\[\begin{array}{l} \mathbf{if}\;z < -11820553527347888000:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \mathbf{elif}\;z < 4.7589743188364287 \cdot 10^{-122}:\\ \;\;\;\;\left(b \cdot z + t\right) \cdot a + \left(z \cdot y + x\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(b \cdot a + y\right) + \left(x + t \cdot a\right)\\ \end{array} \]

Derivation

  1. Initial program 1.9

    \[\left(\left(x + y \cdot z\right) + t \cdot a\right) + \left(a \cdot z\right) \cdot b \]
  2. Final simplification1.9

    \[\leadsto \left(z \cdot a\right) \cdot b + \left(t \cdot a + \left(x + y \cdot z\right)\right) \]

Alternatives

Alternative 1
Error21.4
Cost1640
\[\begin{array}{l} t_1 := x + y \cdot z\\ t_2 := a \cdot \left(t + z \cdot b\right)\\ t_3 := x + t \cdot a\\ \mathbf{if}\;a \leq -8.2 \cdot 10^{+96}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -3.1 \cdot 10^{+75}:\\ \;\;\;\;x + a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;a \leq -4.3 \cdot 10^{+48}:\\ \;\;\;\;t \cdot a + y \cdot z\\ \mathbf{elif}\;a \leq -1.15 \cdot 10^{+30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -8.2 \cdot 10^{-13}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -4.1 \cdot 10^{-55}:\\ \;\;\;\;z \cdot \left(y + a \cdot b\right)\\ \mathbf{elif}\;a \leq -4.5 \cdot 10^{-81}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 4.5 \cdot 10^{-119}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 4 \cdot 10^{-78}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 2.4 \cdot 10^{+43}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 2
Error7.7
Cost1232
\[\begin{array}{l} t_1 := t \cdot a + \left(x + y \cdot z\right)\\ \mathbf{if}\;y \leq -3.05 \cdot 10^{-74}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.2 \cdot 10^{-105}:\\ \;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\ \mathbf{elif}\;y \leq -3.25 \cdot 10^{-136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-74}:\\ \;\;\;\;t \cdot a + \left(x + a \cdot \left(z \cdot b\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error7.2
Cost1232
\[\begin{array}{l} t_1 := t \cdot a + \left(x + y \cdot z\right)\\ \mathbf{if}\;y \leq -3.8 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -1.45 \cdot 10^{-104}:\\ \;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\ \mathbf{elif}\;y \leq -3.7 \cdot 10^{-134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{-73}:\\ \;\;\;\;\left(z \cdot a\right) \cdot b + \left(x + t \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error7.7
Cost1104
\[\begin{array}{l} t_1 := t \cdot a + \left(x + y \cdot z\right)\\ \mathbf{if}\;y \leq -4.2 \cdot 10^{-75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -9.5 \cdot 10^{-106}:\\ \;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\ \mathbf{elif}\;y \leq -5 \cdot 10^{-136}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{-73}:\\ \;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error2.4
Cost1092
\[\begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+84}:\\ \;\;\;\;x + z \cdot \left(y + a \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\left(a \cdot \left(z \cdot b\right) + t \cdot a\right) + \left(x + y \cdot z\right)\\ \end{array} \]
Alternative 6
Error24.6
Cost848
\[\begin{array}{l} t_1 := x + t \cdot a\\ \mathbf{if}\;z \leq -2.4 \cdot 10^{+130}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{+88}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -6.4 \cdot 10^{+50}:\\ \;\;\;\;y \cdot z\\ \mathbf{elif}\;z \leq 2.9 \cdot 10^{+74}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;y \cdot z\\ \end{array} \]
Alternative 7
Error20.5
Cost848
\[\begin{array}{l} t_1 := x + y \cdot z\\ t_2 := x + t \cdot a\\ \mathbf{if}\;t \leq -1 \cdot 10^{+24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 4 \cdot 10^{-16}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 7.2 \cdot 10^{-6}:\\ \;\;\;\;a \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;t \leq 9 \cdot 10^{+115}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error20.7
Cost848
\[\begin{array}{l} t_1 := x + y \cdot z\\ t_2 := x + t \cdot a\\ \mathbf{if}\;t \leq -9.8 \cdot 10^{+23}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 7.8 \cdot 10^{-39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.3:\\ \;\;\;\;a \cdot \left(t + z \cdot b\right)\\ \mathbf{elif}\;t \leq 4.8 \cdot 10^{+117}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error14.3
Cost840
\[\begin{array}{l} t_1 := x + y \cdot z\\ \mathbf{if}\;y \leq -4.2 \cdot 10^{+146}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.15 \cdot 10^{-73}:\\ \;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error9.7
Cost840
\[\begin{array}{l} t_1 := x + z \cdot \left(y + a \cdot b\right)\\ \mathbf{if}\;z \leq -5 \cdot 10^{-74}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{-159}:\\ \;\;\;\;x + a \cdot \left(t + z \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error33.7
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{+35}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4 \cdot 10^{-114}:\\ \;\;\;\;t \cdot a\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 12
Error33.2
Cost456
\[\begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{+49}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.4 \cdot 10^{-87}:\\ \;\;\;\;y \cdot z\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 13
Error39.9
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022331 
(FPCore (x y z t a b)
  :name "Graphics.Rasterific.CubicBezier:cachedBezierAt from Rasterific-0.6.1"
  :precision binary64

  :herbie-target
  (if (< z -11820553527347888000.0) (+ (* z (+ (* b a) y)) (+ x (* t a))) (if (< z 4.7589743188364287e-122) (+ (* (+ (* b z) t) a) (+ (* z y) x)) (+ (* z (+ (* b a) y)) (+ x (* t a)))))

  (+ (+ (+ x (* y z)) (* t a)) (* (* a z) b)))