?

Average Error: 0.1 → 0.1
Time: 27.7s
Precision: binary64
Cost: 32832

?

\[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
\[\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right) \]
(FPCore (x y z t a b c i)
 :precision binary64
 (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))
(FPCore (x y z t a b c i)
 :precision binary64
 (fma y i (fma (+ b -0.5) (log c) (+ (fma x (log y) z) (+ t a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return (((((x * log(y)) + z) + t) + a) + ((b - 0.5) * log(c))) + (y * i);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
	return fma(y, i, fma((b + -0.5), log(c), (fma(x, log(y), z) + (t + a))));
}
function code(x, y, z, t, a, b, c, i)
	return Float64(Float64(Float64(Float64(Float64(Float64(x * log(y)) + z) + t) + a) + Float64(Float64(b - 0.5) * log(c))) + Float64(y * i))
end
function code(x, y, z, t, a, b, c, i)
	return fma(y, i, fma(Float64(b + -0.5), log(c), Float64(fma(x, log(y), z) + Float64(t + a))))
end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision] + t), $MachinePrecision] + a), $MachinePrecision] + N[(N[(b - 0.5), $MachinePrecision] * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * i + N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i
\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right)

Error?

Derivation?

  1. Initial program 0.1

    \[\left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right)} \]
    Proof

    [Start]0.1

    \[ \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]

    +-commutative [=>]0.1

    \[ \color{blue}{y \cdot i + \left(\left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right)} \]

    fma-def [=>]0.1

    \[ \color{blue}{\mathsf{fma}\left(y, i, \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right) + \left(b - 0.5\right) \cdot \log c\right)} \]

    +-commutative [=>]0.1

    \[ \mathsf{fma}\left(y, i, \color{blue}{\left(b - 0.5\right) \cdot \log c + \left(\left(\left(x \cdot \log y + z\right) + t\right) + a\right)}\right) \]

    fma-def [=>]0.1

    \[ \mathsf{fma}\left(y, i, \color{blue}{\mathsf{fma}\left(b - 0.5, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)}\right) \]

    sub-neg [=>]0.1

    \[ \mathsf{fma}\left(y, i, \mathsf{fma}\left(\color{blue}{b + \left(-0.5\right)}, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) \]

    metadata-eval [=>]0.1

    \[ \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + \color{blue}{-0.5}, \log c, \left(\left(x \cdot \log y + z\right) + t\right) + a\right)\right) \]

    associate-+l+ [=>]0.1

    \[ \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \color{blue}{\left(x \cdot \log y + z\right) + \left(t + a\right)}\right)\right) \]

    fma-def [=>]0.1

    \[ \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \color{blue}{\mathsf{fma}\left(x, \log y, z\right)} + \left(t + a\right)\right)\right) \]
  3. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right)\right) \]

Alternatives

