Average Error: 2.0 → 9.0
Time: 29.4s
Precision: binary64
Cost: 32776
\[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-133}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 0.094:\\ \;\;\;\;x \cdot \sqrt[3]{{\left({\left(\sqrt[3]{e^{b \cdot \left(-a\right)}}\right)}^{3}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
(FPCore (x y z t a b)
 :precision binary64
 (if (<= y -2e-133)
   (* x (exp (* y (- t))))
   (if (<= y 0.094)
     (* x (cbrt (pow (pow (cbrt (exp (* b (- a)))) 3.0) 3.0)))
     (* x (pow z y)))))
double code(double x, double y, double z, double t, double a, double b) {
	return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -2e-133) {
		tmp = x * exp((y * -t));
	} else if (y <= 0.094) {
		tmp = x * cbrt(pow(pow(cbrt(exp((b * -a))), 3.0), 3.0));
	} else {
		tmp = x * pow(z, y);
	}
	return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
	return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
public static double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (y <= -2e-133) {
		tmp = x * Math.exp((y * -t));
	} else if (y <= 0.094) {
		tmp = x * Math.cbrt(Math.pow(Math.pow(Math.cbrt(Math.exp((b * -a))), 3.0), 3.0));
	} else {
		tmp = x * Math.pow(z, y);
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b)))))
end
function code(x, y, z, t, a, b)
	tmp = 0.0
	if (y <= -2e-133)
		tmp = Float64(x * exp(Float64(y * Float64(-t))));
	elseif (y <= 0.094)
		tmp = Float64(x * cbrt(((cbrt(exp(Float64(b * Float64(-a)))) ^ 3.0) ^ 3.0)));
	else
		tmp = Float64(x * (z ^ y));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2e-133], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 0.094], N[(x * N[Power[N[Power[N[Power[N[Power[N[Exp[N[(b * (-a)), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]]
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-133}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\

\mathbf{elif}\;y \leq 0.094:\\
\;\;\;\;x \cdot \sqrt[3]{{\left({\left(\sqrt[3]{e^{b \cdot \left(-a\right)}}\right)}^{3}\right)}^{3}}\\

\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if y < -2.0000000000000001e-133

    1. Initial program 2.6

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Taylor expanded in t around inf 19.2

      \[\leadsto x \cdot e^{\color{blue}{-1 \cdot \left(y \cdot t\right)}} \]
    3. Simplified19.2

      \[\leadsto x \cdot e^{\color{blue}{t \cdot \left(-y\right)}} \]

    if -2.0000000000000001e-133 < y < 0.094

    1. Initial program 2.4

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Simplified0.1

      \[\leadsto \color{blue}{x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}} \]
    3. Applied egg-rr3.9

      \[\leadsto x \cdot \color{blue}{\sqrt[3]{{\left(e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}\right)}^{3}}} \]
    4. Applied egg-rr3.9

      \[\leadsto x \cdot \sqrt[3]{{\color{blue}{\left({\left(\sqrt[3]{e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(z\right) - b\right)\right)}}\right)}^{3}\right)}}^{3}} \]
    5. Taylor expanded in b around inf 8.7

      \[\leadsto x \cdot \sqrt[3]{{\left({\left(\sqrt[3]{e^{\color{blue}{-1 \cdot \left(a \cdot b\right)}}}\right)}^{3}\right)}^{3}} \]
    6. Simplified8.7

      \[\leadsto x \cdot \sqrt[3]{{\left({\left(\sqrt[3]{e^{\color{blue}{b \cdot \left(-a\right)}}}\right)}^{3}\right)}^{3}} \]

    if 0.094 < y

    1. Initial program 1.0

      \[x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    2. Simplified0.2

      \[\leadsto \color{blue}{x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}} \]
    3. Taylor expanded in a around 0 1.9

      \[\leadsto \color{blue}{x \cdot e^{y \cdot \left(\log z - t\right)}} \]
    4. Simplified1.9

      \[\leadsto \color{blue}{{\left(\frac{z}{e^{t}}\right)}^{y} \cdot x} \]
    5. Taylor expanded in t around 0 0.1

      \[\leadsto \color{blue}{{z}^{y}} \cdot x \]
  3. Recombined 3 regimes into one program.
  4. Final simplification9.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-133}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 0.094:\\ \;\;\;\;x \cdot \sqrt[3]{{\left({\left(\sqrt[3]{e^{b \cdot \left(-a\right)}}\right)}^{3}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]

Alternatives

Alternative 1
Error9.0
Cost19912
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-133}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 0.094:\\ \;\;\;\;x \cdot \sqrt[3]{{\left(e^{b \cdot \left(-a\right)}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 2
Error27.3
Cost7580
\[\begin{array}{l} t_1 := \left(1 + t \cdot \left(y \cdot x\right)\right) + -1\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{-46}:\\ \;\;\;\;\left(1 + x \cdot \left(b \cdot a\right)\right) + -1\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-116}:\\ \;\;\;\;x \cdot \left(1 - b \cdot a\right)\\ \mathbf{elif}\;y \leq -3.15 \cdot 10^{-196}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -7.8 \cdot 10^{-268}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-204}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-63}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 3
Error27.4
Cost7580
\[\begin{array}{l} t_1 := \left(1 + t \cdot \left(y \cdot x\right)\right) + -1\\ \mathbf{if}\;y \leq -2.65 \cdot 10^{-64}:\\ \;\;\;\;\left(1 + x \cdot \left(b \cdot a\right)\right) + -1\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-116}:\\ \;\;\;\;x \cdot e^{b \cdot a}\\ \mathbf{elif}\;y \leq -3.15 \cdot 10^{-196}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -7.8 \cdot 10^{-268}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-204}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-63}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 4
Error18.3
Cost7180
\[\begin{array}{l} t_1 := x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{if}\;y \leq -7.8 \cdot 10^{-268}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-201}:\\ \;\;\;\;\left(1 + t \cdot \left(y \cdot x\right)\right) + -1\\ \mathbf{elif}\;y \leq 1.65 \cdot 10^{-10}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 5
Error9.0
Cost7048
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-133}:\\ \;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\ \mathbf{elif}\;y \leq 0.094:\\ \;\;\;\;x \cdot e^{b \cdot \left(-a\right)}\\ \mathbf{else}:\\ \;\;\;\;x \cdot {z}^{y}\\ \end{array} \]
Alternative 6
Error35.7
Cost1500
\[\begin{array}{l} t_1 := \left(1 + x \cdot \left(b \cdot a\right)\right) + -1\\ t_2 := \left(1 + t \cdot \left(y \cdot x\right)\right) + -1\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{-46}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-116}:\\ \;\;\;\;x \cdot \left(1 - b \cdot a\right)\\ \mathbf{elif}\;y \leq -3.15 \cdot 10^{-196}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -7.8 \cdot 10^{-268}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-204}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{-63}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 40000000000000:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error44.3
Cost1440
\[\begin{array}{l} t_1 := x \cdot \left(1 - b \cdot a\right)\\ t_2 := t \cdot \left(y \cdot \left(-x\right)\right)\\ t_3 := x \cdot \left(b \cdot \left(-a\right)\right)\\ \mathbf{if}\;a \leq -5.2 \cdot 10^{+22}:\\ \;\;\;\;y \cdot \left(x \cdot \left(-t\right)\right)\\ \mathbf{elif}\;a \leq -8.5 \cdot 10^{-124}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -6.4 \cdot 10^{-155}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq -8.2 \cdot 10^{-231}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -8 \cdot 10^{-293}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 1.7 \cdot 10^{-72}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.65 \cdot 10^{-35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 5.6 \cdot 10^{+41}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 8
Error35.4
Cost1368
\[\begin{array}{l} t_1 := t \cdot \left(y \cdot \left(-x\right)\right)\\ t_2 := \left(1 + x \cdot \left(b \cdot a\right)\right) + -1\\ \mathbf{if}\;y \leq -3.3 \cdot 10^{-46}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1.82 \cdot 10^{-268}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -2.05 \cdot 10^{-301}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.5 \cdot 10^{-284}:\\ \;\;\;\;x \cdot \left(1 - b \cdot a\right)\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-204}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-46}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Error43.8
Cost1240
\[\begin{array}{l} t_1 := x \cdot \left(1 - b \cdot a\right)\\ t_2 := y \cdot \left(x \cdot \left(-t\right)\right)\\ t_3 := x \cdot \left(b \cdot \left(-a\right)\right)\\ \mathbf{if}\;a \leq -5.2 \cdot 10^{+22}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -8.5 \cdot 10^{-124}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -6.4 \cdot 10^{-155}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq -8.2 \cdot 10^{-231}:\\ \;\;\;\;x\\ \mathbf{elif}\;a \leq -8 \cdot 10^{-293}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;a \leq 1.9 \cdot 10^{+49}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 10
Error39.9
Cost648
\[\begin{array}{l} t_1 := a \cdot \left(x \cdot \left(-b\right)\right)\\ \mathbf{if}\;y \leq -1.5 \cdot 10^{-38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 31000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error39.9
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{-38}:\\ \;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\ \mathbf{elif}\;y \leq 31000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(x \cdot \left(-b\right)\right)\\ \end{array} \]
Alternative 12
Error39.9
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{-38}:\\ \;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\ \mathbf{elif}\;y \leq 31000000:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(b \cdot \left(-a\right)\right)\\ \end{array} \]
Alternative 13
Error44.4
Cost64
\[x \]

Error

Reproduce

herbie shell --seed 2022228 
(FPCore (x y z t a b)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
  :precision binary64
  (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))