
(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 (* 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.5%
(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 -800.0) (not (<= t_1 5e+15)))
(* x (pow (* z z) y))
(* x (pow z y)))))
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 <= -800.0) || !(t_1 <= 5e+15)) {
tmp = x * pow((z * z), y);
} else {
tmp = x * pow(z, 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) :: tmp
t_1 = (y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))
if ((t_1 <= (-800.0d0)) .or. (.not. (t_1 <= 5d+15))) then
tmp = x * ((z * z) ** y)
else
tmp = x * (z ** 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 = (y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b));
double tmp;
if ((t_1 <= -800.0) || !(t_1 <= 5e+15)) {
tmp = x * Math.pow((z * z), y);
} else {
tmp = x * Math.pow(z, y);
}
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 <= -800.0) or not (t_1 <= 5e+15): tmp = x * math.pow((z * z), y) else: tmp = x * math.pow(z, y) 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 <= -800.0) || !(t_1 <= 5e+15)) tmp = Float64(x * (Float64(z * z) ^ y)); else tmp = Float64(x * (z ^ y)); 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 <= -800.0) || ~((t_1 <= 5e+15))) tmp = x * ((z * z) ^ y); else tmp = x * (z ^ y); 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, -800.0], N[Not[LessEqual[t$95$1, 5e+15]], $MachinePrecision]], N[(x * N[Power[N[(z * z), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $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 -800 \lor \neg \left(t\_1 \leq 5 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot {\left(z \cdot z\right)}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\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))) < -800 or 5e15 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) 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.f6474.2
Applied rewrites74.2%
Taylor expanded in t around 0
Applied rewrites45.8%
Applied rewrites54.4%
if -800 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 5e15Initial program 95.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.f6473.8
Applied rewrites73.8%
Taylor expanded in t around 0
Applied rewrites85.5%
Final simplification59.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* (- t) y)))))
(if (<= t -1.25e+231)
t_1
(if (<= t -1.8e+113)
(* x (exp (* (- (- z) b) a)))
(if (<= t -960.0)
t_1
(if (<= t 1.12e-73)
(* x (pow (pow z (- y)) -1.0))
(if (<= t 5.2e-20) (* 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 <= -1.25e+231) {
tmp = t_1;
} else if (t <= -1.8e+113) {
tmp = x * exp(((-z - b) * a));
} else if (t <= -960.0) {
tmp = t_1;
} else if (t <= 1.12e-73) {
tmp = x * pow(pow(z, -y), -1.0);
} else if (t <= 5.2e-20) {
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 <= (-1.25d+231)) then
tmp = t_1
else if (t <= (-1.8d+113)) then
tmp = x * exp(((-z - b) * a))
else if (t <= (-960.0d0)) then
tmp = t_1
else if (t <= 1.12d-73) then
tmp = x * ((z ** -y) ** (-1.0d0))
else if (t <= 5.2d-20) 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 <= -1.25e+231) {
tmp = t_1;
} else if (t <= -1.8e+113) {
tmp = x * Math.exp(((-z - b) * a));
} else if (t <= -960.0) {
tmp = t_1;
} else if (t <= 1.12e-73) {
tmp = x * Math.pow(Math.pow(z, -y), -1.0);
} else if (t <= 5.2e-20) {
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 <= -1.25e+231: tmp = t_1 elif t <= -1.8e+113: tmp = x * math.exp(((-z - b) * a)) elif t <= -960.0: tmp = t_1 elif t <= 1.12e-73: tmp = x * math.pow(math.pow(z, -y), -1.0) elif t <= 5.2e-20: 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 <= -1.25e+231) tmp = t_1; elseif (t <= -1.8e+113) tmp = Float64(x * exp(Float64(Float64(Float64(-z) - b) * a))); elseif (t <= -960.0) tmp = t_1; elseif (t <= 1.12e-73) tmp = Float64(x * ((z ^ Float64(-y)) ^ -1.0)); elseif (t <= 5.2e-20) 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 <= -1.25e+231) tmp = t_1; elseif (t <= -1.8e+113) tmp = x * exp(((-z - b) * a)); elseif (t <= -960.0) tmp = t_1; elseif (t <= 1.12e-73) tmp = x * ((z ^ -y) ^ -1.0); elseif (t <= 5.2e-20) 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, -1.25e+231], t$95$1, If[LessEqual[t, -1.8e+113], N[(x * N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -960.0], t$95$1, If[LessEqual[t, 1.12e-73], N[(x * N[Power[N[Power[z, (-y)], $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.2e-20], 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 -1.25 \cdot 10^{+231}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{+113}:\\
\;\;\;\;x \cdot e^{\left(\left(-z\right) - b\right) \cdot a}\\
\mathbf{elif}\;t \leq -960:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{-73}:\\
\;\;\;\;x \cdot {\left({z}^{\left(-y\right)}\right)}^{-1}\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-20}:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.25000000000000007e231 or -1.79999999999999996e113 < t < -960 or 5.1999999999999999e-20 < t Initial program 99.1%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6487.0
Applied rewrites87.0%
if -1.25000000000000007e231 < t < -1.79999999999999996e113Initial 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.f6486.5
Applied rewrites86.5%
Taylor expanded in z around 0
Applied rewrites86.5%
if -960 < t < 1.11999999999999995e-73Initial program 94.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.f6473.2
Applied rewrites73.2%
Taylor expanded in t around 0
Applied rewrites74.1%
Applied rewrites74.1%
if 1.11999999999999995e-73 < t < 5.1999999999999999e-20Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Final simplification81.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.65) (not (<= y 45000000.0))) (* x (pow (/ z (exp t)) y)) (* x (exp (* (- (- z) b) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.65) || !(y <= 45000000.0)) {
tmp = x * pow((z / exp(t)), y);
} else {
tmp = x * exp(((-z - 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.65d0)) .or. (.not. (y <= 45000000.0d0))) then
tmp = x * ((z / exp(t)) ** y)
else
tmp = x * exp(((-z - 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.65) || !(y <= 45000000.0)) {
tmp = x * Math.pow((z / Math.exp(t)), y);
} else {
tmp = x * Math.exp(((-z - b) * a));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.65) or not (y <= 45000000.0): tmp = x * math.pow((z / math.exp(t)), y) else: tmp = x * math.exp(((-z - b) * a)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.65) || !(y <= 45000000.0)) tmp = Float64(x * (Float64(z / exp(t)) ^ y)); else tmp = Float64(x * exp(Float64(Float64(Float64(-z) - b) * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.65) || ~((y <= 45000000.0))) tmp = x * ((z / exp(t)) ^ y); else tmp = x * exp(((-z - b) * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.65], N[Not[LessEqual[y, 45000000.0]], $MachinePrecision]], N[(x * N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.65 \lor \neg \left(y \leq 45000000\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(\left(-z\right) - b\right) \cdot a}\\
\end{array}
\end{array}
if y < -2.64999999999999991 or 4.5e7 < y Initial program 99.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.f6492.7
Applied rewrites92.7%
if -2.64999999999999991 < y < 4.5e7Initial program 93.5%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f6484.2
Applied rewrites84.2%
Taylor expanded in z around 0
Applied rewrites84.2%
Final simplification88.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* (- t) y)))))
(if (<= t -1.25e+231)
t_1
(if (<= t -1.8e+113)
(* x (exp (* (- (- z) b) a)))
(if (<= t -960.0)
t_1
(if (<= t 1.12e-73)
(* x (pow z y))
(if (<= t 5.2e-20) (* 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 <= -1.25e+231) {
tmp = t_1;
} else if (t <= -1.8e+113) {
tmp = x * exp(((-z - b) * a));
} else if (t <= -960.0) {
tmp = t_1;
} else if (t <= 1.12e-73) {
tmp = x * pow(z, y);
} else if (t <= 5.2e-20) {
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 <= (-1.25d+231)) then
tmp = t_1
else if (t <= (-1.8d+113)) then
tmp = x * exp(((-z - b) * a))
else if (t <= (-960.0d0)) then
tmp = t_1
else if (t <= 1.12d-73) then
tmp = x * (z ** y)
else if (t <= 5.2d-20) 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 <= -1.25e+231) {
tmp = t_1;
} else if (t <= -1.8e+113) {
tmp = x * Math.exp(((-z - b) * a));
} else if (t <= -960.0) {
tmp = t_1;
} else if (t <= 1.12e-73) {
tmp = x * Math.pow(z, y);
} else if (t <= 5.2e-20) {
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 <= -1.25e+231: tmp = t_1 elif t <= -1.8e+113: tmp = x * math.exp(((-z - b) * a)) elif t <= -960.0: tmp = t_1 elif t <= 1.12e-73: tmp = x * math.pow(z, y) elif t <= 5.2e-20: 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 <= -1.25e+231) tmp = t_1; elseif (t <= -1.8e+113) tmp = Float64(x * exp(Float64(Float64(Float64(-z) - b) * a))); elseif (t <= -960.0) tmp = t_1; elseif (t <= 1.12e-73) tmp = Float64(x * (z ^ y)); elseif (t <= 5.2e-20) 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 <= -1.25e+231) tmp = t_1; elseif (t <= -1.8e+113) tmp = x * exp(((-z - b) * a)); elseif (t <= -960.0) tmp = t_1; elseif (t <= 1.12e-73) tmp = x * (z ^ y); elseif (t <= 5.2e-20) 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, -1.25e+231], t$95$1, If[LessEqual[t, -1.8e+113], N[(x * N[Exp[N[(N[((-z) - b), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -960.0], t$95$1, If[LessEqual[t, 1.12e-73], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.2e-20], 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 -1.25 \cdot 10^{+231}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{+113}:\\
\;\;\;\;x \cdot e^{\left(\left(-z\right) - b\right) \cdot a}\\
\mathbf{elif}\;t \leq -960:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{-73}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-20}:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.25000000000000007e231 or -1.79999999999999996e113 < t < -960 or 5.1999999999999999e-20 < t Initial program 99.1%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6487.0
Applied rewrites87.0%
if -1.25000000000000007e231 < t < -1.79999999999999996e113Initial 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.f6486.5
Applied rewrites86.5%
Taylor expanded in z around 0
Applied rewrites86.5%
if -960 < t < 1.11999999999999995e-73Initial program 94.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.f6473.2
Applied rewrites73.2%
Taylor expanded in t around 0
Applied rewrites74.1%
if 1.11999999999999995e-73 < t < 5.1999999999999999e-20Initial program 100.0%
Taylor expanded in b around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* (- b) a)))) (t_2 (* x (exp (* (- t) y)))))
(if (<= t -6.2e+195)
t_2
(if (<= t -2.7e+113)
t_1
(if (<= t -960.0)
t_2
(if (<= t 1.12e-73) (* x (pow z y)) (if (<= t 5.2e-20) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((-b * a));
double t_2 = x * exp((-t * y));
double tmp;
if (t <= -6.2e+195) {
tmp = t_2;
} else if (t <= -2.7e+113) {
tmp = t_1;
} else if (t <= -960.0) {
tmp = t_2;
} else if (t <= 1.12e-73) {
tmp = x * pow(z, y);
} else if (t <= 5.2e-20) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = x * exp((-b * a))
t_2 = x * exp((-t * y))
if (t <= (-6.2d+195)) then
tmp = t_2
else if (t <= (-2.7d+113)) then
tmp = t_1
else if (t <= (-960.0d0)) then
tmp = t_2
else if (t <= 1.12d-73) then
tmp = x * (z ** y)
else if (t <= 5.2d-20) then
tmp = t_1
else
tmp = t_2
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((-b * a));
double t_2 = x * Math.exp((-t * y));
double tmp;
if (t <= -6.2e+195) {
tmp = t_2;
} else if (t <= -2.7e+113) {
tmp = t_1;
} else if (t <= -960.0) {
tmp = t_2;
} else if (t <= 1.12e-73) {
tmp = x * Math.pow(z, y);
} else if (t <= 5.2e-20) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((-b * a)) t_2 = x * math.exp((-t * y)) tmp = 0 if t <= -6.2e+195: tmp = t_2 elif t <= -2.7e+113: tmp = t_1 elif t <= -960.0: tmp = t_2 elif t <= 1.12e-73: tmp = x * math.pow(z, y) elif t <= 5.2e-20: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(Float64(-b) * a))) t_2 = Float64(x * exp(Float64(Float64(-t) * y))) tmp = 0.0 if (t <= -6.2e+195) tmp = t_2; elseif (t <= -2.7e+113) tmp = t_1; elseif (t <= -960.0) tmp = t_2; elseif (t <= 1.12e-73) tmp = Float64(x * (z ^ y)); elseif (t <= 5.2e-20) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((-b * a)); t_2 = x * exp((-t * y)); tmp = 0.0; if (t <= -6.2e+195) tmp = t_2; elseif (t <= -2.7e+113) tmp = t_1; elseif (t <= -960.0) tmp = t_2; elseif (t <= 1.12e-73) tmp = x * (z ^ y); elseif (t <= 5.2e-20) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[Exp[N[((-t) * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.2e+195], t$95$2, If[LessEqual[t, -2.7e+113], t$95$1, If[LessEqual[t, -960.0], t$95$2, If[LessEqual[t, 1.12e-73], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.2e-20], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{\left(-b\right) \cdot a}\\
t_2 := x \cdot e^{\left(-t\right) \cdot y}\\
\mathbf{if}\;t \leq -6.2 \cdot 10^{+195}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -2.7 \cdot 10^{+113}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -960:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.12 \cdot 10^{-73}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{-20}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -6.2000000000000004e195 or -2.70000000000000011e113 < t < -960 or 5.1999999999999999e-20 < t Initial program 98.2%
Taylor expanded in t around inf
associate-*r*N/A
mul-1-negN/A
lower-*.f64N/A
lower-neg.f6486.3
Applied rewrites86.3%
if -6.2000000000000004e195 < t < -2.70000000000000011e113 or 1.11999999999999995e-73 < t < 5.1999999999999999e-20Initial program 96.7%
Taylor expanded in b around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6486.9
Applied rewrites86.9%
if -960 < t < 1.11999999999999995e-73Initial program 94.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.f6473.2
Applied rewrites73.2%
Taylor expanded in t around 0
Applied rewrites74.1%
(FPCore (x y z t a b) :precision binary64 (if (<= y -6.4e+29) (* x (pow z y)) (if (<= y 2.0) (* x (exp (* (- b) a))) (* x (pow (* z z) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -6.4e+29) {
tmp = x * pow(z, y);
} else if (y <= 2.0) {
tmp = x * exp((-b * a));
} else {
tmp = x * pow((z * z), 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 (y <= (-6.4d+29)) then
tmp = x * (z ** y)
else if (y <= 2.0d0) then
tmp = x * exp((-b * a))
else
tmp = x * ((z * z) ** 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 (y <= -6.4e+29) {
tmp = x * Math.pow(z, y);
} else if (y <= 2.0) {
tmp = x * Math.exp((-b * a));
} else {
tmp = x * Math.pow((z * z), y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -6.4e+29: tmp = x * math.pow(z, y) elif y <= 2.0: tmp = x * math.exp((-b * a)) else: tmp = x * math.pow((z * z), y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -6.4e+29) tmp = Float64(x * (z ^ y)); elseif (y <= 2.0) tmp = Float64(x * exp(Float64(Float64(-b) * a))); else tmp = Float64(x * (Float64(z * z) ^ y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -6.4e+29) tmp = x * (z ^ y); elseif (y <= 2.0) tmp = x * exp((-b * a)); else tmp = x * ((z * z) ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -6.4e+29], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.0], N[(x * N[Exp[N[((-b) * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Power[N[(z * z), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.4 \cdot 10^{+29}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{elif}\;y \leq 2:\\
\;\;\;\;x \cdot e^{\left(-b\right) \cdot a}\\
\mathbf{else}:\\
\;\;\;\;x \cdot {\left(z \cdot z\right)}^{y}\\
\end{array}
\end{array}
if y < -6.39999999999999973e29Initial program 98.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.f6492.1
Applied rewrites92.1%
Taylor expanded in t around 0
Applied rewrites66.7%
if -6.39999999999999973e29 < y < 2Initial program 94.4%
Taylor expanded in b around inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f6478.9
Applied rewrites78.9%
if 2 < y Initial program 98.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.f6491.7
Applied rewrites91.7%
Taylor expanded in t around 0
Applied rewrites75.0%
Applied rewrites75.0%
(FPCore (x y z t a b) :precision binary64 (* x (pow z y)))
double code(double x, double y, double z, double t, double a, double b) {
return x * pow(z, y);
}
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 * (z ** y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.pow(z, y);
}
def code(x, y, z, t, a, b): return x * math.pow(z, y)
function code(x, y, z, t, a, b) return Float64(x * (z ^ y)) end
function tmp = code(x, y, z, t, a, b) tmp = x * (z ^ y); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot {z}^{y}
\end{array}
Initial program 96.5%
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.f6474.2
Applied rewrites74.2%
Taylor expanded in t around 0
Applied rewrites52.6%
(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.5%
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.f6474.2
Applied rewrites74.2%
Taylor expanded in y around 0
Applied rewrites17.8%
herbie shell --seed 2024324
(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))))))