Average Error: 0.1 → 0.1
Time: 29.1s
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))))): 0 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
Error2.8
Cost14024
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ t_2 := t + \left(t_1 + \left(x \cdot \log y + \left(a + z\right)\right)\right)\\ \mathbf{if}\;x \leq -1.9655785229234215 \cdot 10^{+126}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.1643881331788457 \cdot 10^{+113}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
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 3
Error5.1
Cost13764
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;x \leq -1.105709435531823 \cdot 10^{+185}:\\ \;\;\;\;t + \left(x \cdot \log y + \left(a + t_1\right)\right)\\ \mathbf{elif}\;x \leq 2.1643881331788457 \cdot 10^{+113}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(a + \mathsf{fma}\left(\log y, x, z\right)\right)\\ \end{array} \]
Alternative 4
Error4.7
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9655785229234215 \cdot 10^{+126}:\\ \;\;\;\;t + \left(a + \left(z + x \cdot \log y\right)\right)\\ \mathbf{elif}\;x \leq 2.1643881331788457 \cdot 10^{+113}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(z + \mathsf{fma}\left(\log y, x, a\right)\right)\\ \end{array} \]
Alternative 5
Error4.7
Cost13512
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9655785229234215 \cdot 10^{+126}:\\ \;\;\;\;t + \left(a + \left(z + x \cdot \log y\right)\right)\\ \mathbf{elif}\;x \leq 2.1643881331788457 \cdot 10^{+113}:\\ \;\;\;\;y \cdot i + \left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t + \left(a + \mathsf{fma}\left(\log y, x, z\right)\right)\\ \end{array} \]
Alternative 6
Error16.2
Cost7636
\[\begin{array}{l} t_1 := t + \left(a + \left(z + y \cdot i\right)\right)\\ t_2 := b \cdot \log c\\ t_3 := t + \left(a + \left(z + x \cdot \log y\right)\right)\\ \mathbf{if}\;b \leq -1.4869691206887434 \cdot 10^{+199}:\\ \;\;\;\;t + \left(z + t_2\right)\\ \mathbf{elif}\;b \leq -1.1388718399101745 \cdot 10^{+91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -1.4587257767430585 \cdot 10^{-118}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;b \leq -2.4013499241613025 \cdot 10^{-187}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 4.037077247895107 \cdot 10^{+238}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;y \cdot i + t_2\\ \end{array} \]
Alternative 7
Error15.7
Cost7636
\[\begin{array}{l} t_1 := t + \left(a + \left(z + x \cdot \log y\right)\right)\\ t_2 := t + \left(a + \left(z + y \cdot i\right)\right)\\ \mathbf{if}\;b \leq -1.4869691206887434 \cdot 10^{+199}:\\ \;\;\;\;t + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;b \leq -1.1388718399101745 \cdot 10^{+91}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq -1.4587257767430585 \cdot 10^{-118}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq -2.4013499241613025 \cdot 10^{-187}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;b \leq 1.4359776430713325 \cdot 10^{+220}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t + \left(a + \log c \cdot \left(b + -0.5\right)\right)\\ \end{array} \]
Alternative 8
Error4.7
Cost7624
\[\begin{array}{l} t_1 := t + \left(a + \left(z + x \cdot \log y\right)\right)\\ \mathbf{if}\;x \leq -1.9655785229234215 \cdot 10^{+126}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 2.1643881331788457 \cdot 10^{+113}:\\ \;\;\;\;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 9
Error17.7
Cost6984
\[\begin{array}{l} t_1 := a + x \cdot \log y\\ \mathbf{if}\;x \leq -1.105709435531823 \cdot 10^{+185}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 6.233461500385524 \cdot 10^{+201}:\\ \;\;\;\;t + \left(a + \left(z + y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error19.2
Cost6856
\[\begin{array}{l} t_1 := x \cdot \log y\\ \mathbf{if}\;x \leq -4.07294125163714 \cdot 10^{+238}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.3091907184515254 \cdot 10^{+227}:\\ \;\;\;\;t + \left(a + \left(z + y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error36.5
Cost588
\[\begin{array}{l} \mathbf{if}\;z \leq -5.163883385755962 \cdot 10^{+153}:\\ \;\;\;\;t + z\\ \mathbf{elif}\;z \leq -2.261902348277294 \cdot 10^{+96}:\\ \;\;\;\;t + a\\ \mathbf{elif}\;z \leq -5.6388400884801034 \cdot 10^{+78}:\\ \;\;\;\;t + z\\ \mathbf{else}:\\ \;\;\;\;t + a\\ \end{array} \]
Alternative 12
Error23.4
Cost576
\[t + \left(a + \left(z + y \cdot i\right)\right) \]
Alternative 13
Error27.0
Cost452
\[\begin{array}{l} \mathbf{if}\;a \leq 1.2267489858513563 \cdot 10^{+52}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;t + \left(a + z\right)\\ \end{array} \]
Alternative 14
Error27.1
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -8.017361250589995 \cdot 10^{+41}:\\ \;\;\;\;t + \left(a + z\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 15
Error31.3
Cost320
\[t + \left(a + z\right) \]
Alternative 16
Error47.1
Cost192
\[t + z \]
Alternative 17
Error62.0
Cost64
\[t \]

Error

Reproduce

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