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

Alternatives

Alternative 1
Error0.6
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 -9.626653464519026 \cdot 10^{+82}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.615390337068071 \cdot 10^{-58}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error3.0
Cost14024
\[\begin{array}{l} t_1 := a + \left(\left(t + z\right) + x \cdot \log y\right)\\ t_2 := \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;x \leq -9.626653464519026 \cdot 10^{+82}:\\ \;\;\;\;b \cdot \log c + t_1\\ \mathbf{elif}\;x \leq 2.389613228204467 \cdot 10^{+104}:\\ \;\;\;\;y \cdot i + \left(t_2 + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 + t_1\\ \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
Error6.8
Cost13904
\[\begin{array}{l} t_1 := y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(t + z\right)\right)\right)\\ t_2 := t + \left(a + \mathsf{fma}\left(y, i, x \cdot \log y\right)\right)\\ \mathbf{if}\;x \leq -7.947809913489293 \cdot 10^{+242}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -4.0958315993119135 \cdot 10^{+134}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.0280128387033168 \cdot 10^{+116}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.707125799685517 \cdot 10^{+200}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error3.0
Cost13896
\[\begin{array}{l} t_1 := b \cdot \log c + \left(a + \left(\left(t + z\right) + x \cdot \log y\right)\right)\\ \mathbf{if}\;x \leq -9.626653464519026 \cdot 10^{+82}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.389613228204467 \cdot 10^{+104}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error7.0
Cost13512
\[\begin{array}{l} t_1 := b \cdot \log c + x \cdot \log y\\ \mathbf{if}\;x \leq -3.409692592812855 \cdot 10^{+226}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9.994399164717872 \cdot 10^{+206}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error18.3
Cost7764
\[\begin{array}{l} t_1 := b \cdot \log c + \left(a + z\right)\\ t_2 := t + x \cdot \log y\\ t_3 := \log c \cdot \left(b + -0.5\right) + \left(a + y \cdot i\right)\\ \mathbf{if}\;x \leq -7.947809913489293 \cdot 10^{+242}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -1.0515215564907144 \cdot 10^{-99}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -1.5246332859511715 \cdot 10^{-188}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 3.43613935800266 \cdot 10^{-122}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.0024765253530389 \cdot 10^{-10}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 9.994399164717872 \cdot 10^{+206}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error16.4
Cost7632
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ t_2 := t_1 + \left(t + \left(a + z\right)\right)\\ t_3 := t + x \cdot \log y\\ \mathbf{if}\;x \leq -7.947809913489293 \cdot 10^{+242}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 3.43613935800266 \cdot 10^{-122}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.0024765253530389 \cdot 10^{-10}:\\ \;\;\;\;t_1 + \left(a + y \cdot i\right)\\ \mathbf{elif}\;x \leq 9.994399164717872 \cdot 10^{+206}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 9
Error16.4
Cost7632
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ t_2 := t_1 + \left(t + \left(a + z\right)\right)\\ t_3 := t + x \cdot \log y\\ \mathbf{if}\;x \leq -7.947809913489293 \cdot 10^{+242}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 3.43613935800266 \cdot 10^{-122}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 1.0024765253530389 \cdot 10^{-10}:\\ \;\;\;\;t + \left(t_1 + \left(a + y \cdot i\right)\right)\\ \mathbf{elif}\;x \leq 9.994399164717872 \cdot 10^{+206}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 10
Error7.7
Cost7624
\[\begin{array}{l} t_1 := t + x \cdot \log y\\ \mathbf{if}\;x \leq -7.947809913489293 \cdot 10^{+242}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9.994399164717872 \cdot 10^{+206}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error29.6
Cost7116
\[\begin{array}{l} t_1 := z + b \cdot \log c\\ \mathbf{if}\;a \leq 1.0795203674151649 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 4.699468997463241 \cdot 10^{+106}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \leq 1.0299535455039524 \cdot 10^{+168}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t + a\\ \end{array} \]
Alternative 12
Error27.1
Cost7116
\[\begin{array}{l} t_1 := b \cdot \log c\\ t_2 := a + t_1\\ \mathbf{if}\;z \leq -3.1585793044714585 \cdot 10^{+69}:\\ \;\;\;\;z + t_1\\ \mathbf{elif}\;z \leq -32297.083735601722:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.2697547755280926 \cdot 10^{-24}:\\ \;\;\;\;t + x \cdot \log y\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 13
Error17.2
Cost7112
\[\begin{array}{l} t_1 := t + x \cdot \log y\\ \mathbf{if}\;x \leq -7.947809913489293 \cdot 10^{+242}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 9.994399164717872 \cdot 10^{+206}:\\ \;\;\;\;b \cdot \log c + \left(a + z\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error37.5
Cost6856
\[\begin{array}{l} \mathbf{if}\;a \leq 5.917498559326509 \cdot 10^{-137}:\\ \;\;\;\;t + z\\ \mathbf{elif}\;a \leq 32324092.841240063:\\ \;\;\;\;b \cdot \log c\\ \mathbf{elif}\;a \leq 5.50031961032704 \cdot 10^{+24}:\\ \;\;\;\;z\\ \mathbf{elif}\;a \leq 1.4033182990312824 \cdot 10^{+113}:\\ \;\;\;\;t + a\\ \mathbf{elif}\;a \leq 3.185477249829917 \cdot 10^{+149}:\\ \;\;\;\;t + z\\ \mathbf{else}:\\ \;\;\;\;t + a\\ \end{array} \]
Alternative 15
Error26.4
Cost6852
\[\begin{array}{l} t_1 := b \cdot \log c\\ \mathbf{if}\;z \leq -3.1585793044714585 \cdot 10^{+69}:\\ \;\;\;\;z + t_1\\ \mathbf{else}:\\ \;\;\;\;a + t_1\\ \end{array} \]
Alternative 16
Error37.1
Cost588
\[\begin{array}{l} \mathbf{if}\;a \leq 5.50031961032704 \cdot 10^{+24}:\\ \;\;\;\;t + z\\ \mathbf{elif}\;a \leq 1.4033182990312824 \cdot 10^{+113}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \leq 3.185477249829917 \cdot 10^{+149}:\\ \;\;\;\;t + z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 17
Error36.8
Cost588
\[\begin{array}{l} \mathbf{if}\;a \leq 5.50031961032704 \cdot 10^{+24}:\\ \;\;\;\;t + z\\ \mathbf{elif}\;a \leq 1.4033182990312824 \cdot 10^{+113}:\\ \;\;\;\;t + a\\ \mathbf{elif}\;a \leq 3.185477249829917 \cdot 10^{+149}:\\ \;\;\;\;t + z\\ \mathbf{else}:\\ \;\;\;\;t + a\\ \end{array} \]
Alternative 18
Error37.3
Cost460
\[\begin{array}{l} \mathbf{if}\;a \leq 5.50031961032704 \cdot 10^{+24}:\\ \;\;\;\;z\\ \mathbf{elif}\;a \leq 1.4033182990312824 \cdot 10^{+113}:\\ \;\;\;\;a\\ \mathbf{elif}\;a \leq 3.185477249829917 \cdot 10^{+149}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 19
Error47.3
Cost64
\[a \]

Error

Reproduce

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