Average Error: 0.1 → 0.1
Time: 36.8s
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))))): 0 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
Error27.8
Cost74856
\[\begin{array}{l} t_1 := z + y \cdot i\\ t_2 := t + \left(a + x \cdot \log y\right)\\ t_3 := \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;t_3 \leq -5 \cdot 10^{+221}:\\ \;\;\;\;t + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;t_3 \leq -5 \cdot 10^{+70}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_3 \leq -2 \cdot 10^{+28}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_3 \leq -321:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_3 \leq -170:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_3 \leq -50:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_3 \leq -35:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_3 \leq 75:\\ \;\;\;\;a + z\\ \mathbf{elif}\;t_3 \leq 133:\\ \;\;\;\;a + y \cdot i\\ \mathbf{elif}\;t_3 \leq 5 \cdot 10^{+126}:\\ \;\;\;\;a + z\\ \mathbf{else}:\\ \;\;\;\;t + \left(a + t_3\right)\\ \end{array} \]
Alternative 2
Error7.8
Cost14032
\[\begin{array}{l} t_1 := x \cdot \log y\\ t_2 := \log c \cdot \left(b + -0.5\right)\\ t_3 := y \cdot i + \left(t_2 + \left(a + \left(t + z\right)\right)\right)\\ t_4 := t + \left(t_2 + t_1\right)\\ \mathbf{if}\;x \leq -5.456036629316537 \cdot 10^{+139}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;x \leq 7.589606249920696 \cdot 10^{+150}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x \leq 3.185701464273387 \cdot 10^{+165}:\\ \;\;\;\;t + \left(a + t_1\right)\\ \mathbf{elif}\;x \leq 1.516158918711752 \cdot 10^{+202}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 3
Error2.9
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 -5.456036629316537 \cdot 10^{+139}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 2.0667689566171554 \cdot 10^{+59}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error0.1
Cost14016
\[\left(\log c \cdot \left(b + -0.5\right) + \left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right)\right) + y \cdot i \]
Alternative 5
Error6.6
Cost13896
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ t_2 := t + \left(x \cdot \log y + \left(z + t_1\right)\right)\\ \mathbf{if}\;x \leq -5.456036629316537 \cdot 10^{+139}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 3.2809580709008113 \cdot 10^{+75}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error5.5
Cost13896
\[\begin{array}{l} t_1 := \log c \cdot \left(b + -0.5\right)\\ t_2 := t + \left(a + \left(t_1 + x \cdot \log y\right)\right)\\ \mathbf{if}\;x \leq -5.456036629316537 \cdot 10^{+139}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 7.589606249920696 \cdot 10^{+150}:\\ \;\;\;\;y \cdot i + \left(t_1 + \left(a + \left(t + z\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error1.4
Cost13888
\[y \cdot i + \left(\left(a + \left(t + \left(z + x \cdot \log y\right)\right)\right) + b \cdot \log c\right) \]
Alternative 8
Error26.1
Cost7772
\[\begin{array}{l} t_1 := z + y \cdot i\\ t_2 := t + \left(a + x \cdot \log y\right)\\ \mathbf{if}\;z \leq -6.962026774207054 \cdot 10^{+178}:\\ \;\;\;\;a + z\\ \mathbf{elif}\;z \leq -1.388832188056837 \cdot 10^{+153}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.801131093301345 \cdot 10^{+124}:\\ \;\;\;\;a + z\\ \mathbf{elif}\;z \leq -1.846037838918351 \cdot 10^{+54}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.8915840969646693 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -81.11532940130132:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.1770020099011567 \cdot 10^{-226}:\\ \;\;\;\;a + b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error24.9
Cost7636
\[\begin{array}{l} t_1 := z + y \cdot i\\ t_2 := \log c \cdot \left(b + -0.5\right) + \left(t + z\right)\\ \mathbf{if}\;a \leq 1.7432022527650416 \cdot 10^{-259}:\\ \;\;\;\;t + \left(z + b \cdot \log c\right)\\ \mathbf{elif}\;a \leq 6.685450757294394 \cdot 10^{-177}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 9.081351600655671 \cdot 10^{-88}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 1.0091172431333596 \cdot 10^{-36}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.2092977283658158 \cdot 10^{+83}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t + \left(a + x \cdot \log y\right)\\ \end{array} \]
Alternative 10
Error7.2
Cost7624
\[\begin{array}{l} t_1 := t + \left(a + x \cdot \log y\right)\\ \mathbf{if}\;x \leq -5.456036629316537 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.589606249920696 \cdot 10^{+150}:\\ \;\;\;\;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
Error25.8
Cost7508
\[\begin{array}{l} t_1 := t + \left(a + x \cdot \log y\right)\\ t_2 := b \cdot \log c\\ \mathbf{if}\;z \leq -2.658571637351588 \cdot 10^{+88}:\\ \;\;\;\;t + \left(z + t_2\right)\\ \mathbf{elif}\;z \leq -1.846037838918351 \cdot 10^{+54}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.8915840969646693 \cdot 10^{+25}:\\ \;\;\;\;z + y \cdot i\\ \mathbf{elif}\;z \leq -81.11532940130132:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.1770020099011567 \cdot 10^{-226}:\\ \;\;\;\;a + t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error7.6
Cost7496
\[\begin{array}{l} t_1 := t + \left(a + x \cdot \log y\right)\\ \mathbf{if}\;x \leq -5.456036629316537 \cdot 10^{+139}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 7.589606249920696 \cdot 10^{+150}:\\ \;\;\;\;a + \left(\log c \cdot \left(b + -0.5\right) + \left(z + y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error24.6
Cost6984
\[\begin{array}{l} t_1 := a + b \cdot \log c\\ \mathbf{if}\;b \leq -2.7702218177662747 \cdot 10^{+132}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 1.590465015668259 \cdot 10^{+153}:\\ \;\;\;\;a + z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error26.4
Cost6856
\[\begin{array}{l} t_1 := b \cdot \log c\\ \mathbf{if}\;b \leq -3.800218813062638 \cdot 10^{+215}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;b \leq 4.501536367706889 \cdot 10^{+153}:\\ \;\;\;\;a + z\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 15
Error28.1
Cost1112
\[\begin{array}{l} t_1 := z + y \cdot i\\ t_2 := a + y \cdot i\\ \mathbf{if}\;z \leq -6.962026774207054 \cdot 10^{+178}:\\ \;\;\;\;a + z\\ \mathbf{elif}\;z \leq -1.388832188056837 \cdot 10^{+153}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -4.204236200684451 \cdot 10^{+121}:\\ \;\;\;\;a + z\\ \mathbf{elif}\;z \leq -6.30928068073524 \cdot 10^{+83}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.1192872073977074 \cdot 10^{+49}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.8915840969646693 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 16
Error32.2
Cost456
\[\begin{array}{l} \mathbf{if}\;t \leq -3.6940033296928403 \cdot 10^{-177}:\\ \;\;\;\;a + z\\ \mathbf{elif}\;t \leq -9.899597853599441 \cdot 10^{-217}:\\ \;\;\;\;y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + z\\ \end{array} \]
Alternative 17
Error27.1
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -9.300613785299655 \cdot 10^{+83}:\\ \;\;\;\;a + z\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 18
Error46.8
Cost192
\[t + a \]
Alternative 19
Error31.4
Cost192
\[a + z \]
Alternative 20
Error62.0
Cost64
\[t \]
Alternative 21
Error47.3
Cost64
\[a \]

Error

Reproduce

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