Average Error: 0.1 → 0.1
Time: 18.6s
Precision: binary64
Cost: 20288
\[ \begin{array}{c}[z, t, a] = \mathsf{sort}([z, t, a])\\ \end{array} \]
\[\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 \]
\[\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(y \cdot i + \log c \cdot \left(b + -0.5\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 x (log y) z) (+ t a)) (+ (* y i) (* (log c) (+ b -0.5)))))
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(x, log(y), z) + (t + a)) + ((y * i) + (log(c) * (b + -0.5)));
}
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 Float64(Float64(fma(x, log(y), z) + Float64(t + a)) + Float64(Float64(y * i) + Float64(log(c) * Float64(b + -0.5))))
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[(N[(N[(x * N[Log[y], $MachinePrecision] + z), $MachinePrecision] + N[(t + a), $MachinePrecision]), $MachinePrecision] + N[(N[(y * i), $MachinePrecision] + N[(N[Log[c], $MachinePrecision] * N[(b + -0.5), $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
\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(y \cdot i + \log c \cdot \left(b + -0.5\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}{\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + \left(\left(b + -0.5\right) \cdot \log c + y \cdot i\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 \]

    associate-+l+ [=>]0.1

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

    associate-+l+ [=>]0.1

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

    fma-def [=>]0.1

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

    sub-neg [=>]0.1

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

    metadata-eval [=>]0.1

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

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

Alternatives

Alternative 1
Error3.6
Cost14024
\[\begin{array}{l} t_1 := a + \left(z + t\right)\\ t_2 := \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;x \leq -1.8 \cdot 10^{+59}:\\ \;\;\;\;\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + y \cdot i\\ \mathbf{elif}\;x \leq 1.58 \cdot 10^{+153}:\\ \;\;\;\;y \cdot i + \left(t_2 + t_1\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + \left(t_1 + x \cdot \log y\right)\\ \end{array} \]
Alternative 2
Error0.1
Cost14016
\[y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log c \cdot \left(b + -0.5\right)\right) \]
Alternative 3
Error3.8
Cost13769
\[\begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{+59} \lor \neg \left(x \leq 1.25 \cdot 10^{+152}\right):\\ \;\;\;\;\left(\mathsf{fma}\left(x, \log y, z\right) + \left(t + a\right)\right) + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(z + t\right)\right)\right)\\ \end{array} \]
Alternative 4
Error3.8
Cost7625
\[\begin{array}{l} \mathbf{if}\;x \leq -3.5 \cdot 10^{+59} \lor \neg \left(x \leq 3.3 \cdot 10^{+148}\right):\\ \;\;\;\;y \cdot i + \left(\left(t + a\right) + \left(z + x \cdot \log y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(z + t\right)\right)\right)\\ \end{array} \]
Alternative 5
Error17.0
Cost7369
\[\begin{array}{l} \mathbf{if}\;x \leq -2.95 \cdot 10^{+122} \lor \neg \left(x \leq 9.5 \cdot 10^{+185}\right):\\ \;\;\;\;y \cdot i + \left(\left(t + a\right) + x \cdot \log y\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(z + \left(t + a\right)\right)\\ \end{array} \]
Alternative 6
Error12.2
Cost7232
\[y \cdot i + \left(\left(t + a\right) + \left(z + x \cdot \log y\right)\right) \]
Alternative 7
Error19.4
Cost7113
\[\begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{+120} \lor \neg \left(x \leq 2.4 \cdot 10^{+219}\right):\\ \;\;\;\;y \cdot i + x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + \left(z + \left(t + a\right)\right)\\ \end{array} \]
Alternative 8
Error23.7
Cost576
\[y \cdot i + \left(z + \left(t + a\right)\right) \]
Alternative 9
Error30.6
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -3.8 \cdot 10^{+173}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 10
Error29.2
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+48}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 11
Error36.5
Cost196
\[\begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+48}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 12
Error47.7
Cost64
\[a \]

Error

Reproduce

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