Average Error: 0.1 → 0.1
Time: 56.9s
Precision: binary64
Cost: 32832
\[ \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 \]
\[z + \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(y, i, \mathsf{fma}\left(x, \log y, 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
 (+ z (fma (+ b -0.5) (log c) (fma y i (fma x (log y) (+ 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 z + fma((b + -0.5), log(c), fma(y, i, fma(x, log(y), (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 Float64(z + fma(Float64(b + -0.5), log(c), fma(y, i, fma(x, log(y), 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[(z + N[(N[(b + -0.5), $MachinePrecision] * N[Log[c], $MachinePrecision] + N[(y * i + N[(x * N[Log[y], $MachinePrecision] + N[(t + a), $MachinePrecision]), $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
z + \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(y, i, \mathsf{fma}\left(x, \log y, 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}{z + \mathsf{fma}\left(b + -0.5, \log c, \mathsf{fma}\left(y, i, \mathsf{fma}\left(x, \log y, t + a\right)\right)\right)} \]
    Proof
    (+.f64 z (fma.f64 (+.f64 b -1/2) (log.f64 c) (fma.f64 y i (fma.f64 x (log.f64 y) (+.f64 t a))))): 0 points increase in error, 0 points decrease in error
    (+.f64 z (fma.f64 (+.f64 b (Rewrite<= metadata-eval (neg.f64 1/2))) (log.f64 c) (fma.f64 y i (fma.f64 x (log.f64 y) (+.f64 t a))))): 0 points increase in error, 0 points decrease in error
    (+.f64 z (fma.f64 (Rewrite<= sub-neg_binary64 (-.f64 b 1/2)) (log.f64 c) (fma.f64 y i (fma.f64 x (log.f64 y) (+.f64 t a))))): 0 points increase in error, 0 points decrease in error
    (+.f64 z (fma.f64 (-.f64 b 1/2) (log.f64 c) (fma.f64 y i (Rewrite<= fma-def_binary64 (+.f64 (*.f64 x (log.f64 y)) (+.f64 t a)))))): 1 points increase in error, 0 points decrease in error
    (+.f64 z (fma.f64 (-.f64 b 1/2) (log.f64 c) (Rewrite<= fma-def_binary64 (+.f64 (*.f64 y i) (+.f64 (*.f64 x (log.f64 y)) (+.f64 t a)))))): 2 points increase in error, 0 points decrease in error
    (+.f64 z (fma.f64 (-.f64 b 1/2) (log.f64 c) (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) (+.f64 t a)) (*.f64 y i))))): 0 points increase in error, 0 points decrease in error
    (+.f64 z (Rewrite<= fma-def_binary64 (+.f64 (*.f64 (-.f64 b 1/2) (log.f64 c)) (+.f64 (+.f64 (*.f64 x (log.f64 y)) (+.f64 t a)) (*.f64 y i))))): 1 points increase in error, 0 points decrease in error
    (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 z (*.f64 (-.f64 b 1/2) (log.f64 c))) (+.f64 (+.f64 (*.f64 x (log.f64 y)) (+.f64 t a)) (*.f64 y i)))): 1 points increase in error, 0 points decrease in error
    (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (-.f64 b 1/2) (log.f64 c)) z)) (+.f64 (+.f64 (*.f64 x (log.f64 y)) (+.f64 t a)) (*.f64 y i))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (+.f64 (*.f64 (-.f64 b 1/2) (log.f64 c)) z) (+.f64 (*.f64 x (log.f64 y)) (+.f64 t a))) (*.f64 y i))): 0 points increase in error, 0 points decrease in error
    (+.f64 (Rewrite<= associate-+r+_binary64 (+.f64 (*.f64 (-.f64 b 1/2) (log.f64 c)) (+.f64 z (+.f64 (*.f64 x (log.f64 y)) (+.f64 t a))))) (*.f64 y i)): 0 points increase in error, 0 points decrease in error
    (+.f64 (+.f64 (*.f64 (-.f64 b 1/2) (log.f64 c)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 z (*.f64 x (log.f64 y))) (+.f64 t a)))) (*.f64 y i)): 0 points increase in error, 0 points decrease in error
    (+.f64 (+.f64 (*.f64 (-.f64 b 1/2) (log.f64 c)) (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 x (log.f64 y)) z)) (+.f64 t a))) (*.f64 y i)): 0 points increase in error, 0 points decrease in error
    (+.f64 (+.f64 (*.f64 (-.f64 b 1/2) (log.f64 c)) (Rewrite<= associate-+l+_binary64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a))) (*.f64 y i)): 0 points increase in error, 0 points decrease in error
    (+.f64 (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (+.f64 (+.f64 (*.f64 x (log.f64 y)) z) t) a) (*.f64 (-.f64 b 1/2) (log.f64 c)))) (*.f64 y i)): 0 points increase in error, 0 points decrease in error
  3. Final simplification0.1

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

Alternatives

Alternative 1
Error0.4
Cost14152
\[\begin{array}{l} t_1 := y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + b \cdot \log c\right)\\ \mathbf{if}\;x \leq -1.5 \cdot 10^{+48}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 5 \cdot 10^{-76}:\\ \;\;\;\;z + \left(y \cdot i + \left(a + \left(t + \log c \cdot \left(b + -0.5\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error3.1
Cost14024
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ t_2 := t_1 + \left(a + \left(x \cdot \log y + \left(z + t\right)\right)\right)\\ \mathbf{if}\;x \leq -2 \cdot 10^{+53}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 7.8 \cdot 10^{+35}:\\ \;\;\;\;z + \left(y \cdot i + \left(a + \left(t + t_1\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error0.1
Cost14016
\[\left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + \log c \cdot \left(b + -0.5\right)\right) + y \cdot i \]
Alternative 4
Error7.2
Cost13896
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -3.6 \cdot 10^{+255}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq 1.02 \cdot 10^{+208}:\\ \;\;\;\;\mathsf{fma}\left(b + -0.5, \log c, \left(t + a\right) + \left(z + y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + t_1\right)\\ \end{array} \]
Alternative 5
Error7.2
Cost13512
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -3.45 \cdot 10^{+255}:\\ \;\;\;\;y \cdot i + t_1\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+208}:\\ \;\;\;\;z + \left(y \cdot i + \left(a + \left(t + \log c \cdot \left(b + -0.5\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, z + t_1\right)\\ \end{array} \]
Alternative 6
Error8.3
Cost7624
\[\begin{array}{l} t_1 := y \cdot i + x \cdot \log y\\ \mathbf{if}\;x \leq -4 \cdot 10^{+255}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 3.4 \cdot 10^{+260}:\\ \;\;\;\;z + \left(y \cdot i + \left(a + \left(t + \log c \cdot \left(b + -0.5\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error27.6
Cost7380
\[\begin{array}{l} t_1 := y \cdot i + x \cdot \log y\\ t_2 := z + b \cdot \log c\\ \mathbf{if}\;a \leq -7.8 \cdot 10^{-203}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -6.5 \cdot 10^{-282}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 6.2 \cdot 10^{-245}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 5 \cdot 10^{-206}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 2.4 \cdot 10^{+111}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 8
Error15.1
Cost7368
\[\begin{array}{l} t_1 := y \cdot i + x \cdot \log y\\ \mathbf{if}\;x \leq -3.45 \cdot 10^{+255}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.95 \cdot 10^{+208}:\\ \;\;\;\;z + \left(a + \left(t + \log c \cdot \left(b + -0.5\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error15.5
Cost7240
\[\begin{array}{l} t_1 := y \cdot i + x \cdot \log y\\ \mathbf{if}\;x \leq -1.85 \cdot 10^{+256}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 4.5 \cdot 10^{+208}:\\ \;\;\;\;z + \left(a + \log c \cdot \left(b + -0.5\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error27.7
Cost7116
\[\begin{array}{l} t_1 := z + b \cdot \log c\\ \mathbf{if}\;z \leq -5.8 \cdot 10^{+161}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -5.5 \cdot 10^{+147}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;z \leq -1.35 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, a\right)\\ \end{array} \]
Alternative 11
Error28.7
Cost6724
\[\begin{array}{l} \mathbf{if}\;z \leq -6.5 \cdot 10^{+161}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, i, a\right)\\ \end{array} \]
Alternative 12
Error29.9
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -4.3 \cdot 10^{+164}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 13
Error28.7
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -2.25 \cdot 10^{+164}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 14
Error36.1
Cost196
\[\begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{+162}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 15
Error47.1
Cost64
\[a \]

Error

Reproduce

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