
(FPCore (x y z t a b) :precision binary64 (* 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) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
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
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))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
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 tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); 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]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (* 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) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
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
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))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
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 tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); 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]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
(FPCore (x y z t a b) :precision binary64 (* 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) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
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
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))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
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 tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); 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]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Initial program 97.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b)))))
(if (<= t_1 -500.0)
(* y (* t (- x)))
(if (<= t_1 2e-83) (fma (* y (- t)) x x) (* t (- (/ x t) (* x y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b));
double tmp;
if (t_1 <= -500.0) {
tmp = y * (t * -x);
} else if (t_1 <= 2e-83) {
tmp = fma((y * -t), x, x);
} else {
tmp = t * ((x / t) - (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) tmp = 0.0 if (t_1 <= -500.0) tmp = Float64(y * Float64(t * Float64(-x))); elseif (t_1 <= 2e-83) tmp = fma(Float64(y * Float64(-t)), x, x); else tmp = Float64(t * Float64(Float64(x / t) - Float64(x * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -500.0], N[(y * N[(t * (-x)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-83], N[(N[(y * (-t)), $MachinePrecision] * x + x), $MachinePrecision], N[(t * N[(N[(x / t), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)\\
\mathbf{if}\;t\_1 \leq -500:\\
\;\;\;\;y \cdot \left(t \cdot \left(-x\right)\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-83}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(-t\right), x, x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\frac{x}{t} - x \cdot y\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < -500Initial program 98.9%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites46.8%
Taylor expanded in a around 0
Applied rewrites2.7%
Taylor expanded in t around inf
Applied rewrites19.4%
Applied rewrites21.3%
if -500 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 2.0000000000000001e-83Initial program 92.2%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in a around 0
Applied rewrites92.1%
Applied rewrites92.2%
Taylor expanded in t around inf
Applied rewrites92.2%
if 2.0000000000000001e-83 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 97.6%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites55.6%
Taylor expanded in a around 0
Applied rewrites30.6%
Taylor expanded in t around -inf
Applied rewrites34.2%
Taylor expanded in y around 0
Applied rewrites37.4%
Final simplification39.2%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))) -500.0) (* y (* t (- x))) (fma (* y (- t)) x x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))) <= -500.0) {
tmp = y * (t * -x);
} else {
tmp = fma((y * -t), x, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))) <= -500.0) tmp = Float64(y * Float64(t * Float64(-x))); else tmp = fma(Float64(y * Float64(-t)), x, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[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], -500.0], N[(y * N[(t * (-x)), $MachinePrecision]), $MachinePrecision], N[(N[(y * (-t)), $MachinePrecision] * x + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right) \leq -500:\\
\;\;\;\;y \cdot \left(t \cdot \left(-x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(-t\right), x, x\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < -500Initial program 98.9%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites46.8%
Taylor expanded in a around 0
Applied rewrites2.7%
Taylor expanded in t around inf
Applied rewrites19.4%
Applied rewrites21.3%
if -500 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 96.3%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites65.9%
Taylor expanded in a around 0
Applied rewrites45.0%
Applied rewrites46.9%
Taylor expanded in t around inf
Applied rewrites44.3%
Final simplification35.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* y (- (log z) t))))))
(if (<= y -5.2e+30)
t_1
(if (<= y 850000000000.0) (* x (exp (* a (- (- z) b)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((y * (log(z) - t)));
double tmp;
if (y <= -5.2e+30) {
tmp = t_1;
} else if (y <= 850000000000.0) {
tmp = x * exp((a * (-z - b)));
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = x * exp((y * (log(z) - t)))
if (y <= (-5.2d+30)) then
tmp = t_1
else if (y <= 850000000000.0d0) then
tmp = x * exp((a * (-z - b)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * Math.exp((y * (Math.log(z) - t)));
double tmp;
if (y <= -5.2e+30) {
tmp = t_1;
} else if (y <= 850000000000.0) {
tmp = x * Math.exp((a * (-z - b)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((y * (math.log(z) - t))) tmp = 0 if y <= -5.2e+30: tmp = t_1 elif y <= 850000000000.0: tmp = x * math.exp((a * (-z - b))) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(y * Float64(log(z) - t)))) tmp = 0.0 if (y <= -5.2e+30) tmp = t_1; elseif (y <= 850000000000.0) tmp = Float64(x * exp(Float64(a * Float64(Float64(-z) - b)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((y * (log(z) - t))); tmp = 0.0; if (y <= -5.2e+30) tmp = t_1; elseif (y <= 850000000000.0) tmp = x * exp((a * (-z - b))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5.2e+30], t$95$1, If[LessEqual[y, 850000000000.0], N[(x * N[Exp[N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 850000000000:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -5.19999999999999977e30 or 8.5e11 < y Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-log.f6493.4
Applied rewrites93.4%
if -5.19999999999999977e30 < y < 8.5e11Initial program 94.9%
Taylor expanded in y around 0
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6487.4
Applied rewrites87.4%
Taylor expanded in z around 0
Applied rewrites87.4%
Final simplification90.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* y (log z))))))
(if (<= y -1.56e+27)
t_1
(if (<= y 2.1e+14) (* x (exp (* a (- (- z) b)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((y * log(z)));
double tmp;
if (y <= -1.56e+27) {
tmp = t_1;
} else if (y <= 2.1e+14) {
tmp = x * exp((a * (-z - b)));
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = x * exp((y * log(z)))
if (y <= (-1.56d+27)) then
tmp = t_1
else if (y <= 2.1d+14) then
tmp = x * exp((a * (-z - b)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * Math.exp((y * Math.log(z)));
double tmp;
if (y <= -1.56e+27) {
tmp = t_1;
} else if (y <= 2.1e+14) {
tmp = x * Math.exp((a * (-z - b)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((y * math.log(z))) tmp = 0 if y <= -1.56e+27: tmp = t_1 elif y <= 2.1e+14: tmp = x * math.exp((a * (-z - b))) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(y * log(z)))) tmp = 0.0 if (y <= -1.56e+27) tmp = t_1; elseif (y <= 2.1e+14) tmp = Float64(x * exp(Float64(a * Float64(Float64(-z) - b)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((y * log(z))); tmp = 0.0; if (y <= -1.56e+27) tmp = t_1; elseif (y <= 2.1e+14) tmp = x * exp((a * (-z - b))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[(y * N[Log[z], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.56e+27], t$95$1, If[LessEqual[y, 2.1e+14], N[(x * N[Exp[N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{y \cdot \log z}\\
\mathbf{if}\;y \leq -1.56 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+14}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.56e27 or 2.1e14 < y Initial program 100.0%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-log.f6492.7
Applied rewrites92.7%
Taylor expanded in t around 0
Applied rewrites72.6%
if -1.56e27 < y < 2.1e14Initial program 94.9%
Taylor expanded in y around 0
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6487.9
Applied rewrites87.9%
Taylor expanded in z around 0
Applied rewrites87.9%
Final simplification80.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* y (- t))))))
(if (<= y -1.55e+67)
t_1
(if (<= y 8.5e+101) (* x (exp (* a (- (- z) b)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((y * -t));
double tmp;
if (y <= -1.55e+67) {
tmp = t_1;
} else if (y <= 8.5e+101) {
tmp = x * exp((a * (-z - b)));
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = x * exp((y * -t))
if (y <= (-1.55d+67)) then
tmp = t_1
else if (y <= 8.5d+101) then
tmp = x * exp((a * (-z - b)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * Math.exp((y * -t));
double tmp;
if (y <= -1.55e+67) {
tmp = t_1;
} else if (y <= 8.5e+101) {
tmp = x * Math.exp((a * (-z - b)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((y * -t)) tmp = 0 if y <= -1.55e+67: tmp = t_1 elif y <= 8.5e+101: tmp = x * math.exp((a * (-z - b))) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(y * Float64(-t)))) tmp = 0.0 if (y <= -1.55e+67) tmp = t_1; elseif (y <= 8.5e+101) tmp = Float64(x * exp(Float64(a * Float64(Float64(-z) - b)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((y * -t)); tmp = 0.0; if (y <= -1.55e+67) tmp = t_1; elseif (y <= 8.5e+101) tmp = x * exp((a * (-z - b))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.55e+67], t$95$1, If[LessEqual[y, 8.5e+101], N[(x * N[Exp[N[(a * N[((-z) - b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{if}\;y \leq -1.55 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+101}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-z\right) - b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.54999999999999998e67 or 8.5000000000000001e101 < y Initial program 100.0%
Taylor expanded in t around inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6467.5
Applied rewrites67.5%
if -1.54999999999999998e67 < y < 8.5000000000000001e101Initial program 95.8%
Taylor expanded in y around 0
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6479.8
Applied rewrites79.8%
Taylor expanded in z around 0
Applied rewrites79.8%
Final simplification75.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* x (exp (* a (- b)))))) (if (<= b -1.3e+103) t_1 (if (<= b 2.6e-29) (* x (exp (* y (- t)))) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((a * -b));
double tmp;
if (b <= -1.3e+103) {
tmp = t_1;
} else if (b <= 2.6e-29) {
tmp = x * exp((y * -t));
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = x * exp((a * -b))
if (b <= (-1.3d+103)) then
tmp = t_1
else if (b <= 2.6d-29) then
tmp = x * exp((y * -t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * Math.exp((a * -b));
double tmp;
if (b <= -1.3e+103) {
tmp = t_1;
} else if (b <= 2.6e-29) {
tmp = x * Math.exp((y * -t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((a * -b)) tmp = 0 if b <= -1.3e+103: tmp = t_1 elif b <= 2.6e-29: tmp = x * math.exp((y * -t)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(a * Float64(-b)))) tmp = 0.0 if (b <= -1.3e+103) tmp = t_1; elseif (b <= 2.6e-29) tmp = Float64(x * exp(Float64(y * Float64(-t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((a * -b)); tmp = 0.0; if (b <= -1.3e+103) tmp = t_1; elseif (b <= 2.6e-29) tmp = x * exp((y * -t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -1.3e+103], t$95$1, If[LessEqual[b, 2.6e-29], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{if}\;b \leq -1.3 \cdot 10^{+103}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.6 \cdot 10^{-29}:\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.3000000000000001e103 or 2.6000000000000002e-29 < b Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6477.7
Applied rewrites77.7%
if -1.3000000000000001e103 < b < 2.6000000000000002e-29Initial program 95.0%
Taylor expanded in t around inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6471.2
Applied rewrites71.2%
Final simplification74.2%
(FPCore (x y z t a b) :precision binary64 (* x (exp (* a (- b)))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp((a * -b));
}
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((a * -b))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp((a * -b));
}
def code(x, y, z, t, a, b): return x * math.exp((a * -b))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(a * Float64(-b)))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp((a * -b)); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{a \cdot \left(-b\right)}
\end{array}
Initial program 97.3%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f64N/A
lower-*.f6458.1
Applied rewrites58.1%
Final simplification58.1%
(FPCore (x y z t a b) :precision binary64 (* y (* t (- x))))
double code(double x, double y, double z, double t, double a, double b) {
return y * (t * -x);
}
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 = y * (t * -x)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return y * (t * -x);
}
def code(x, y, z, t, a, b): return y * (t * -x)
function code(x, y, z, t, a, b) return Float64(y * Float64(t * Float64(-x))) end
function tmp = code(x, y, z, t, a, b) tmp = y * (t * -x); end
code[x_, y_, z_, t_, a_, b_] := N[(y * N[(t * (-x)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(t \cdot \left(-x\right)\right)
\end{array}
Initial program 97.3%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites58.6%
Taylor expanded in a around 0
Applied rewrites28.8%
Taylor expanded in t around inf
Applied rewrites18.8%
Applied rewrites19.1%
Final simplification19.1%
(FPCore (x y z t a b) :precision binary64 (* t (* y (- x))))
double code(double x, double y, double z, double t, double a, double b) {
return t * (y * -x);
}
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 = t * (y * -x)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return t * (y * -x);
}
def code(x, y, z, t, a, b): return t * (y * -x)
function code(x, y, z, t, a, b) return Float64(t * Float64(y * Float64(-x))) end
function tmp = code(x, y, z, t, a, b) tmp = t * (y * -x); end
code[x_, y_, z_, t_, a_, b_] := N[(t * N[(y * (-x)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(y \cdot \left(-x\right)\right)
\end{array}
Initial program 97.3%
Taylor expanded in y around 0
+-commutativeN/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
Applied rewrites58.6%
Taylor expanded in a around 0
Applied rewrites28.8%
Taylor expanded in t around inf
Applied rewrites18.8%
Final simplification18.8%
herbie shell --seed 2024233
(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))))))