
(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 11 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 2.5e+166) (* (exp (+ (* (- (log (- 1.0 z)) b) a) (* (- (log z) t) y))) x) (* (exp (- (fma a z (* b a)))) x)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= 2.5e+166) {
tmp = exp((((log((1.0 - z)) - b) * a) + ((log(z) - t) * y))) * x;
} else {
tmp = exp(-fma(a, z, (b * a))) * x;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= 2.5e+166) tmp = Float64(exp(Float64(Float64(Float64(log(Float64(1.0 - z)) - b) * a) + Float64(Float64(log(z) - t) * y))) * x); else tmp = Float64(exp(Float64(-fma(a, z, Float64(b * a)))) * x); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, 2.5e+166], N[(N[Exp[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]], $MachinePrecision] * x), $MachinePrecision], N[(N[Exp[(-N[(a * z + N[(b * a), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 2.5 \cdot 10^{+166}:\\
\;\;\;\;e^{\left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;e^{-\mathsf{fma}\left(a, z, b \cdot a\right)} \cdot x\\
\end{array}
\end{array}
if a < 2.5000000000000001e166Initial program 95.5%
if 2.5000000000000001e166 < a Initial program 74.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6491.6
Applied rewrites91.6%
Taylor expanded in z around 0
Applied rewrites91.6%
Final simplification95.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* (* 0.5 t) (* (* y y) x)) t))
(t_2 (+ (* (- (log (- 1.0 z)) b) a) (* (- (log z) t) y))))
(if (<= t_2 -2e+29) t_1 (if (<= t_2 2e-13) (* 1.0 x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((0.5 * t) * ((y * y) * x)) * t;
double t_2 = ((log((1.0 - z)) - b) * a) + ((log(z) - t) * y);
double tmp;
if (t_2 <= -2e+29) {
tmp = t_1;
} else if (t_2 <= 2e-13) {
tmp = 1.0 * 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) :: t_2
real(8) :: tmp
t_1 = ((0.5d0 * t) * ((y * y) * x)) * t
t_2 = ((log((1.0d0 - z)) - b) * a) + ((log(z) - t) * y)
if (t_2 <= (-2d+29)) then
tmp = t_1
else if (t_2 <= 2d-13) then
tmp = 1.0d0 * 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 = ((0.5 * t) * ((y * y) * x)) * t;
double t_2 = ((Math.log((1.0 - z)) - b) * a) + ((Math.log(z) - t) * y);
double tmp;
if (t_2 <= -2e+29) {
tmp = t_1;
} else if (t_2 <= 2e-13) {
tmp = 1.0 * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((0.5 * t) * ((y * y) * x)) * t t_2 = ((math.log((1.0 - z)) - b) * a) + ((math.log(z) - t) * y) tmp = 0 if t_2 <= -2e+29: tmp = t_1 elif t_2 <= 2e-13: tmp = 1.0 * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(0.5 * t) * Float64(Float64(y * y) * x)) * t) t_2 = Float64(Float64(Float64(log(Float64(1.0 - z)) - b) * a) + Float64(Float64(log(z) - t) * y)) tmp = 0.0 if (t_2 <= -2e+29) tmp = t_1; elseif (t_2 <= 2e-13) tmp = Float64(1.0 * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((0.5 * t) * ((y * y) * x)) * t; t_2 = ((log((1.0 - z)) - b) * a) + ((log(z) - t) * y); tmp = 0.0; if (t_2 <= -2e+29) tmp = t_1; elseif (t_2 <= 2e-13) tmp = 1.0 * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(0.5 * t), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, -2e+29], t$95$1, If[LessEqual[t$95$2, 2e-13], N[(1.0 * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(0.5 \cdot t\right) \cdot \left(\left(y \cdot y\right) \cdot x\right)\right) \cdot t\\
t_2 := \left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{-13}:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_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))) < -1.99999999999999983e29 or 2.0000000000000001e-13 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 94.4%
Taylor expanded in y around 0
Applied rewrites51.1%
Taylor expanded in a around 0
Applied rewrites29.8%
Taylor expanded in t around inf
Applied rewrites34.6%
Applied rewrites40.1%
if -1.99999999999999983e29 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 2.0000000000000001e-13Initial program 84.0%
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.f6459.5
Applied rewrites59.5%
Taylor expanded in y around 0
Applied rewrites80.1%
Final simplification46.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* (- (log (- 1.0 z)) b) a) (* (- (log z) t) y)))
(t_2 (* (* t t) 0.5)))
(if (<= t_1 -1e+39)
(* (* t_2 (* y x)) y)
(if (<= t_1 0.04) (* 1.0 x) (* (* t_2 x) (* y y))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((log((1.0 - z)) - b) * a) + ((log(z) - t) * y);
double t_2 = (t * t) * 0.5;
double tmp;
if (t_1 <= -1e+39) {
tmp = (t_2 * (y * x)) * y;
} else if (t_1 <= 0.04) {
tmp = 1.0 * x;
} else {
tmp = (t_2 * x) * (y * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = ((log((1.0d0 - z)) - b) * a) + ((log(z) - t) * y)
t_2 = (t * t) * 0.5d0
if (t_1 <= (-1d+39)) then
tmp = (t_2 * (y * x)) * y
else if (t_1 <= 0.04d0) then
tmp = 1.0d0 * x
else
tmp = (t_2 * x) * (y * y)
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.log((1.0 - z)) - b) * a) + ((Math.log(z) - t) * y);
double t_2 = (t * t) * 0.5;
double tmp;
if (t_1 <= -1e+39) {
tmp = (t_2 * (y * x)) * y;
} else if (t_1 <= 0.04) {
tmp = 1.0 * x;
} else {
tmp = (t_2 * x) * (y * y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((math.log((1.0 - z)) - b) * a) + ((math.log(z) - t) * y) t_2 = (t * t) * 0.5 tmp = 0 if t_1 <= -1e+39: tmp = (t_2 * (y * x)) * y elif t_1 <= 0.04: tmp = 1.0 * x else: tmp = (t_2 * x) * (y * y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(log(Float64(1.0 - z)) - b) * a) + Float64(Float64(log(z) - t) * y)) t_2 = Float64(Float64(t * t) * 0.5) tmp = 0.0 if (t_1 <= -1e+39) tmp = Float64(Float64(t_2 * Float64(y * x)) * y); elseif (t_1 <= 0.04) tmp = Float64(1.0 * x); else tmp = Float64(Float64(t_2 * x) * Float64(y * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((log((1.0 - z)) - b) * a) + ((log(z) - t) * y); t_2 = (t * t) * 0.5; tmp = 0.0; if (t_1 <= -1e+39) tmp = (t_2 * (y * x)) * y; elseif (t_1 <= 0.04) tmp = 1.0 * x; else tmp = (t_2 * x) * (y * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, Block[{t$95$2 = N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+39], N[(N[(t$95$2 * N[(y * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 0.04], N[(1.0 * x), $MachinePrecision], N[(N[(t$95$2 * x), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y\\
t_2 := \left(t \cdot t\right) \cdot 0.5\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+39}:\\
\;\;\;\;\left(t\_2 \cdot \left(y \cdot x\right)\right) \cdot y\\
\mathbf{elif}\;t\_1 \leq 0.04:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\left(t\_2 \cdot x\right) \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < -9.9999999999999994e38Initial program 99.0%
Taylor expanded in y around 0
Applied rewrites35.7%
Taylor expanded in a around 0
Applied rewrites2.2%
Taylor expanded in t around inf
Applied rewrites29.8%
Applied rewrites30.3%
if -9.9999999999999994e38 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 0.0400000000000000008Initial program 83.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.f6457.2
Applied rewrites57.2%
Taylor expanded in y around 0
Applied rewrites74.0%
if 0.0400000000000000008 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 90.9%
Taylor expanded in y around 0
Applied rewrites66.5%
Taylor expanded in a around 0
Applied rewrites56.5%
Taylor expanded in t around inf
Applied rewrites40.2%
Applied rewrites43.8%
Final simplification44.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* (* (* t t) 0.5) (* y x)) y))
(t_2 (+ (* (- (log (- 1.0 z)) b) a) (* (- (log z) t) y))))
(if (<= t_2 -1e+39) t_1 (if (<= t_2 0.04) (* 1.0 x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((t * t) * 0.5) * (y * x)) * y;
double t_2 = ((log((1.0 - z)) - b) * a) + ((log(z) - t) * y);
double tmp;
if (t_2 <= -1e+39) {
tmp = t_1;
} else if (t_2 <= 0.04) {
tmp = 1.0 * 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) :: t_2
real(8) :: tmp
t_1 = (((t * t) * 0.5d0) * (y * x)) * y
t_2 = ((log((1.0d0 - z)) - b) * a) + ((log(z) - t) * y)
if (t_2 <= (-1d+39)) then
tmp = t_1
else if (t_2 <= 0.04d0) then
tmp = 1.0d0 * 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 = (((t * t) * 0.5) * (y * x)) * y;
double t_2 = ((Math.log((1.0 - z)) - b) * a) + ((Math.log(z) - t) * y);
double tmp;
if (t_2 <= -1e+39) {
tmp = t_1;
} else if (t_2 <= 0.04) {
tmp = 1.0 * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (((t * t) * 0.5) * (y * x)) * y t_2 = ((math.log((1.0 - z)) - b) * a) + ((math.log(z) - t) * y) tmp = 0 if t_2 <= -1e+39: tmp = t_1 elif t_2 <= 0.04: tmp = 1.0 * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(t * t) * 0.5) * Float64(y * x)) * y) t_2 = Float64(Float64(Float64(log(Float64(1.0 - z)) - b) * a) + Float64(Float64(log(z) - t) * y)) tmp = 0.0 if (t_2 <= -1e+39) tmp = t_1; elseif (t_2 <= 0.04) tmp = Float64(1.0 * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (((t * t) * 0.5) * (y * x)) * y; t_2 = ((log((1.0 - z)) - b) * a) + ((log(z) - t) * y); tmp = 0.0; if (t_2 <= -1e+39) tmp = t_1; elseif (t_2 <= 0.04) tmp = 1.0 * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(t * t), $MachinePrecision] * 0.5), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = 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]}, If[LessEqual[t$95$2, -1e+39], t$95$1, If[LessEqual[t$95$2, 0.04], N[(1.0 * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(\left(t \cdot t\right) \cdot 0.5\right) \cdot \left(y \cdot x\right)\right) \cdot y\\
t_2 := \left(\log \left(1 - z\right) - b\right) \cdot a + \left(\log z - t\right) \cdot y\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+39}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 0.04:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_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))) < -9.9999999999999994e38 or 0.0400000000000000008 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 94.8%
Taylor expanded in y around 0
Applied rewrites51.6%
Taylor expanded in a around 0
Applied rewrites30.3%
Taylor expanded in t around inf
Applied rewrites35.2%
Applied rewrites36.5%
if -9.9999999999999994e38 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 0.0400000000000000008Initial program 83.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.f6457.2
Applied rewrites57.2%
Taylor expanded in y around 0
Applied rewrites74.0%
Final simplification43.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (pow (/ z (exp t)) y) x)))
(if (<= y -0.0001)
t_1
(if (<= y 3.2e+27) (* (exp (- (fma a z (* b a)))) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow((z / exp(t)), y) * x;
double tmp;
if (y <= -0.0001) {
tmp = t_1;
} else if (y <= 3.2e+27) {
tmp = exp(-fma(a, z, (b * a))) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64((Float64(z / exp(t)) ^ y) * x) tmp = 0.0 if (y <= -0.0001) tmp = t_1; elseif (y <= 3.2e+27) tmp = Float64(exp(Float64(-fma(a, z, Float64(b * a)))) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -0.0001], t$95$1, If[LessEqual[y, 3.2e+27], N[(N[Exp[(-N[(a * z + N[(b * a), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {\left(\frac{z}{e^{t}}\right)}^{y} \cdot x\\
\mathbf{if}\;y \leq -0.0001:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.2 \cdot 10^{+27}:\\
\;\;\;\;e^{-\mathsf{fma}\left(a, z, b \cdot a\right)} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.00000000000000005e-4 or 3.20000000000000015e27 < y Initial program 94.4%
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.f6484.1
Applied rewrites84.1%
if -1.00000000000000005e-4 < y < 3.20000000000000015e27Initial program 91.1%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6489.1
Applied rewrites89.1%
Taylor expanded in z around 0
Applied rewrites89.1%
Final simplification86.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (- (fma a z (* b a)))) x))) (if (<= a -3.4e-14) t_1 (if (<= a 5.5e-101) (* (exp (* (- t) y)) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = exp(-fma(a, z, (b * a))) * x;
double tmp;
if (a <= -3.4e-14) {
tmp = t_1;
} else if (a <= 5.5e-101) {
tmp = exp((-t * y)) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(exp(Float64(-fma(a, z, Float64(b * a)))) * x) tmp = 0.0 if (a <= -3.4e-14) tmp = t_1; elseif (a <= 5.5e-101) tmp = Float64(exp(Float64(Float64(-t) * 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[(a * z + N[(b * a), $MachinePrecision]), $MachinePrecision])], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[a, -3.4e-14], t$95$1, If[LessEqual[a, 5.5e-101], N[(N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := e^{-\mathsf{fma}\left(a, z, b \cdot a\right)} \cdot x\\
\mathbf{if}\;a \leq -3.4 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 5.5 \cdot 10^{-101}:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -3.40000000000000003e-14 or 5.49999999999999973e-101 < a Initial program 89.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6482.3
Applied rewrites82.3%
Taylor expanded in z around 0
Applied rewrites82.3%
if -3.40000000000000003e-14 < a < 5.49999999999999973e-101Initial program 100.0%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6473.5
Applied rewrites73.5%
Final simplification79.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (exp (* (- b) a)) x)))
(if (<= b -1.2e-69)
t_1
(if (<= b 7800000000000.0) (* (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.2e-69) {
tmp = t_1;
} else if (b <= 7800000000000.0) {
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.2d-69)) then
tmp = t_1
else if (b <= 7800000000000.0d0) 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.2e-69) {
tmp = t_1;
} else if (b <= 7800000000000.0) {
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.2e-69: tmp = t_1 elif b <= 7800000000000.0: 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.2e-69) tmp = t_1; elseif (b <= 7800000000000.0) 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.2e-69) tmp = t_1; elseif (b <= 7800000000000.0) 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.2e-69], t$95$1, If[LessEqual[b, 7800000000000.0], 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.2 \cdot 10^{-69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 7800000000000:\\
\;\;\;\;e^{\left(-t\right) \cdot y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -1.2000000000000001e-69 or 7.8e12 < b Initial program 96.9%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6480.4
Applied rewrites80.4%
Taylor expanded in z around 0
Applied rewrites80.3%
if -1.2000000000000001e-69 < b < 7.8e12Initial program 88.4%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6465.2
Applied rewrites65.2%
Final simplification72.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (exp (* (- b) a)) x))) (if (<= b -2.4e-69) t_1 (if (<= b 2.8e+53) (* (pow z 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 <= -2.4e-69) {
tmp = t_1;
} else if (b <= 2.8e+53) {
tmp = pow(z, 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 <= (-2.4d-69)) then
tmp = t_1
else if (b <= 2.8d+53) then
tmp = (z ** 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 <= -2.4e-69) {
tmp = t_1;
} else if (b <= 2.8e+53) {
tmp = Math.pow(z, 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 <= -2.4e-69: tmp = t_1 elif b <= 2.8e+53: tmp = math.pow(z, 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 <= -2.4e-69) tmp = t_1; elseif (b <= 2.8e+53) tmp = Float64((z ^ 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 <= -2.4e-69) tmp = t_1; elseif (b <= 2.8e+53) tmp = (z ^ 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, -2.4e-69], t$95$1, If[LessEqual[b, 2.8e+53], N[(N[Power[z, y], $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 -2.4 \cdot 10^{-69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \leq 2.8 \cdot 10^{+53}:\\
\;\;\;\;{z}^{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if b < -2.4000000000000001e-69 or 2.8e53 < b Initial program 96.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6482.9
Applied rewrites82.9%
Taylor expanded in z around 0
Applied rewrites82.8%
if -2.4000000000000001e-69 < b < 2.8e53Initial program 89.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.f6475.9
Applied rewrites75.9%
Taylor expanded in t around 0
Applied rewrites60.8%
Final simplification71.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (pow z y) x))) (if (<= y -1.2) t_1 (if (<= y 3.1e-66) (* (exp (- (* z a))) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = pow(z, y) * x;
double tmp;
if (y <= -1.2) {
tmp = t_1;
} else if (y <= 3.1e-66) {
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 = (z ** y) * x
if (y <= (-1.2d0)) then
tmp = t_1
else if (y <= 3.1d-66) 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.pow(z, y) * x;
double tmp;
if (y <= -1.2) {
tmp = t_1;
} else if (y <= 3.1e-66) {
tmp = Math.exp(-(z * a)) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.pow(z, y) * x tmp = 0 if y <= -1.2: tmp = t_1 elif y <= 3.1e-66: tmp = math.exp(-(z * a)) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64((z ^ y) * x) tmp = 0.0 if (y <= -1.2) tmp = t_1; elseif (y <= 3.1e-66) 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 = (z ^ y) * x; tmp = 0.0; if (y <= -1.2) tmp = t_1; elseif (y <= 3.1e-66) 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[Power[z, y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[y, -1.2], t$95$1, If[LessEqual[y, 3.1e-66], N[(N[Exp[(-N[(z * a), $MachinePrecision])], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := {z}^{y} \cdot x\\
\mathbf{if}\;y \leq -1.2:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-66}:\\
\;\;\;\;e^{-z \cdot a} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.19999999999999996 or 3.0999999999999997e-66 < y Initial program 95.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.f6480.2
Applied rewrites80.2%
Taylor expanded in t around 0
Applied rewrites62.6%
if -1.19999999999999996 < y < 3.0999999999999997e-66Initial program 88.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6490.3
Applied rewrites90.3%
Taylor expanded in z around 0
Applied rewrites90.3%
Taylor expanded in z around inf
Applied rewrites57.0%
Final simplification60.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (* (* (* 0.5 t) (* (* y y) x)) t))) (if (<= a -1.28e+141) t_1 (if (<= a 1.7e+166) (* (pow z y) x) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((0.5 * t) * ((y * y) * x)) * t;
double tmp;
if (a <= -1.28e+141) {
tmp = t_1;
} else if (a <= 1.7e+166) {
tmp = pow(z, 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 = ((0.5d0 * t) * ((y * y) * x)) * t
if (a <= (-1.28d+141)) then
tmp = t_1
else if (a <= 1.7d+166) then
tmp = (z ** 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 = ((0.5 * t) * ((y * y) * x)) * t;
double tmp;
if (a <= -1.28e+141) {
tmp = t_1;
} else if (a <= 1.7e+166) {
tmp = Math.pow(z, y) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((0.5 * t) * ((y * y) * x)) * t tmp = 0 if a <= -1.28e+141: tmp = t_1 elif a <= 1.7e+166: tmp = math.pow(z, y) * x else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(0.5 * t) * Float64(Float64(y * y) * x)) * t) tmp = 0.0 if (a <= -1.28e+141) tmp = t_1; elseif (a <= 1.7e+166) tmp = Float64((z ^ y) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((0.5 * t) * ((y * y) * x)) * t; tmp = 0.0; if (a <= -1.28e+141) tmp = t_1; elseif (a <= 1.7e+166) tmp = (z ^ y) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(0.5 * t), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[a, -1.28e+141], t$95$1, If[LessEqual[a, 1.7e+166], N[(N[Power[z, y], $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(0.5 \cdot t\right) \cdot \left(\left(y \cdot y\right) \cdot x\right)\right) \cdot t\\
\mathbf{if}\;a \leq -1.28 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 1.7 \cdot 10^{+166}:\\
\;\;\;\;{z}^{y} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -1.28000000000000004e141 or 1.7e166 < a Initial program 84.0%
Taylor expanded in y around 0
Applied rewrites54.6%
Taylor expanded in a around 0
Applied rewrites27.1%
Taylor expanded in t around inf
Applied rewrites42.3%
Applied rewrites50.1%
if -1.28000000000000004e141 < a < 1.7e166Initial program 96.6%
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.f6472.0
Applied rewrites72.0%
Taylor expanded in t around 0
Applied rewrites59.3%
Final simplification56.4%
(FPCore (x y z t a b) :precision binary64 (* 1.0 x))
double code(double x, double y, double z, double t, double a, double b) {
return 1.0 * 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 = 1.0d0 * x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return 1.0 * x;
}
def code(x, y, z, t, a, b): return 1.0 * x
function code(x, y, z, t, a, b) return Float64(1.0 * x) end
function tmp = code(x, y, z, t, a, b) tmp = 1.0 * x; end
code[x_, y_, z_, t_, a_, b_] := N[(1.0 * x), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x
\end{array}
Initial program 92.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.f6464.4
Applied rewrites64.4%
Taylor expanded in y around 0
Applied rewrites16.7%
Final simplification16.7%
herbie shell --seed 2024332
(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))))))