
(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 12 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 (if (<= a -2e+188) (* x (exp (* (- a) (+ z b)))) (* x (exp (fma (- b) a (* (- (log z) t) y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2e+188) {
tmp = x * exp((-a * (z + b)));
} else {
tmp = x * exp(fma(-b, a, ((log(z) - t) * y)));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2e+188) tmp = Float64(x * exp(Float64(Float64(-a) * Float64(z + b)))); else tmp = Float64(x * exp(fma(Float64(-b), a, Float64(Float64(log(z) - t) * y)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2e+188], N[(x * N[Exp[N[((-a) * N[(z + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-b) * a + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2 \cdot 10^{+188}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \left(\log z - t\right) \cdot y\right)}\\
\end{array}
\end{array}
if a < -2e188Initial program 82.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6496.6
Applied rewrites96.6%
Taylor expanded in z around 0
Applied rewrites96.6%
if -2e188 < a Initial program 97.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.f6497.8
Applied rewrites97.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))) (if (or (<= t_1 -5e+22) (not (<= t_1 5e+21))) (* (- a) (* b x)) (* x 1.0))))
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 <= -5e+22) || !(t_1 <= 5e+21)) {
tmp = -a * (b * x);
} else {
tmp = x * 1.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
real(8) :: t_1
real(8) :: tmp
t_1 = (y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))
if ((t_1 <= (-5d+22)) .or. (.not. (t_1 <= 5d+21))) then
tmp = -a * (b * x)
else
tmp = x * 1.0d0
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 = (y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b));
double tmp;
if ((t_1 <= -5e+22) || !(t_1 <= 5e+21)) {
tmp = -a * (b * x);
} else {
tmp = x * 1.0;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b)) tmp = 0 if (t_1 <= -5e+22) or not (t_1 <= 5e+21): tmp = -a * (b * x) else: tmp = x * 1.0 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 <= -5e+22) || !(t_1 <= 5e+21)) tmp = Float64(Float64(-a) * Float64(b * x)); else tmp = Float64(x * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (y * (log(z) - t)) + (a * (log((1.0 - z)) - b)); tmp = 0.0; if ((t_1 <= -5e+22) || ~((t_1 <= 5e+21))) tmp = -a * (b * x); else tmp = x * 1.0; end tmp_2 = 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[Or[LessEqual[t$95$1, -5e+22], N[Not[LessEqual[t$95$1, 5e+21]], $MachinePrecision]], N[((-a) * N[(b * x), $MachinePrecision]), $MachinePrecision], N[(x * 1.0), $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 -5 \cdot 10^{+22} \lor \neg \left(t\_1 \leq 5 \cdot 10^{+21}\right):\\
\;\;\;\;\left(-a\right) \cdot \left(b \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1\\
\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))) < -4.9999999999999996e22 or 5e21 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 96.5%
Taylor expanded in a around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-fma.f64N/A
Applied rewrites60.8%
Taylor expanded in y around 0
Applied rewrites12.0%
Taylor expanded in b around inf
Applied rewrites17.8%
if -4.9999999999999996e22 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 5e21Initial program 94.7%
Taylor expanded in a around 0
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6465.9
Applied rewrites65.9%
Taylor expanded in y around 0
Applied rewrites81.5%
Final simplification31.5%
(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 96.1%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))) -5e+22) (* (- a) (* b x)) (fma (- a) (fma z x (* b 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))) <= -5e+22) {
tmp = -a * (b * x);
} else {
tmp = fma(-a, fma(z, x, (b * 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))) <= -5e+22) tmp = Float64(Float64(-a) * Float64(b * x)); else tmp = fma(Float64(-a), fma(z, x, Float64(b * 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], -5e+22], N[((-a) * N[(b * x), $MachinePrecision]), $MachinePrecision], N[((-a) * N[(z * x + N[(b * x), $MachinePrecision]), $MachinePrecision] + 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 -5 \cdot 10^{+22}:\\
\;\;\;\;\left(-a\right) \cdot \left(b \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, \mathsf{fma}\left(z, x, b \cdot x\right), 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))) < -4.9999999999999996e22Initial program 97.3%
Taylor expanded in a around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in y around 0
Applied rewrites3.9%
Taylor expanded in b around inf
Applied rewrites14.1%
if -4.9999999999999996e22 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 95.2%
Taylor expanded in a around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-fma.f64N/A
Applied rewrites65.7%
Taylor expanded in y around 0
Applied rewrites44.4%
Taylor expanded in z around 0
Applied rewrites45.0%
(FPCore (x y z t a b) :precision binary64 (if (<= (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))) -5e+22) (* (- a) (* b x)) (- x (* (* b x) a))))
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))) <= -5e+22) {
tmp = -a * (b * x);
} else {
tmp = x - ((b * x) * a);
}
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 * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))) <= (-5d+22)) then
tmp = -a * (b * x)
else
tmp = x - ((b * x) * a)
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 * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))) <= -5e+22) {
tmp = -a * (b * x);
} else {
tmp = x - ((b * x) * a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if ((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))) <= -5e+22: tmp = -a * (b * x) else: tmp = x - ((b * x) * a) 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))) <= -5e+22) tmp = Float64(Float64(-a) * Float64(b * x)); else tmp = Float64(x - Float64(Float64(b * x) * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))) <= -5e+22) tmp = -a * (b * x); else tmp = x - ((b * x) * a); end tmp_2 = 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], -5e+22], N[((-a) * N[(b * x), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(b * x), $MachinePrecision] * a), $MachinePrecision]), $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 -5 \cdot 10^{+22}:\\
\;\;\;\;\left(-a\right) \cdot \left(b \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \left(b \cdot x\right) \cdot a\\
\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))) < -4.9999999999999996e22Initial program 97.3%
Taylor expanded in a around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-fma.f64N/A
Applied rewrites56.4%
Taylor expanded in y around 0
Applied rewrites3.9%
Taylor expanded in b around inf
Applied rewrites14.1%
if -4.9999999999999996e22 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 95.2%
Taylor expanded in a around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-fma.f64N/A
Applied rewrites65.7%
Taylor expanded in y around 0
Applied rewrites44.4%
Taylor expanded in z around 0
Applied rewrites45.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.55e-57) (not (<= y 1.25e+20))) (* x (exp (* (- (log z) t) y))) (* x (exp (* (- a) (+ z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.55e-57) || !(y <= 1.25e+20)) {
tmp = x * exp(((log(z) - t) * y));
} else {
tmp = x * exp((-a * (z + b)));
}
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 <= (-4.55d-57)) .or. (.not. (y <= 1.25d+20))) then
tmp = x * exp(((log(z) - t) * y))
else
tmp = x * exp((-a * (z + b)))
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 <= -4.55e-57) || !(y <= 1.25e+20)) {
tmp = x * Math.exp(((Math.log(z) - t) * y));
} else {
tmp = x * Math.exp((-a * (z + b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.55e-57) or not (y <= 1.25e+20): tmp = x * math.exp(((math.log(z) - t) * y)) else: tmp = x * math.exp((-a * (z + b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.55e-57) || !(y <= 1.25e+20)) tmp = Float64(x * exp(Float64(Float64(log(z) - t) * y))); else tmp = Float64(x * exp(Float64(Float64(-a) * Float64(z + b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -4.55e-57) || ~((y <= 1.25e+20))) tmp = x * exp(((log(z) - t) * y)); else tmp = x * exp((-a * (z + b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.55e-57], N[Not[LessEqual[y, 1.25e+20]], $MachinePrecision]], N[(x * N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-a) * N[(z + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.55 \cdot 10^{-57} \lor \neg \left(y \leq 1.25 \cdot 10^{+20}\right):\\
\;\;\;\;x \cdot e^{\left(\log z - t\right) \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\
\end{array}
\end{array}
if y < -4.55000000000000017e-57 or 1.25e20 < y Initial program 96.8%
Taylor expanded in a around 0
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6485.2
Applied rewrites85.2%
Applied rewrites86.0%
if -4.55000000000000017e-57 < y < 1.25e20Initial program 95.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6491.3
Applied rewrites91.3%
Taylor expanded in z around 0
Applied rewrites91.3%
Final simplification88.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* (- t) y)))))
(if (<= t -120.0)
t_1
(if (<= t -1.3e-268)
(* x (pow z y))
(if (<= t 1.05e+94) (* 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((-t * y));
double tmp;
if (t <= -120.0) {
tmp = t_1;
} else if (t <= -1.3e-268) {
tmp = x * pow(z, y);
} else if (t <= 1.05e+94) {
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((-t * y))
if (t <= (-120.0d0)) then
tmp = t_1
else if (t <= (-1.3d-268)) then
tmp = x * (z ** y)
else if (t <= 1.05d+94) 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((-t * y));
double tmp;
if (t <= -120.0) {
tmp = t_1;
} else if (t <= -1.3e-268) {
tmp = x * Math.pow(z, y);
} else if (t <= 1.05e+94) {
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((-t * y)) tmp = 0 if t <= -120.0: tmp = t_1 elif t <= -1.3e-268: tmp = x * math.pow(z, y) elif t <= 1.05e+94: 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(Float64(-t) * y))) tmp = 0.0 if (t <= -120.0) tmp = t_1; elseif (t <= -1.3e-268) tmp = Float64(x * (z ^ y)); elseif (t <= 1.05e+94) tmp = Float64(x * exp(Float64(Float64(-a) * 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((-t * y)); tmp = 0.0; if (t <= -120.0) tmp = t_1; elseif (t <= -1.3e-268) tmp = x * (z ^ y); elseif (t <= 1.05e+94) 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[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -120.0], t$95$1, If[LessEqual[t, -1.3e-268], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.05e+94], 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^{\left(-t\right) \cdot y}\\
\mathbf{if}\;t \leq -120:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.3 \cdot 10^{-268}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{+94}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -120 or 1.04999999999999995e94 < t Initial program 94.0%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6477.1
Applied rewrites77.1%
if -120 < t < -1.30000000000000001e-268Initial program 98.2%
Taylor expanded in a around 0
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6476.8
Applied rewrites76.8%
Taylor expanded in t around 0
Applied rewrites76.8%
if -1.30000000000000001e-268 < t < 1.04999999999999995e94Initial program 97.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6482.8
Applied rewrites82.8%
Taylor expanded in z around 0
Applied rewrites82.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* (- t) y)))))
(if (<= t -120.0)
t_1
(if (<= t -1.1e-268)
(* x (pow z y))
(if (<= t 1.66e+71) (* x (exp (* (- b) a))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((-t * y));
double tmp;
if (t <= -120.0) {
tmp = t_1;
} else if (t <= -1.1e-268) {
tmp = x * pow(z, y);
} else if (t <= 1.66e+71) {
tmp = x * exp((-b * a));
} 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((-t * y))
if (t <= (-120.0d0)) then
tmp = t_1
else if (t <= (-1.1d-268)) then
tmp = x * (z ** y)
else if (t <= 1.66d+71) then
tmp = x * exp((-b * a))
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((-t * y));
double tmp;
if (t <= -120.0) {
tmp = t_1;
} else if (t <= -1.1e-268) {
tmp = x * Math.pow(z, y);
} else if (t <= 1.66e+71) {
tmp = x * Math.exp((-b * a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((-t * y)) tmp = 0 if t <= -120.0: tmp = t_1 elif t <= -1.1e-268: tmp = x * math.pow(z, y) elif t <= 1.66e+71: tmp = x * math.exp((-b * a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(Float64(-t) * y))) tmp = 0.0 if (t <= -120.0) tmp = t_1; elseif (t <= -1.1e-268) tmp = Float64(x * (z ^ y)); elseif (t <= 1.66e+71) tmp = Float64(x * exp(Float64(Float64(-b) * a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((-t * y)); tmp = 0.0; if (t <= -120.0) tmp = t_1; elseif (t <= -1.1e-268) tmp = x * (z ^ y); elseif (t <= 1.66e+71) tmp = x * exp((-b * a)); 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[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -120.0], t$95$1, If[LessEqual[t, -1.1e-268], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.66e+71], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{if}\;t \leq -120:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.1 \cdot 10^{-268}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{elif}\;t \leq 1.66 \cdot 10^{+71}:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -120 or 1.65999999999999995e71 < t Initial program 93.3%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6476.8
Applied rewrites76.8%
if -120 < t < -1.10000000000000002e-268Initial program 98.2%
Taylor expanded in a around 0
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6476.8
Applied rewrites76.8%
Taylor expanded in t around 0
Applied rewrites76.8%
if -1.10000000000000002e-268 < t < 1.65999999999999995e71Initial program 98.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.f6496.0
Applied rewrites96.0%
Taylor expanded in y around 0
Applied rewrites78.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.4) (not (<= y 1950.0))) (* x (pow z y)) (* x (exp (* (- b) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.4) || !(y <= 1950.0)) {
tmp = x * pow(z, y);
} else {
tmp = x * exp((-b * a));
}
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.4d0)) .or. (.not. (y <= 1950.0d0))) then
tmp = x * (z ** y)
else
tmp = x * exp((-b * a))
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.4) || !(y <= 1950.0)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * Math.exp((-b * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.4) or not (y <= 1950.0): tmp = x * math.pow(z, y) else: tmp = x * math.exp((-b * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.4) || !(y <= 1950.0)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(Float64(-b) * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.4) || ~((y <= 1950.0))) tmp = x * (z ^ y); else tmp = x * exp((-b * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.4], N[Not[LessEqual[y, 1950.0]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.4 \lor \neg \left(y \leq 1950\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\end{array}
\end{array}
if y < -2.39999999999999991 or 1950 < y Initial program 96.7%
Taylor expanded in a around 0
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6486.4
Applied rewrites86.4%
Taylor expanded in t around 0
Applied rewrites59.2%
if -2.39999999999999991 < y < 1950Initial program 95.6%
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.f6494.1
Applied rewrites94.1%
Taylor expanded in y around 0
Applied rewrites81.4%
Final simplification70.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -15.5) (not (<= y 1850.0))) (* x (pow z y)) (* x (exp (* (- z) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -15.5) || !(y <= 1850.0)) {
tmp = x * pow(z, y);
} else {
tmp = x * exp((-z * a));
}
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 <= (-15.5d0)) .or. (.not. (y <= 1850.0d0))) then
tmp = x * (z ** y)
else
tmp = x * exp((-z * a))
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 <= -15.5) || !(y <= 1850.0)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * Math.exp((-z * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -15.5) or not (y <= 1850.0): tmp = x * math.pow(z, y) else: tmp = x * math.exp((-z * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -15.5) || !(y <= 1850.0)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(Float64(-z) * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -15.5) || ~((y <= 1850.0))) tmp = x * (z ^ y); else tmp = x * exp((-z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -15.5], N[Not[LessEqual[y, 1850.0]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-z) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -15.5 \lor \neg \left(y \leq 1850\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-z\right) \cdot a}\\
\end{array}
\end{array}
if y < -15.5 or 1850 < y Initial program 96.7%
Taylor expanded in a around 0
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6486.4
Applied rewrites86.4%
Taylor expanded in t around 0
Applied rewrites59.2%
if -15.5 < y < 1850Initial program 95.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6489.4
Applied rewrites89.4%
Taylor expanded in z around 0
Applied rewrites89.4%
Taylor expanded in z around inf
Applied rewrites56.7%
Final simplification57.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1100.0) (fma (fma (- x) a (* (* (* z x) a) -0.5)) z (- x (* (* b x) a))) (* x (pow z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1100.0) {
tmp = fma(fma(-x, a, (((z * x) * a) * -0.5)), z, (x - ((b * x) * a)));
} else {
tmp = x * pow(z, y);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1100.0) tmp = fma(fma(Float64(-x), a, Float64(Float64(Float64(z * x) * a) * -0.5)), z, Float64(x - Float64(Float64(b * x) * a))); else tmp = Float64(x * (z ^ y)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1100.0], N[(N[((-x) * a + N[(N[(N[(z * x), $MachinePrecision] * a), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] * z + N[(x - N[(N[(b * x), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1100:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-x, a, \left(\left(z \cdot x\right) \cdot a\right) \cdot -0.5\right), z, x - \left(b \cdot x\right) \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -1100Initial program 95.7%
Taylor expanded in a around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
lower-*.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f64N/A
lower-fma.f64N/A
Applied rewrites67.8%
Taylor expanded in y around 0
Applied rewrites23.9%
Taylor expanded in z around 0
Applied rewrites26.3%
if -1100 < t Initial program 96.3%
Taylor expanded in a around 0
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6464.7
Applied rewrites64.7%
Taylor expanded in t around 0
Applied rewrites59.3%
(FPCore (x y z t a b) :precision binary64 (* x 1.0))
double code(double x, double y, double z, double t, double a, double b) {
return x * 1.0;
}
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 * 1.0d0
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 1.0;
}
def code(x, y, z, t, a, b): return x * 1.0
function code(x, y, z, t, a, b) return Float64(x * 1.0) end
function tmp = code(x, y, z, t, a, b) tmp = x * 1.0; end
code[x_, y_, z_, t_, a_, b_] := N[(x * 1.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 1
\end{array}
Initial program 96.1%
Taylor expanded in a around 0
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6467.9
Applied rewrites67.9%
Taylor expanded in y around 0
Applied rewrites20.5%
herbie shell --seed 2024313
(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))))))