
(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 (* (exp (- (* (- (log (- 1.0 z)) b) a) (* (- t (log z)) y))) x))
double code(double x, double y, double z, double t, double a, double b) {
return exp((((log((1.0 - z)) - b) * a) - ((t - log(z)) * 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 = exp((((log((1.0d0 - z)) - b) * a) - ((t - log(z)) * y))) * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((((Math.log((1.0 - z)) - b) * a) - ((t - Math.log(z)) * y))) * x;
}
def code(x, y, z, t, a, b): return math.exp((((math.log((1.0 - z)) - b) * a) - ((t - math.log(z)) * y))) * x
function code(x, y, z, t, a, b) return Float64(exp(Float64(Float64(Float64(log(Float64(1.0 - z)) - b) * a) - Float64(Float64(t - log(z)) * y))) * x) end
function tmp = code(x, y, z, t, a, b) tmp = exp((((log((1.0 - z)) - b) * a) - ((t - log(z)) * y))) * x; end
code[x_, y_, z_, t_, a_, b_] := N[(N[Exp[N[(N[(N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * a), $MachinePrecision] - N[(N[(t - N[Log[z], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\log \left(1 - z\right) - b\right) \cdot a - \left(t - \log z\right) \cdot y} \cdot x
\end{array}
Initial program 97.3%
Final simplification97.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- y) (/ (* t t) t))) x)))
(if (<= t -265000000.0)
t_1
(if (<= t 7e+253) (* (exp (fma (- b) a (* (log z) y))) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-y * ((t * t) / t))) * x;
double tmp;
if (t <= -265000000.0) {
tmp = t_1;
} else if (t <= 7e+253) {
tmp = exp(fma(-b, a, (log(z) * y))) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-y) * Float64(Float64(t * t) / t))) * x) tmp = 0.0 if (t <= -265000000.0) tmp = t_1; elseif (t <= 7e+253) tmp = Float64(exp(fma(Float64(-b), a, Float64(log(z) * y))) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-y) * N[(N[(t * t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -265000000.0], t$95$1, If[LessEqual[t, 7e+253], N[(N[Exp[N[((-b) * a + N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-y\right) \cdot \frac{t \cdot t}{t}} \cdot x\\
\mathbf{if}\;t \leq -265000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+253}:\\
\;\;\;\;e^{\mathsf{fma}\left(-b, a, \log z \cdot y\right)} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.65e8 or 6.99999999999999955e253 < t Initial program 97.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6483.2
Applied rewrites83.2%
Applied rewrites86.7%
if -2.65e8 < t < 6.99999999999999955e253Initial program 97.2%
Taylor expanded in z around 0
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6496.7
Applied rewrites96.7%
Taylor expanded in t around 0
Applied rewrites95.0%
Final simplification92.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- (log z) t) y)) x))) (if (<= y -0.07) t_1 (if (<= y 1.7e-9) (* (exp (* (- (- z) b) a)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(((log(z) - t) * y)) * x;
double tmp;
if (y <= -0.07) {
tmp = t_1;
} else if (y <= 1.7e-9) {
tmp = exp(((-z - b) * a)) * x;
} 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 = exp(((log(z) - t) * y)) * x
if (y <= (-0.07d0)) then
tmp = t_1
else if (y <= 1.7d-9) then
tmp = exp(((-z - b) * a)) * x
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 = Math.exp(((Math.log(z) - t) * y)) * x;
double tmp;
if (y <= -0.07) {
tmp = t_1;
} else if (y <= 1.7e-9) {
tmp = Math.exp(((-z - b) * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp(((math.log(z) - t) * y)) * x tmp = 0 if y <= -0.07: tmp = t_1 elif y <= 1.7e-9: tmp = math.exp(((-z - b) * a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(log(z) - t) * y)) * x) tmp = 0.0 if (y <= -0.07) tmp = t_1; elseif (y <= 1.7e-9) tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp(((log(z) - t) * y)) * x; tmp = 0.0; if (y <= -0.07) tmp = t_1; elseif (y <= 1.7e-9) tmp = exp(((-z - b) * a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -0.07], t$95$1, If[LessEqual[y, 1.7e-9], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(\log z - t\right) \cdot y} \cdot x\\
\mathbf{if}\;y \leq -0.07:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-9}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -0.070000000000000007 or 1.6999999999999999e-9 < y Initial program 98.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6444.1
Applied rewrites44.1%
Taylor expanded in b around 0
Applied rewrites17.5%
Taylor expanded in z around 0
Applied rewrites17.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6491.6
Applied rewrites91.6%
if -0.070000000000000007 < y < 1.6999999999999999e-9Initial program 95.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6491.7
Applied rewrites91.7%
Taylor expanded in z around 0
Applied rewrites91.7%
Final simplification91.6%
(FPCore (x y z t a b) :precision binary64 (* (exp (fma (- b) a (* (- (log z) t) y))) x))
double code(double x, double y, double z, double t, double a, double b) {
return exp(fma(-b, a, ((log(z) - t) * y))) * x;
}
function code(x, y, z, t, a, b) return Float64(exp(fma(Float64(-b), a, Float64(Float64(log(z) - t) * y))) * x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[Exp[N[((-b) * a + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
e^{\mathsf{fma}\left(-b, a, \left(\log z - t\right) \cdot y\right)} \cdot x
\end{array}
Initial program 97.3%
Taylor expanded in z around 0
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6497.0
Applied rewrites97.0%
Final simplification97.0%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -2.85e+110)
(* (exp (* (- t) y)) x)
(if (<= y 2.7e-9)
(* (exp (* (- (- z) b) a)) x)
(* (exp (* (- y) (/ (* t t) t))) x))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.85e+110) {
tmp = exp((-t * y)) * x;
} else if (y <= 2.7e-9) {
tmp = exp(((-z - b) * a)) * x;
} else {
tmp = exp((-y * ((t * t) / t))) * x;
}
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) :: tmp
if (y <= (-2.85d+110)) then
tmp = exp((-t * y)) * x
else if (y <= 2.7d-9) then
tmp = exp(((-z - b) * a)) * x
else
tmp = exp((-y * ((t * t) / t))) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.85e+110) {
tmp = Math.exp((-t * y)) * x;
} else if (y <= 2.7e-9) {
tmp = Math.exp(((-z - b) * a)) * x;
} else {
tmp = Math.exp((-y * ((t * t) / t))) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -2.85e+110: tmp = math.exp((-t * y)) * x elif y <= 2.7e-9: tmp = math.exp(((-z - b) * a)) * x else: tmp = math.exp((-y * ((t * t) / t))) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -2.85e+110) tmp = Float64(exp(Float64(Float64(-t) * y)) * x); elseif (y <= 2.7e-9) tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x); else tmp = Float64(exp(Float64(Float64(-y) * Float64(Float64(t * t) / t))) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -2.85e+110) tmp = exp((-t * y)) * x; elseif (y <= 2.7e-9) tmp = exp(((-z - b) * a)) * x; else tmp = exp((-y * ((t * t) / t))) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.85e+110], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], If[LessEqual[y, 2.7e-9], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], N[(N[Exp[N[((-y) * N[(N[(t * t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.85 \cdot 10^{+110}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-9}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-y\right) \cdot \frac{t \cdot t}{t}} \cdot x\\
\end{array}
\end{array}
if y < -2.8500000000000001e110Initial program 97.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6471.2
Applied rewrites71.2%
if -2.8500000000000001e110 < y < 2.7000000000000002e-9Initial program 96.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6486.0
Applied rewrites86.0%
Taylor expanded in z around 0
Applied rewrites86.0%
if 2.7000000000000002e-9 < y Initial program 98.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6472.9
Applied rewrites72.9%
Applied rewrites72.9%
Final simplification80.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- t) y)) x)))
(if (<= y -2.85e+110)
t_1
(if (<= y 2.7e-9) (* (exp (* (- (- z) b) a)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-t * y)) * x;
double tmp;
if (y <= -2.85e+110) {
tmp = t_1;
} else if (y <= 2.7e-9) {
tmp = exp(((-z - b) * a)) * x;
} 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 = exp((-t * y)) * x
if (y <= (-2.85d+110)) then
tmp = t_1
else if (y <= 2.7d-9) then
tmp = exp(((-z - b) * a)) * x
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 = Math.exp((-t * y)) * x;
double tmp;
if (y <= -2.85e+110) {
tmp = t_1;
} else if (y <= 2.7e-9) {
tmp = Math.exp(((-z - b) * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp((-t * y)) * x tmp = 0 if y <= -2.85e+110: tmp = t_1 elif y <= 2.7e-9: tmp = math.exp(((-z - b) * a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-t) * y)) * x) tmp = 0.0 if (y <= -2.85e+110) tmp = t_1; elseif (y <= 2.7e-9) tmp = Float64(exp(Float64(Float64(Float64(-z) - b) * a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((-t * y)) * x; tmp = 0.0; if (y <= -2.85e+110) tmp = t_1; elseif (y <= 2.7e-9) tmp = exp(((-z - b) * a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -2.85e+110], t$95$1, If[LessEqual[y, 2.7e-9], N[(N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{if}\;y \leq -2.85 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{-9}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.8500000000000001e110 or 2.7000000000000002e-9 < y Initial program 98.2%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6472.3
Applied rewrites72.3%
if -2.8500000000000001e110 < y < 2.7000000000000002e-9Initial program 96.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6486.0
Applied rewrites86.0%
Taylor expanded in z around 0
Applied rewrites86.0%
Final simplification80.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- b) a)) x)))
(if (<= b -11500000000.0)
t_1
(if (<= b 3.2e+51) (* (exp (* (- t) y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-b * a)) * x;
double tmp;
if (b <= -11500000000.0) {
tmp = t_1;
} else if (b <= 3.2e+51) {
tmp = exp((-t * y)) * x;
} 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 = exp((-b * a)) * x
if (b <= (-11500000000.0d0)) then
tmp = t_1
else if (b <= 3.2d+51) then
tmp = exp((-t * y)) * x
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 = Math.exp((-b * a)) * x;
double tmp;
if (b <= -11500000000.0) {
tmp = t_1;
} else if (b <= 3.2e+51) {
tmp = Math.exp((-t * y)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp((-b * a)) * x tmp = 0 if b <= -11500000000.0: tmp = t_1 elif b <= 3.2e+51: tmp = math.exp((-t * y)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-b) * a)) * x) tmp = 0.0 if (b <= -11500000000.0) tmp = t_1; elseif (b <= 3.2e+51) tmp = Float64(exp(Float64(Float64(-t) * y)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((-b * a)) * x; tmp = 0.0; if (b <= -11500000000.0) tmp = t_1; elseif (b <= 3.2e+51) tmp = exp((-t * y)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[b, -11500000000.0], t$95$1, If[LessEqual[b, 3.2e+51], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-b\right) \cdot a} \cdot x\\
\mathbf{if}\;b \leq -11500000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 3.2 \cdot 10^{+51}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.15e10 or 3.2000000000000002e51 < b Initial program 99.2%
Taylor expanded in z around 0
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.2
Applied rewrites99.2%
Taylor expanded in y around 0
Applied rewrites82.3%
if -1.15e10 < b < 3.2000000000000002e51Initial program 95.7%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6473.8
Applied rewrites73.8%
Final simplification77.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- b) a)) x))) (if (<= b -5.1e-92) t_1 (if (<= b 5e-236) (* (exp (* (- z) a)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp((-b * a)) * x;
double tmp;
if (b <= -5.1e-92) {
tmp = t_1;
} else if (b <= 5e-236) {
tmp = exp((-z * a)) * x;
} 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 = exp((-b * a)) * x
if (b <= (-5.1d-92)) then
tmp = t_1
else if (b <= 5d-236) then
tmp = exp((-z * a)) * x
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 = Math.exp((-b * a)) * x;
double tmp;
if (b <= -5.1e-92) {
tmp = t_1;
} else if (b <= 5e-236) {
tmp = Math.exp((-z * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp((-b * a)) * x tmp = 0 if b <= -5.1e-92: tmp = t_1 elif b <= 5e-236: tmp = math.exp((-z * a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(Float64(-b) * a)) * x) tmp = 0.0 if (b <= -5.1e-92) tmp = t_1; elseif (b <= 5e-236) tmp = Float64(exp(Float64(Float64(-z) * a)) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = exp((-b * a)) * x; tmp = 0.0; if (b <= -5.1e-92) tmp = t_1; elseif (b <= 5e-236) tmp = exp((-z * a)) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[b, -5.1e-92], t$95$1, If[LessEqual[b, 5e-236], N[(N[Exp[N[((-z) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(-b\right) \cdot a} \cdot x\\
\mathbf{if}\;b \leq -5.1 \cdot 10^{-92}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 5 \cdot 10^{-236}:\\
\;\;\;\;e^{\left(-z\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -5.09999999999999972e-92 or 4.9999999999999998e-236 < b Initial program 99.0%
Taylor expanded in z around 0
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.0
Applied rewrites99.0%
Taylor expanded in y around 0
Applied rewrites68.9%
if -5.09999999999999972e-92 < b < 4.9999999999999998e-236Initial program 91.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6451.6
Applied rewrites51.6%
Taylor expanded in b around 0
Applied rewrites48.4%
Taylor expanded in z around 0
Applied rewrites48.4%
Final simplification64.1%
(FPCore (x y z t a b) :precision binary64 (if (<= b -1.16e-23) (* (exp (* b a)) x) (* (exp (* (- z) a)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.16e-23) {
tmp = exp((b * a)) * x;
} else {
tmp = exp((-z * a)) * x;
}
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) :: tmp
if (b <= (-1.16d-23)) then
tmp = exp((b * a)) * x
else
tmp = exp((-z * a)) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.16e-23) {
tmp = Math.exp((b * a)) * x;
} else {
tmp = Math.exp((-z * a)) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -1.16e-23: tmp = math.exp((b * a)) * x else: tmp = math.exp((-z * a)) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.16e-23) tmp = Float64(exp(Float64(b * a)) * x); else tmp = Float64(exp(Float64(Float64(-z) * a)) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -1.16e-23) tmp = exp((b * a)) * x; else tmp = exp((-z * a)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.16e-23], N[(N[Exp[N[(b * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], N[(N[Exp[N[((-z) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.16 \cdot 10^{-23}:\\
\;\;\;\;e^{b \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-z\right) \cdot a} \cdot x\\
\end{array}
\end{array}
if b < -1.1599999999999999e-23Initial program 98.8%
Taylor expanded in z around 0
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6498.8
Applied rewrites98.8%
Taylor expanded in y around 0
Applied rewrites76.0%
Applied rewrites76.0%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6476.0
Applied rewrites20.4%
if -1.1599999999999999e-23 < b Initial program 96.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6460.8
Applied rewrites60.8%
Taylor expanded in b around 0
Applied rewrites41.8%
Taylor expanded in z around 0
Applied rewrites41.8%
Final simplification35.0%
(FPCore (x y z t a b) :precision binary64 (* (exp (* b a)) x))
double code(double x, double y, double z, double t, double a, double b) {
return exp((b * a)) * 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 = exp((b * a)) * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.exp((b * a)) * x;
}
def code(x, y, z, t, a, b): return math.exp((b * a)) * x
function code(x, y, z, t, a, b) return Float64(exp(Float64(b * a)) * x) end
function tmp = code(x, y, z, t, a, b) tmp = exp((b * a)) * x; end
code[x_, y_, z_, t_, a_, b_] := N[(N[Exp[N[(b * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
e^{b \cdot a} \cdot x
\end{array}
Initial program 97.3%
Taylor expanded in z around 0
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6497.0
Applied rewrites97.0%
Taylor expanded in y around 0
Applied rewrites60.0%
Applied rewrites59.6%
lift-*.f64N/A
*-commutativeN/A
lower-*.f6459.6
Applied rewrites26.6%
herbie shell --seed 2024298
(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))))))