Average Error: 2.0 → 1.1
Time: 28.1s
Precision: binary64
Cost: 20548
\[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}\;a \leq 1.12 \cdot 10^{+83}:\\ \;\;\;\;x \cdot e^{\left(\left(y \cdot \left(\log z - t\right) + 1\right) + -1\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \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 (<= a 1.12e+83)
   (*
    x
    (exp (+ (+ (+ (* y (- (log z) t)) 1.0) -1.0) (* a (- (log (- 1.0 z)) b)))))
   0.0))
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 (a <= 1.12e+83) {
		tmp = x * exp(((((y * (log(z) - t)) + 1.0) + -1.0) + (a * (log((1.0 - z)) - b))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
real(8) function code(x, y, z, t, a, b)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (a <= 1.12d+83) then
        tmp = x * exp(((((y * (log(z) - t)) + 1.0d0) + (-1.0d0)) + (a * (log((1.0d0 - z)) - b))))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
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 (a <= 1.12e+83) {
		tmp = x * Math.exp(((((y * (Math.log(z) - t)) + 1.0) + -1.0) + (a * (Math.log((1.0 - z)) - b))));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(x, y, z, t, a, b):
	return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
def code(x, y, z, t, a, b):
	tmp = 0
	if a <= 1.12e+83:
		tmp = x * math.exp(((((y * (math.log(z) - t)) + 1.0) + -1.0) + (a * (math.log((1.0 - z)) - b))))
	else:
		tmp = 0.0
	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 (a <= 1.12e+83)
		tmp = Float64(x * exp(Float64(Float64(Float64(Float64(y * Float64(log(z) - t)) + 1.0) + -1.0) + Float64(a * Float64(log(Float64(1.0 - z)) - b)))));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp = code(x, y, z, t, a, b)
	tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
end
function tmp_2 = code(x, y, z, t, a, b)
	tmp = 0.0;
	if (a <= 1.12e+83)
		tmp = x * exp(((((y * (log(z) - t)) + 1.0) + -1.0) + (a * (log((1.0 - z)) - b))));
	else
		tmp = 0.0;
	end
	tmp_2 = 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[a, 1.12e+83], N[(x * N[Exp[N[(N[(N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0]
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}\;a \leq 1.12 \cdot 10^{+83}:\\
\;\;\;\;x \cdot e^{\left(\left(y \cdot \left(\log z - t\right) + 1\right) + -1\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if a < 1.12e83

    1. Initial program 0.5

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

      \[\leadsto x \cdot e^{\color{blue}{\left(e^{\mathsf{log1p}\left(y \cdot \left(\log z - t\right)\right)} - 1\right)} + a \cdot \left(\log \left(1 - z\right) - b\right)} \]
    3. Applied egg-rr0.5

      \[\leadsto x \cdot e^{\left(\color{blue}{\left(y \cdot \left(\log z - t\right) + 1\right)} - 1\right) + a \cdot \left(\log \left(1 - z\right) - b\right)} \]

    if 1.12e83 < a

    1. Initial program 8.7

      \[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 39.8

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

      \[\leadsto x \cdot e^{\color{blue}{y \cdot \left(-t\right)}} \]
      Proof
      (*.f64 y (neg.f64 t)): 0 points increase in error, 0 points decrease in error
      (Rewrite=> distribute-rgt-neg-out_binary64 (neg.f64 (*.f64 y t))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 y t))): 0 points increase in error, 0 points decrease in error
    4. Taylor expanded in y around 0 58.9

      \[\leadsto \color{blue}{-1 \cdot \left(y \cdot \left(t \cdot x\right)\right) + x} \]
    5. Applied egg-rr40.9

      \[\leadsto \color{blue}{\left(1 + \left(x + x \cdot \left(y \cdot t\right)\right)\right) - 1} \]
    6. Taylor expanded in x around 0 3.9

      \[\leadsto \color{blue}{1} - 1 \]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq 1.12 \cdot 10^{+83}:\\ \;\;\;\;x \cdot e^{\left(\left(y \cdot \left(\log z - t\right) + 1\right) + -1\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternatives

Alternative 1
Error0.2
Cost26368
\[x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)} \]
Alternative 2
Error1.1
Cost20292
\[\begin{array}{l} \mathbf{if}\;a \leq 1.12 \cdot 10^{+83}:\\ \;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 3
Error12.1
Cost7312
\[\begin{array}{l} t_1 := x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{if}\;y \leq -1.6 \cdot 10^{-7}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq -8.2 \cdot 10^{-201}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{-171}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-z\right)}\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{-48}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 4
Error6.8
Cost7180
\[\begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{-7}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq -8.2 \cdot 10^{-109}:\\ \;\;\;\;x \cdot e^{t \cdot \left(-y\right)}\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-34}:\\ \;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 5
Error4.6
Cost7176
\[\begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{-14}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq 7.5 \cdot 10^{-34}:\\ \;\;\;\;x \cdot e^{\left(z + b\right) \cdot \left(-a\right)}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 6
Error14.1
Cost6920
\[\begin{array}{l} \mathbf{if}\;a \leq -74:\\ \;\;\;\;0\\ \mathbf{elif}\;a \leq 9.5 \cdot 10^{+53}:\\ \;\;\;\;x \cdot {z}^{y}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 7
Error19.0
Cost1488
\[\begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{-14}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq -1.55 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -5.969231034961329 \cdot 10^{-301}:\\ \;\;\;\;\left(1 + \left(x + x \cdot \left(y \cdot t\right)\right)\right) + -1\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-239}:\\ \;\;\;\;x + \left(y \cdot t\right) \cdot \left(\left(y \cdot t\right) \cdot \left(x \cdot 0.5\right) - x\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-127}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{-43}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 8
Error19.0
Cost1100
\[\begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{-14}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq -1.55 \cdot 10^{-102}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -5.969231034961329 \cdot 10^{-301}:\\ \;\;\;\;\left(1 + \left(x + x \cdot \left(y \cdot t\right)\right)\right) + -1\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-239}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-127}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{-43}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 9
Error18.2
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{-14}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-239}:\\ \;\;\;\;x \cdot \left(1 - y \cdot t\right)\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-127}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{-43}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 10
Error18.2
Cost592
\[\begin{array}{l} \mathbf{if}\;y \leq -4.1 \cdot 10^{-14}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq 4 \cdot 10^{-239}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.75 \cdot 10^{-127}:\\ \;\;\;\;0\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{-43}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]
Alternative 11
Error44.9
Cost64
\[x \]

Error

Reproduce

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