Alternative 1
Error0.1
Cost32832
\[z + \left(t + \mathsf{fma}\left(x, \log y, \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(y, i, a\right)\right)\right)\right) \]
Alternative 2
Error0.1
Cost20544
\[x \cdot \log y + \left(a + \left(t + \left(b \cdot \log c + \left(z + \left(-0.5 \cdot \log c + y \cdot i\right)\right)\right)\right)\right) \]
Alternative 3
Error0.1
Cost20288
\[\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(y \cdot i + \left(b + -0.5\right) \cdot \log c\right) \]
Alternative 4
Error3.7
Cost14152
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \left(b + -0.5\right) \cdot \log c\\ \mathbf{if}\;x \leq -3.9 \cdot 10^{+112}:\\ \;\;\;\;t_2 + \left(t_1 + \left(z + a\right)\right)\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{+79}:\\ \;\;\;\;a + \left(t + \left(b \cdot \log c + \left(z + \left(-0.5 \cdot \log c + y \cdot i\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + \left(t_1 + \left(a + \left(z + t\right)\right)\right)\\ \end{array} \]
Alternative 5
Error3.7
Cost14024
\[\begin{array}{l} t_1 := a + \left(z + t\right)\\ t_2 := x \cdot \log y\\ t_3 := \left(b + -0.5\right) \cdot \log c\\ \mathbf{if}\;x \leq -6 \cdot 10^{+111}:\\ \;\;\;\;t_3 + \left(t_2 + \left(z + a\right)\right)\\ \mathbf{elif}\;x \leq 7 \cdot 10^{+79}:\\ \;\;\;\;y \cdot i + \left(t_3 + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_3 + \left(t_2 + t_1\right)\\ \end{array} \]
Alternative 6
Error0.1
Cost14016
\[y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \left(b + -0.5\right) \cdot \log c\right) \]
Alternative 7
Error5.3
Cost13897
\[\begin{array}{l} t_1 := \left(b + -0.5\right) \cdot \log c\\ \mathbf{if}\;x \leq -7 \cdot 10^{+116} \lor \neg \left(x \leq 5.1 \cdot 10^{+79}\right):\\ \;\;\;\;t_1 + \left(x \cdot \log y + \left(z + a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(z + t\right)\right)\right)\\ \end{array} \]
Alternative 8
Error37.6
Cost7641
\[\begin{array}{l} t_1 := z + \left(t + a\right)\\ \mathbf{if}\;z \leq -1.6 \cdot 10^{+161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+142}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.26 \cdot 10^{+105} \lor \neg \left(z \leq -7.8 \cdot 10^{+41}\right) \land z \leq -1.2 \cdot 10^{-41}:\\ \;\;\;\;b \cdot \log c + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + x \cdot \log y\\ \end{array} \]
Alternative 9
Error8.0
Cost7624
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -9.2 \cdot 10^{+183}:\\ \;\;\;\;t_1 + y \cdot i\\ \mathbf{elif}\;x \leq 1.36 \cdot 10^{+129}:\\ \;\;\;\;y \cdot i + \left(\left(b + -0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z + t_1\\ \end{array} \]
Alternative 10
Error16.1
Cost7508
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := z + t_1\\ t_3 := t_1 + y \cdot i\\ \mathbf{if}\;x \leq -3.5 \cdot 10^{+121}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 1.25 \cdot 10^{+129}:\\ \;\;\;\;\left(b + -0.5\right) \cdot \log c + \left(a + \left(z + t\right)\right)\\ \mathbf{elif}\;x \leq 10^{+179}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{+206}:\\ \;\;\;\;z + b \cdot \log c\\ \mathbf{elif}\;x \leq 2.1 \cdot 10^{+236}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 11
Error18.0
Cost7496
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -8.5 \cdot 10^{+184}:\\ \;\;\;\;t_1 + y \cdot i\\ \mathbf{elif}\;x \leq 1.36 \cdot 10^{+129}:\\ \;\;\;\;y \cdot i + \left(a + \left(z + \left(b + -0.5\right) \cdot \log c\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z + t_1\\ \end{array} \]
Alternative 12
Error38.2
Cost7381
\[\begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+161}:\\ \;\;\;\;z + \left(t + a\right)\\ \mathbf{elif}\;z \leq -1.6 \cdot 10^{+142}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;z \leq -1 \cdot 10^{+105} \lor \neg \left(z \leq -5.6 \cdot 10^{+41}\right) \land z \leq -1.3 \cdot 10^{-33}:\\ \;\;\;\;z + b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;a + x \cdot \log y\\ \end{array} \]
Alternative 13
Error24.4
Cost7376
\[\begin{array}{l} t_1 := z + \left(t + a\right)\\ t_2 := x \cdot \log y\\ \mathbf{if}\;x \leq -5.8 \cdot 10^{+118}:\\ \;\;\;\;a + t_2\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{-98}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-131}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;x \leq 3.2 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + t_2\right)\\ \end{array} \]
Alternative 14
Error26.0
Cost7248
\[\begin{array}{l} t_1 := z + \left(t + a\right)\\ t_2 := x \cdot \log y\\ \mathbf{if}\;x \leq -1.08 \cdot 10^{+119}:\\ \;\;\;\;a + t_2\\ \mathbf{elif}\;x \leq -3.9 \cdot 10^{-97}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-131}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;x \leq 2.4 \cdot 10^{+85}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z + t_2\\ \end{array} \]
Alternative 15
Error27.2
Cost7120
\[\begin{array}{l} t_1 := z + \left(t + a\right)\\ t_2 := x \cdot \log y\\ \mathbf{if}\;x \leq -3.65 \cdot 10^{+121}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{-98}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -2.75 \cdot 10^{-132}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;x \leq 1.65 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 16
Error30.7
Cost7120
\[\begin{array}{l} \mathbf{if}\;a \leq 1.16 \cdot 10^{-52}:\\ \;\;\;\;z + \left(t + y \cdot i\right)\\ \mathbf{elif}\;a \leq 6 \cdot 10^{+16}:\\ \;\;\;\;z + b \cdot \log c\\ \mathbf{elif}\;a \leq 5.2 \cdot 10^{+96}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;a \leq 1.25 \cdot 10^{+102}:\\ \;\;\;\;x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + a\right)\\ \end{array} \]
Alternative 17
Error31.3
Cost6856
\[\begin{array}{l} \mathbf{if}\;a \leq 2.35 \cdot 10^{-42}:\\ \;\;\;\;z + \left(t + y \cdot i\right)\\ \mathbf{elif}\;a \leq 1.1:\\ \;\;\;\;b \cdot \log c\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{+95}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;z + \left(t + a\right)\\ \end{array} \]
Alternative 18
Error39.4
Cost717
\[\begin{array}{l} \mathbf{if}\;z \leq -1.65 \cdot 10^{+161} \lor \neg \left(z \leq -1.6 \cdot 10^{+142}\right) \land z \leq -510000000:\\ \;\;\;\;z + \left(t + a\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 19
Error41.2
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -1.4 \cdot 10^{+163}:\\ \;\;\;\;z + t\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 20
Error41.0
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 2.75 \cdot 10^{+143}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 21
Error38.1
Cost324
\[\begin{array}{l} \mathbf{if}\;a \leq 3.4 \cdot 10^{+143}:\\ \;\;\;\;z + t\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 22
Error48.3
Cost196
\[\begin{array}{l} \mathbf{if}\;a \leq 6.2 \cdot 10^{+141}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 23
Error52.5
Cost64
\[a \]

Error

Reproduce?

herbie shell --seed 2023039 
(FPCore (x y z t a b c i)
  :name "Numeric.SpecFunctions:logBeta from math-functions-0.1.5.2, B"
  :precision binary64
  (+ (+ (+ (+ (+ (* x (log y)) z) t) a) (* (- b 0.5) (log c))) (* y i)))