
(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 (- (fma (- (log1p (- z)) b) a (* (- (log z) t) y))))))
double code(double x, double y, double z, double t, double a, double b) {
return x / exp(-fma((log1p(-z) - b), a, ((log(z) - t) * y)));
}
function code(x, y, z, t, a, b) return Float64(x / exp(Float64(-fma(Float64(log1p(Float64(-z)) - b), a, Float64(Float64(log(z) - t) * y))))) end
code[x_, y_, z_, t_, a_, b_] := N[(x / N[Exp[(-N[(N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision] * a + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{e^{-\mathsf{fma}\left(\mathsf{log1p}\left(-z\right) - b, a, \left(\log z - t\right) \cdot y\right)}}
\end{array}
Initial program 95.2%
lift-*.f64N/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
Applied rewrites98.4%
Final simplification98.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -1.1e-63) (not (<= b 9e-82))) (* x (exp (fma (- b) a (* (log z) y)))) (* x (exp (* (- (log z) t) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.1e-63) || !(b <= 9e-82)) {
tmp = x * exp(fma(-b, a, (log(z) * y)));
} else {
tmp = x * exp(((log(z) - t) * y));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.1e-63) || !(b <= 9e-82)) tmp = Float64(x * exp(fma(Float64(-b), a, Float64(log(z) * y)))); else tmp = Float64(x * exp(Float64(Float64(log(z) - t) * y))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.1e-63], N[Not[LessEqual[b, 9e-82]], $MachinePrecision]], N[(x * N[Exp[N[((-b) * a + N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.1 \cdot 10^{-63} \lor \neg \left(b \leq 9 \cdot 10^{-82}\right):\\
\;\;\;\;x \cdot e^{\mathsf{fma}\left(-b, a, \log z \cdot y\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(\log z - t\right) \cdot y}\\
\end{array}
\end{array}
if b < -1.1e-63 or 8.9999999999999997e-82 < b Initial program 97.5%
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.9
Applied rewrites96.9%
Taylor expanded in t around 0
Applied rewrites91.1%
if -1.1e-63 < b < 8.9999999999999997e-82Initial program 91.6%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-lft-outN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites50.5%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6485.6
Applied rewrites85.6%
Final simplification89.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -0.375) (not (<= b 8.4e+21))) (* x (exp (* (- b) a))) (* x (exp (* (- (log z) t) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -0.375) || !(b <= 8.4e+21)) {
tmp = x * exp((-b * a));
} else {
tmp = x * exp(((log(z) - t) * y));
}
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 <= (-0.375d0)) .or. (.not. (b <= 8.4d+21))) then
tmp = x * exp((-b * a))
else
tmp = x * exp(((log(z) - t) * y))
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 <= -0.375) || !(b <= 8.4e+21)) {
tmp = x * Math.exp((-b * a));
} else {
tmp = x * Math.exp(((Math.log(z) - t) * y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -0.375) or not (b <= 8.4e+21): tmp = x * math.exp((-b * a)) else: tmp = x * math.exp(((math.log(z) - t) * y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -0.375) || !(b <= 8.4e+21)) tmp = Float64(x * exp(Float64(Float64(-b) * a))); else tmp = Float64(x * exp(Float64(Float64(log(z) - t) * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -0.375) || ~((b <= 8.4e+21))) tmp = x * exp((-b * a)); else tmp = x * exp(((log(z) - t) * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -0.375], N[Not[LessEqual[b, 8.4e+21]], $MachinePrecision]], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.375 \lor \neg \left(b \leq 8.4 \cdot 10^{+21}\right):\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(\log z - t\right) \cdot y}\\
\end{array}
\end{array}
if b < -0.375 or 8.4e21 < b Initial program 96.7%
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 y around 0
Applied rewrites84.2%
if -0.375 < b < 8.4e21Initial program 93.9%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-lft-outN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites45.8%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6481.9
Applied rewrites81.9%
Final simplification83.0%
(FPCore (x y z t a b) :precision binary64 (* x (exp (fma (- a) (+ z b) (* (- (log z) t) y)))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(-a, (z + b), ((log(z) - t) * y)));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(Float64(-a), Float64(z + b), Float64(Float64(log(z) - t) * y)))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-a) * N[(z + b), $MachinePrecision] + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(-a, z + b, \left(\log z - t\right) \cdot y\right)}
\end{array}
Initial program 95.2%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-lft-outN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6498.4
Applied rewrites98.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.9e+99) (not (<= y 3.5e+52))) (* x (exp (* (log z) y))) (* x (exp (* (- b) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.9e+99) || !(y <= 3.5e+52)) {
tmp = x * exp((log(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 <= (-4.9d+99)) .or. (.not. (y <= 3.5d+52))) then
tmp = x * exp((log(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 <= -4.9e+99) || !(y <= 3.5e+52)) {
tmp = x * Math.exp((Math.log(z) * y));
} else {
tmp = x * Math.exp((-b * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.9e+99) or not (y <= 3.5e+52): tmp = x * math.exp((math.log(z) * y)) else: tmp = x * math.exp((-b * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.9e+99) || !(y <= 3.5e+52)) tmp = Float64(x * exp(Float64(log(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 <= -4.9e+99) || ~((y <= 3.5e+52))) tmp = x * exp((log(z) * y)); else tmp = x * exp((-b * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.9e+99], N[Not[LessEqual[y, 3.5e+52]], $MachinePrecision]], N[(x * N[Exp[N[(N[Log[z], $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{+99} \lor \neg \left(y \leq 3.5 \cdot 10^{+52}\right):\\
\;\;\;\;x \cdot e^{\log z \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\end{array}
\end{array}
if y < -4.8999999999999997e99 or 3.5e52 < y Initial program 95.6%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-lft-outN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6495.6
Applied rewrites95.6%
Taylor expanded in z around inf
Applied rewrites21.7%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6486.9
Applied rewrites86.9%
Taylor expanded in t around 0
Applied rewrites79.2%
if -4.8999999999999997e99 < y < 3.5e52Initial program 95.1%
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.f6493.3
Applied rewrites93.3%
Taylor expanded in y around 0
Applied rewrites74.5%
Final simplification76.2%
(FPCore (x y z t a b) :precision binary64 (* x (exp (fma (- b) a (* (- (log z) t) y)))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(-b, a, ((log(z) - t) * y)));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(Float64(-b), a, Float64(Float64(log(z) - t) * y)))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-b) * a + N[(N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(-b, a, \left(\log z - t\right) \cdot y\right)}
\end{array}
Initial program 95.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.f6494.1
Applied rewrites94.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -0.375) (not (<= b 2.3e-79))) (* x (exp (* (- b) a))) (/ x (exp (* y t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -0.375) || !(b <= 2.3e-79)) {
tmp = x * exp((-b * a));
} else {
tmp = x / exp((y * t));
}
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 <= (-0.375d0)) .or. (.not. (b <= 2.3d-79))) then
tmp = x * exp((-b * a))
else
tmp = x / exp((y * t))
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 <= -0.375) || !(b <= 2.3e-79)) {
tmp = x * Math.exp((-b * a));
} else {
tmp = x / Math.exp((y * t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -0.375) or not (b <= 2.3e-79): tmp = x * math.exp((-b * a)) else: tmp = x / math.exp((y * t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -0.375) || !(b <= 2.3e-79)) tmp = Float64(x * exp(Float64(Float64(-b) * a))); else tmp = Float64(x / exp(Float64(y * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -0.375) || ~((b <= 2.3e-79))) tmp = x * exp((-b * a)); else tmp = x / exp((y * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -0.375], N[Not[LessEqual[b, 2.3e-79]], $MachinePrecision]], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x / N[Exp[N[(y * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.375 \lor \neg \left(b \leq 2.3 \cdot 10^{-79}\right):\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{e^{y \cdot t}}\\
\end{array}
\end{array}
if b < -0.375 or 2.30000000000000012e-79 < b Initial 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.f6497.2
Applied rewrites97.2%
Taylor expanded in y around 0
Applied rewrites81.6%
if -0.375 < b < 2.30000000000000012e-79Initial program 92.9%
lift-*.f64N/A
lift-exp.f64N/A
sinh-+-cosh-revN/A
flip-+N/A
sinh-coshN/A
sinh---cosh-revN/A
Applied rewrites100.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6468.5
Applied rewrites68.5%
lift-*.f64N/A
*-rgt-identity68.5
Applied rewrites68.5%
Final simplification75.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -0.375) (not (<= b 2.3e-79))) (* x (exp (* (- b) a))) (* x (exp (* (- y) t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -0.375) || !(b <= 2.3e-79)) {
tmp = x * exp((-b * a));
} else {
tmp = x * exp((-y * t));
}
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 <= (-0.375d0)) .or. (.not. (b <= 2.3d-79))) then
tmp = x * exp((-b * a))
else
tmp = x * exp((-y * t))
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 <= -0.375) || !(b <= 2.3e-79)) {
tmp = x * Math.exp((-b * a));
} else {
tmp = x * Math.exp((-y * t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -0.375) or not (b <= 2.3e-79): tmp = x * math.exp((-b * a)) else: tmp = x * math.exp((-y * t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -0.375) || !(b <= 2.3e-79)) tmp = Float64(x * exp(Float64(Float64(-b) * a))); else tmp = Float64(x * exp(Float64(Float64(-y) * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -0.375) || ~((b <= 2.3e-79))) tmp = x * exp((-b * a)); else tmp = x * exp((-y * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -0.375], N[Not[LessEqual[b, 2.3e-79]], $MachinePrecision]], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-y) * t), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.375 \lor \neg \left(b \leq 2.3 \cdot 10^{-79}\right):\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-y\right) \cdot t}\\
\end{array}
\end{array}
if b < -0.375 or 2.30000000000000012e-79 < b Initial 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.f6497.2
Applied rewrites97.2%
Taylor expanded in y around 0
Applied rewrites81.6%
if -0.375 < b < 2.30000000000000012e-79Initial program 92.9%
Taylor expanded in t around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6468.5
Applied rewrites68.5%
Final simplification75.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= b -4.5e-131) (not (<= b 3.8e-90))) (* x (exp (* (- b) a))) (* x (exp (* (- a) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -4.5e-131) || !(b <= 3.8e-90)) {
tmp = x * exp((-b * a));
} else {
tmp = x * exp((-a * z));
}
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 <= (-4.5d-131)) .or. (.not. (b <= 3.8d-90))) then
tmp = x * exp((-b * a))
else
tmp = x * exp((-a * z))
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 <= -4.5e-131) || !(b <= 3.8e-90)) {
tmp = x * Math.exp((-b * a));
} else {
tmp = x * Math.exp((-a * z));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (b <= -4.5e-131) or not (b <= 3.8e-90): tmp = x * math.exp((-b * a)) else: tmp = x * math.exp((-a * z)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -4.5e-131) || !(b <= 3.8e-90)) tmp = Float64(x * exp(Float64(Float64(-b) * a))); else tmp = Float64(x * exp(Float64(Float64(-a) * z))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((b <= -4.5e-131) || ~((b <= 3.8e-90))) tmp = x * exp((-b * a)); else tmp = x * exp((-a * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -4.5e-131], N[Not[LessEqual[b, 3.8e-90]], $MachinePrecision]], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-a) * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -4.5 \cdot 10^{-131} \lor \neg \left(b \leq 3.8 \cdot 10^{-90}\right):\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot z}\\
\end{array}
\end{array}
if b < -4.5000000000000002e-131 or 3.8e-90 < b Initial program 97.7%
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.2
Applied rewrites97.2%
Taylor expanded in y around 0
Applied rewrites76.5%
if -4.5000000000000002e-131 < b < 3.8e-90Initial program 89.9%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-lft-outN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites53.3%
Final simplification69.2%
(FPCore (x y z t a b) :precision binary64 (* x (exp (* (- a) z))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp((-a * z));
}
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 * z))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp((-a * z));
}
def code(x, y, z, t, a, b): return x * math.exp((-a * z))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(-a) * z))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp((-a * z)); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[((-a) * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\left(-a\right) \cdot z}
\end{array}
Initial program 95.2%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate-*r*N/A
associate-*r*N/A
distribute-lft-outN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6498.4
Applied rewrites98.4%
Taylor expanded in z around inf
Applied rewrites34.5%
herbie shell --seed 2024339
(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))))))