
(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 9 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 (fma (- a) b (* (- (log z) t) y))) x))
double code(double x, double y, double z, double t, double a, double b) {
return exp(fma(-a, b, ((log(z) - t) * y))) * x;
}
function code(x, y, z, t, a, b) return Float64(exp(fma(Float64(-a), b, Float64(Float64(log(z) - t) * y))) * x) end
code[x_, y_, z_, t_, a_, b_] := N[(N[Exp[N[((-a) * b + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]
\begin{array}{l}
\\
e^{\mathsf{fma}\left(-a, b, \left(\log z - t\right) \cdot y\right)} \cdot x
\end{array}
Initial program 96.1%
Taylor expanded in z around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6496.2
Applied rewrites96.2%
Final simplification96.2%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (* (- (log (- 1.0 z)) b) a) (* (- (log z) t) y)) -1e-8) (* (* (* y y) x) (* (* t t) 0.5)) (fma (* (* (* (* t t) y) 0.5) y) x x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((((log((1.0 - z)) - b) * a) + ((log(z) - t) * y)) <= -1e-8) {
tmp = ((y * y) * x) * ((t * t) * 0.5);
} else {
tmp = fma(((((t * t) * y) * 0.5) * y), x, x);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(Float64(log(Float64(1.0 - z)) - b) * a) + Float64(Float64(log(z) - t) * y)) <= -1e-8) tmp = Float64(Float64(Float64(y * y) * x) * Float64(Float64(t * t) * 0.5)); else tmp = fma(Float64(Float64(Float64(Float64(t * t) * y) * 0.5) * y), x, x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] * a), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], -1e-8], N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(t * t), $MachinePrecision] * y), $MachinePrecision] * 0.5), $MachinePrecision] * y), $MachinePrecision] * x + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y \leq -1 \cdot 10^{-8}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(\left(t \cdot t\right) \cdot y\right) \cdot 0.5\right) \cdot y, 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))) < -1e-8Initial program 97.3%
Taylor expanded in y around 0
Applied rewrites36.6%
Taylor expanded in a around 0
Applied rewrites4.4%
Taylor expanded in t around inf
Applied rewrites30.0%
if -1e-8 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 95.4%
Taylor expanded in y around 0
Applied rewrites62.5%
Taylor expanded in a around 0
Applied rewrites68.2%
Taylor expanded in t around inf
Applied rewrites59.6%
Final simplification47.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- t) y)) x)))
(if (<= t -8e+21)
t_1
(if (<= t 1.15e+155) (* (exp (fma (- a) b (* (log z) y))) 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 (t <= -8e+21) {
tmp = t_1;
} else if (t <= 1.15e+155) {
tmp = exp(fma(-a, b, (log(z) * y))) * 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 (t <= -8e+21) tmp = t_1; elseif (t <= 1.15e+155) tmp = Float64(exp(fma(Float64(-a), b, 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[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -8e+21], t$95$1, If[LessEqual[t, 1.15e+155], N[(N[Exp[N[((-a) * b + N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $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}\;t \leq -8 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+155}:\\
\;\;\;\;e^{\mathsf{fma}\left(-a, b, \log z \cdot y\right)} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -8e21 or 1.14999999999999999e155 < t Initial program 94.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6482.0
Applied rewrites82.0%
if -8e21 < t < 1.14999999999999999e155Initial program 97.0%
Taylor expanded in z around 0
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6495.9
Applied rewrites95.9%
Taylor expanded in t around 0
Applied rewrites95.3%
Final simplification90.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- (log z) t) y)) x)))
(if (<= y -140.0)
t_1
(if (<= y 4.2e-47) (* (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 <= -140.0) {
tmp = t_1;
} else if (y <= 4.2e-47) {
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 <= (-140.0d0)) then
tmp = t_1
else if (y <= 4.2d-47) 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 <= -140.0) {
tmp = t_1;
} else if (y <= 4.2e-47) {
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 <= -140.0: tmp = t_1 elif y <= 4.2e-47: 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 <= -140.0) tmp = t_1; elseif (y <= 4.2e-47) 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 <= -140.0) tmp = t_1; elseif (y <= 4.2e-47) 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, -140.0], t$95$1, If[LessEqual[y, 4.2e-47], 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 -140:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.2 \cdot 10^{-47}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -140 or 4.2000000000000001e-47 < y Initial program 96.0%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6487.8
Applied rewrites87.8%
if -140 < y < 4.2000000000000001e-47Initial program 96.3%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6488.5
Applied rewrites88.5%
Taylor expanded in z around 0
Applied rewrites88.5%
Final simplification88.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (log z) y)) x)))
(if (<= y -140.0)
t_1
(if (<= y 2.7e+68) (* (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) * y)) * x;
double tmp;
if (y <= -140.0) {
tmp = t_1;
} else if (y <= 2.7e+68) {
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) * y)) * x
if (y <= (-140.0d0)) then
tmp = t_1
else if (y <= 2.7d+68) 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) * y)) * x;
double tmp;
if (y <= -140.0) {
tmp = t_1;
} else if (y <= 2.7e+68) {
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) * y)) * x tmp = 0 if y <= -140.0: tmp = t_1 elif y <= 2.7e+68: 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(log(z) * y)) * x) tmp = 0.0 if (y <= -140.0) tmp = t_1; elseif (y <= 2.7e+68) 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) * y)) * x; tmp = 0.0; if (y <= -140.0) tmp = t_1; elseif (y <= 2.7e+68) 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[Log[z], $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -140.0], t$95$1, If[LessEqual[y, 2.7e+68], 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^{\log z \cdot y} \cdot x\\
\mathbf{if}\;y \leq -140:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.7 \cdot 10^{+68}:\\
\;\;\;\;e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -140 or 2.69999999999999991e68 < y Initial program 95.2%
Taylor expanded in a around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6489.8
Applied rewrites89.8%
Taylor expanded in t around 0
Applied rewrites75.6%
if -140 < y < 2.69999999999999991e68Initial program 97.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6482.2
Applied rewrites82.2%
Taylor expanded in z around 0
Applied rewrites82.2%
Final simplification79.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- (- z) b) a)) x))) (if (<= a -5.9e+82) t_1 (if (<= a 1.05e+26) (* (exp (* (- t) y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(((-z - b) * a)) * x;
double tmp;
if (a <= -5.9e+82) {
tmp = t_1;
} else if (a <= 1.05e+26) {
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(((-z - b) * a)) * x
if (a <= (-5.9d+82)) then
tmp = t_1
else if (a <= 1.05d+26) 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(((-z - b) * a)) * x;
double tmp;
if (a <= -5.9e+82) {
tmp = t_1;
} else if (a <= 1.05e+26) {
tmp = Math.exp((-t * y)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.exp(((-z - b) * a)) * x tmp = 0 if a <= -5.9e+82: tmp = t_1 elif a <= 1.05e+26: 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(Float64(-z) - b) * a)) * x) tmp = 0.0 if (a <= -5.9e+82) tmp = t_1; elseif (a <= 1.05e+26) 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(((-z - b) * a)) * x; tmp = 0.0; if (a <= -5.9e+82) tmp = t_1; elseif (a <= 1.05e+26) 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[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[a, -5.9e+82], t$95$1, If[LessEqual[a, 1.05e+26], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{\left(\left(-z\right) - b\right) \cdot a} \cdot x\\
\mathbf{if}\;a \leq -5.9 \cdot 10^{+82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{+26}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.8999999999999997e82 or 1.05e26 < a Initial program 91.0%
Taylor expanded in a around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6478.6
Applied rewrites78.6%
Taylor expanded in z around 0
Applied rewrites78.6%
if -5.8999999999999997e82 < a < 1.05e26Initial program 100.0%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6469.0
Applied rewrites69.0%
Final simplification73.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- b) a)) x))) (if (<= b -1.9e+48) t_1 (if (<= b 1e-40) (* (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 <= -1.9e+48) {
tmp = t_1;
} else if (b <= 1e-40) {
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 <= (-1.9d+48)) then
tmp = t_1
else if (b <= 1d-40) 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 <= -1.9e+48) {
tmp = t_1;
} else if (b <= 1e-40) {
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 <= -1.9e+48: tmp = t_1 elif b <= 1e-40: 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 <= -1.9e+48) tmp = t_1; elseif (b <= 1e-40) 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 <= -1.9e+48) tmp = t_1; elseif (b <= 1e-40) 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, -1.9e+48], t$95$1, If[LessEqual[b, 1e-40], 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 -1.9 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 10^{-40}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.9e48 or 9.9999999999999993e-41 < b Initial program 95.5%
Taylor expanded in b around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6477.1
Applied rewrites77.1%
if -1.9e48 < b < 9.9999999999999993e-41Initial program 96.6%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6467.5
Applied rewrites67.5%
Final simplification71.7%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.5e+123) (* (* (* y y) x) (* (* t t) 0.5)) (* (exp (* (- b) a)) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.5e+123) {
tmp = ((y * y) * x) * ((t * t) * 0.5);
} else {
tmp = exp((-b * 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 (y <= (-1.5d+123)) then
tmp = ((y * y) * x) * ((t * t) * 0.5d0)
else
tmp = exp((-b * 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 (y <= -1.5e+123) {
tmp = ((y * y) * x) * ((t * t) * 0.5);
} else {
tmp = Math.exp((-b * a)) * x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.5e+123: tmp = ((y * y) * x) * ((t * t) * 0.5) else: tmp = math.exp((-b * a)) * x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.5e+123) tmp = Float64(Float64(Float64(y * y) * x) * Float64(Float64(t * t) * 0.5)); else tmp = Float64(exp(Float64(Float64(-b) * a)) * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.5e+123) tmp = ((y * y) * x) * ((t * t) * 0.5); else tmp = exp((-b * a)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.5e+123], N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+123}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(-b\right) \cdot a} \cdot x\\
\end{array}
\end{array}
if y < -1.50000000000000004e123Initial program 89.2%
Taylor expanded in y around 0
Applied rewrites60.1%
Taylor expanded in a around 0
Applied rewrites73.5%
Taylor expanded in t around inf
Applied rewrites59.8%
if -1.50000000000000004e123 < y Initial program 97.3%
Taylor expanded in b around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6459.7
Applied rewrites59.7%
Final simplification59.7%
(FPCore (x y z t a b) :precision binary64 (* (* (* y y) x) (* (* t t) 0.5)))
double code(double x, double y, double z, double t, double a, double b) {
return ((y * y) * x) * ((t * t) * 0.5);
}
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 * y) * x) * ((t * t) * 0.5d0)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((y * y) * x) * ((t * t) * 0.5);
}
def code(x, y, z, t, a, b): return ((y * y) * x) * ((t * t) * 0.5)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(y * y) * x) * Float64(Float64(t * t) * 0.5)) end
function tmp = code(x, y, z, t, a, b) tmp = ((y * y) * x) * ((t * t) * 0.5); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision] * N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y \cdot y\right) \cdot x\right) \cdot \left(\left(t \cdot t\right) \cdot 0.5\right)
\end{array}
Initial program 96.1%
Taylor expanded in y around 0
Applied rewrites51.7%
Taylor expanded in a around 0
Applied rewrites41.5%
Taylor expanded in t around inf
Applied rewrites30.9%
Final simplification30.9%
herbie shell --seed 2024270
(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))))))