| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 26368 |
\[x \cdot e^{\mathsf{fma}\left(a, \mathsf{log1p}\left(-z\right) - b, y \cdot \left(\log z - t\right)\right)}
\]
(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}
Results
if a < 1.12e83Initial program 0.5
Applied egg-rr31.3
Applied egg-rr0.5
if 1.12e83 < a Initial program 8.7
Taylor expanded in t around inf 39.8
Simplified39.8
Taylor expanded in y around 0 58.9
Applied egg-rr40.9
Taylor expanded in x around 0 3.9
Final simplification1.1
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 26368 |
| Alternative 2 | |
|---|---|
| Error | 1.1 |
| Cost | 20292 |
| Alternative 3 | |
|---|---|
| Error | 12.1 |
| Cost | 7312 |
| Alternative 4 | |
|---|---|
| Error | 6.8 |
| Cost | 7180 |
| Alternative 5 | |
|---|---|
| Error | 4.6 |
| Cost | 7176 |
| Alternative 6 | |
|---|---|
| Error | 14.1 |
| Cost | 6920 |
| Alternative 7 | |
|---|---|
| Error | 19.0 |
| Cost | 1488 |
| Alternative 8 | |
|---|---|
| Error | 19.0 |
| Cost | 1100 |
| Alternative 9 | |
|---|---|
| Error | 18.2 |
| Cost | 712 |
| Alternative 10 | |
|---|---|
| Error | 18.2 |
| Cost | 592 |
| Alternative 11 | |
|---|---|
| Error | 44.9 |
| Cost | 64 |

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))))))