Average Error: 0.1 → 0.6
Time: 24.4s
Precision: binary64
Cost: 26564
\[ \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 \]
\[\begin{array}{l} \mathbf{if}\;a \leq 1.4514173429924675 \cdot 10^{-34}:\\ \;\;\;\;z + \left(t + \mathsf{fma}\left(y, i, \mathsf{fma}\left(\log y, x, \log c \cdot \left(b + -0.5\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(a + \mathsf{fma}\left(\log y, x, z\right)\right) + b \cdot \log c\right) + y \cdot i\\ \end{array} \]
(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
 (if (<= a 1.4514173429924675e-34)
   (+ z (+ t (fma y i (fma (log y) x (* (log c) (+ b -0.5))))))
   (+ (+ (+ a (fma (log y) x z)) (* b (log c))) (* y i))))
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) {
	double tmp;
	if (a <= 1.4514173429924675e-34) {
		tmp = z + (t + fma(y, i, fma(log(y), x, (log(c) * (b + -0.5)))));
	} else {
		tmp = ((a + fma(log(y), x, z)) + (b * log(c))) + (y * i);
	}
	return tmp;
}
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)
	tmp = 0.0
	if (a <= 1.4514173429924675e-34)
		tmp = Float64(z + Float64(t + fma(y, i, fma(log(y), x, Float64(log(c) * Float64(b + -0.5))))));
	else
		tmp = Float64(Float64(Float64(a + fma(log(y), x, z)) + Float64(b * log(c))) + Float64(y * i));
	end
	return tmp
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_] := If[LessEqual[a, 1.4514173429924675e-34], N[(z + N[(t + N[(y * i + N[(N[Log[y], $MachinePrecision] * x + N[(N[Log[c], $MachinePrecision] * N[(b + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a + N[(N[Log[y], $MachinePrecision] * x + z), $MachinePrecision]), $MachinePrecision] + N[(b * N[Log[c], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * i), $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
\begin{array}{l}
\mathbf{if}\;a \leq 1.4514173429924675 \cdot 10^{-34}:\\
\;\;\;\;z + \left(t + \mathsf{fma}\left(y, i, \mathsf{fma}\left(\log y, x, \log c \cdot \left(b + -0.5\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(a + \mathsf{fma}\left(\log y, x, z\right)\right) + b \cdot \log c\right) + y \cdot i\\


\end{array}

Error

Derivation

  1. Split input into 2 regimes
  2. if a < 1.451417342992468e-34

    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 + \left(t + \mathsf{fma}\left(x, \log y, \mathsf{fma}\left(y, i, \mathsf{fma}\left(b + -0.5, \log c, a\right)\right)\right)\right)} \]
    3. Taylor expanded in a around 0 0.1

      \[\leadsto z + \left(t + \color{blue}{\left(y \cdot i + \left(\log y \cdot x + \log c \cdot \left(b - 0.5\right)\right)\right)}\right) \]
    4. Simplified0.1

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

    if 1.451417342992468e-34 < a

    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. Taylor expanded in t around 0 0.5

      \[\leadsto \left(\color{blue}{\left(a + \left(\log y \cdot x + z\right)\right)} + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
    3. Simplified0.5

      \[\leadsto \left(\color{blue}{\left(a + \mathsf{fma}\left(\log y, x, z\right)\right)} + \left(b - 0.5\right) \cdot \log c\right) + y \cdot i \]
    4. Taylor expanded in b around inf 0.9

      \[\leadsto \left(\left(a + \mathsf{fma}\left(\log y, x, z\right)\right) + \color{blue}{\log c \cdot b}\right) + y \cdot i \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 1.4514173429924675 \cdot 10^{-34}:\\ \;\;\;\;z + \left(t + \mathsf{fma}\left(y, i, \mathsf{fma}\left(\log y, x, \log c \cdot \left(b + -0.5\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(a + \mathsf{fma}\left(\log y, x, z\right)\right) + b \cdot \log c\right) + y \cdot i\\ \end{array} \]

Alternatives

Alternative 1
Error0.3
Cost33408
\[\left(\left(\left(\left(\sqrt[3]{x} \cdot \left(\log y \cdot {\left(\sqrt[3]{x}\right)}^{2}\right) + z\right) + t\right) + a\right) + \log c \cdot \left(b + -0.5\right)\right) + y \cdot i \]
Alternative 2
Error1.8
Cost20032
\[\left(\left(a + \mathsf{fma}\left(\log y, x, z\right)\right) + b \cdot \log c\right) + y \cdot i \]
Alternative 3
Error3.9
Cost13892
\[\begin{array}{l} t_1 := \log y \cdot x\\ t_2 := \log c \cdot \left(b + -0.5\right)\\ \mathbf{if}\;z \leq -1.5715006925191985 \cdot 10^{+81}:\\ \;\;\;\;t_2 + \left(t_1 + \left(z + a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_2 + \left(a + t_1\right)\right) + y \cdot i\\ \end{array} \]
Alternative 4
Error10.5
Cost13764
\[\begin{array}{l} \mathbf{if}\;i \leq 3.4 \cdot 10^{+122}:\\ \;\;\;\;\log c \cdot \left(b + -0.5\right) + \left(\log y \cdot x + \left(z + a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;b \cdot \log c + y \cdot i\\ \end{array} \]
Alternative 5
Error32.0
Cost8168
\[\begin{array}{l} t_1 := a + y \cdot i\\ t_2 := z + \left(t + y \cdot i\right)\\ t_3 := z + \left(t + a\right)\\ t_4 := b \cdot \log c\\ t_5 := z + \left(t + t_4\right)\\ \mathbf{if}\;t \leq -5.7642766616419 \cdot 10^{-25}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;t \leq -4.412478843397466 \cdot 10^{-179}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -1.8143839470752716 \cdot 10^{-242}:\\ \;\;\;\;a + t_4\\ \mathbf{elif}\;t \leq -2.640528700616859 \cdot 10^{-286}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 9.688581116628644 \cdot 10^{-300}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;t \leq 5.386003336214504 \cdot 10^{-255}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;t \leq 4.388784751265695 \cdot 10^{-217}:\\ \;\;\;\;\log c \cdot \left(b + -0.5\right)\\ \mathbf{elif}\;t \leq 7.726101100059871 \cdot 10^{-169}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 7.5530386103515 \cdot 10^{-149}:\\ \;\;\;\;t_5\\ \mathbf{elif}\;t \leq 4.181975069790569 \cdot 10^{-133}:\\ \;\;\;\;t_4 + y \cdot i\\ \mathbf{elif}\;t \leq 16053203437.635399:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error26.6
Cost7904
\[\begin{array}{l} t_1 := b \cdot \log c\\ t_2 := a + t_1\\ t_3 := t_1 + y \cdot i\\ t_4 := z + \left(t + \log y \cdot x\right)\\ \mathbf{if}\;a \leq 115892648868371.22:\\ \;\;\;\;t_4\\ \mathbf{elif}\;a \leq 8.03487494439484 \cdot 10^{+48}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 1.7950162512496072 \cdot 10^{+112}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;a \leq 4.288442324114128 \cdot 10^{+122}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 4.417351171889617 \cdot 10^{+134}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;a \leq 1.6673283454987731 \cdot 10^{+159}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 7.035106953572844 \cdot 10^{+163}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 5.888683517350662 \cdot 10^{+177}:\\ \;\;\;\;t_4\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, y, a\right)\\ \end{array} \]
Alternative 7
Error26.4
Cost7248
\[\begin{array}{l} t_1 := b \cdot \log c\\ t_2 := z + \left(t + a\right)\\ \mathbf{if}\;z \leq -2.17247275423498 \cdot 10^{+169}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -1.1773783688160545 \cdot 10^{+149}:\\ \;\;\;\;t_1 + y \cdot i\\ \mathbf{elif}\;z \leq -7.444783528988434 \cdot 10^{+110}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq -7.346079122145148 \cdot 10^{-56}:\\ \;\;\;\;a + y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a + t_1\\ \end{array} \]
Alternative 8
Error29.2
Cost6856
\[\begin{array}{l} \mathbf{if}\;a \leq 2.1818513252261128 \cdot 10^{+99}:\\ \;\;\;\;z + \left(t + y \cdot i\right)\\ \mathbf{elif}\;a \leq 1.0926134287550956 \cdot 10^{+142}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 9
Error29.2
Cost6856
\[\begin{array}{l} \mathbf{if}\;a \leq 2.1818513252261128 \cdot 10^{+99}:\\ \;\;\;\;z + \left(t + y \cdot i\right)\\ \mathbf{elif}\;a \leq 1.0926134287550956 \cdot 10^{+142}:\\ \;\;\;\;b \cdot \log c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(i, y, a\right)\\ \end{array} \]
Alternative 10
Error27.1
Cost6852
\[\begin{array}{l} \mathbf{if}\;a \leq 1.7950162512496072 \cdot 10^{+112}:\\ \;\;\;\;z + \left(t + y \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;a + b \cdot \log c\\ \end{array} \]
Alternative 11
Error28.4
Cost580
\[\begin{array}{l} \mathbf{if}\;a \leq 7.049553505247191 \cdot 10^{+112}:\\ \;\;\;\;z + \left(t + y \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 12
Error31.8
Cost452
\[\begin{array}{l} \mathbf{if}\;i \leq 3.4 \cdot 10^{+122}:\\ \;\;\;\;z + \left(t + a\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot i\\ \end{array} \]
Alternative 13
Error26.9
Cost452
\[\begin{array}{l} \mathbf{if}\;z \leq -7.444783528988434 \cdot 10^{+110}:\\ \;\;\;\;z + \left(t + a\right)\\ \mathbf{else}:\\ \;\;\;\;a + y \cdot i\\ \end{array} \]
Alternative 14
Error43.2
Cost324
\[\begin{array}{l} \mathbf{if}\;a \leq 1.3320258907566675 \cdot 10^{+102}:\\ \;\;\;\;y \cdot i\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array} \]
Alternative 15
Error47.4
Cost64
\[a \]

Error

Reproduce

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