
(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 (* x (exp (fma y (- (log z) t) (* a (- (log1p (- z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(fma(y, (log(z) - t), (a * (log1p(-z) - b))));
}
function code(x, y, z, t, a, b) return Float64(x * exp(fma(y, Float64(log(z) - t), Float64(a * Float64(log1p(Float64(-z)) - b))))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision] + N[(a * N[(N[Log[1 + (-z)], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{\mathsf{fma}\left(y, \log z - t, a \cdot \left(\mathsf{log1p}\left(-z\right) - b\right)\right)}
\end{array}
Initial program 97.7%
fma-define98.1%
sub-neg98.1%
log1p-define99.2%
Simplified99.2%
Final simplification99.2%
(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 97.7%
Final simplification97.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.4e-97) (not (<= y 5.5e-21))) (* x (exp (* y (- (log z) t)))) (* x (exp (* a (- (- b) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.4e-97) || !(y <= 5.5e-21)) {
tmp = x * exp((y * (log(z) - t)));
} else {
tmp = x * exp((a * (-b - 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 ((y <= (-4.4d-97)) .or. (.not. (y <= 5.5d-21))) then
tmp = x * exp((y * (log(z) - t)))
else
tmp = x * exp((a * (-b - 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 ((y <= -4.4e-97) || !(y <= 5.5e-21)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.exp((a * (-b - z)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.4e-97) or not (y <= 5.5e-21): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.exp((a * (-b - z))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.4e-97) || !(y <= 5.5e-21)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(a * Float64(Float64(-b) - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -4.4e-97) || ~((y <= 5.5e-21))) tmp = x * exp((y * (log(z) - t))); else tmp = x * exp((a * (-b - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.4e-97], N[Not[LessEqual[y, 5.5e-21]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[((-b) - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{-97} \lor \neg \left(y \leq 5.5 \cdot 10^{-21}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-b\right) - z\right)}\\
\end{array}
\end{array}
if y < -4.3999999999999998e-97 or 5.49999999999999977e-21 < y Initial program 97.4%
Taylor expanded in y around inf 90.5%
if -4.3999999999999998e-97 < y < 5.49999999999999977e-21Initial program 98.1%
Taylor expanded in y around 0 85.1%
sub-neg85.1%
log1p-define86.9%
Simplified86.9%
Taylor expanded in z around 0 86.9%
distribute-lft-out86.9%
mul-1-neg86.9%
distribute-lft-out86.9%
Simplified86.9%
Final simplification89.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (exp (* y (- t))))))
(if (<= t -170.0)
t_1
(if (<= t -1.42e-209)
(* x (pow z y))
(if (<= t 2e-28) (* x (exp (* a (- b)))) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * exp((y * -t));
double tmp;
if (t <= -170.0) {
tmp = t_1;
} else if (t <= -1.42e-209) {
tmp = x * pow(z, y);
} else if (t <= 2e-28) {
tmp = x * exp((a * -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((y * -t))
if (t <= (-170.0d0)) then
tmp = t_1
else if (t <= (-1.42d-209)) then
tmp = x * (z ** y)
else if (t <= 2d-28) then
tmp = x * exp((a * -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((y * -t));
double tmp;
if (t <= -170.0) {
tmp = t_1;
} else if (t <= -1.42e-209) {
tmp = x * Math.pow(z, y);
} else if (t <= 2e-28) {
tmp = x * Math.exp((a * -b));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.exp((y * -t)) tmp = 0 if t <= -170.0: tmp = t_1 elif t <= -1.42e-209: tmp = x * math.pow(z, y) elif t <= 2e-28: tmp = x * math.exp((a * -b)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * exp(Float64(y * Float64(-t)))) tmp = 0.0 if (t <= -170.0) tmp = t_1; elseif (t <= -1.42e-209) tmp = Float64(x * (z ^ y)); elseif (t <= 2e-28) tmp = Float64(x * exp(Float64(a * Float64(-b)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * exp((y * -t)); tmp = 0.0; if (t <= -170.0) tmp = t_1; elseif (t <= -1.42e-209) tmp = x * (z ^ y); elseif (t <= 2e-28) tmp = x * exp((a * -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[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -170.0], t$95$1, If[LessEqual[t, -1.42e-209], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e-28], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{if}\;t \leq -170:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.42 \cdot 10^{-209}:\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{elif}\;t \leq 2 \cdot 10^{-28}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -170 or 1.99999999999999994e-28 < t Initial program 97.3%
Taylor expanded in t around inf 81.7%
mul-1-neg81.7%
distribute-lft-neg-out81.7%
*-commutative81.7%
Simplified81.7%
if -170 < t < -1.41999999999999987e-209Initial program 97.8%
Taylor expanded in y around inf 77.1%
Taylor expanded in t around 0 77.1%
if -1.41999999999999987e-209 < t < 1.99999999999999994e-28Initial program 98.5%
Taylor expanded in b around inf 73.4%
mul-1-neg73.4%
distribute-rgt-neg-out73.4%
Simplified73.4%
Final simplification78.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* x (pow z y))))
(if (<= y -36000000000.0)
t_1
(if (<= y 380.0)
(* x (exp (* a (- b))))
(if (<= y 3e+141) t_1 (* x (* y (- t))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x * pow(z, y);
double tmp;
if (y <= -36000000000.0) {
tmp = t_1;
} else if (y <= 380.0) {
tmp = x * exp((a * -b));
} else if (y <= 3e+141) {
tmp = t_1;
} else {
tmp = x * (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) :: t_1
real(8) :: tmp
t_1 = x * (z ** y)
if (y <= (-36000000000.0d0)) then
tmp = t_1
else if (y <= 380.0d0) then
tmp = x * exp((a * -b))
else if (y <= 3d+141) then
tmp = t_1
else
tmp = x * (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 t_1 = x * Math.pow(z, y);
double tmp;
if (y <= -36000000000.0) {
tmp = t_1;
} else if (y <= 380.0) {
tmp = x * Math.exp((a * -b));
} else if (y <= 3e+141) {
tmp = t_1;
} else {
tmp = x * (y * -t);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x * math.pow(z, y) tmp = 0 if y <= -36000000000.0: tmp = t_1 elif y <= 380.0: tmp = x * math.exp((a * -b)) elif y <= 3e+141: tmp = t_1 else: tmp = x * (y * -t) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x * (z ^ y)) tmp = 0.0 if (y <= -36000000000.0) tmp = t_1; elseif (y <= 380.0) tmp = Float64(x * exp(Float64(a * Float64(-b)))); elseif (y <= 3e+141) tmp = t_1; else tmp = Float64(x * Float64(y * Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x * (z ^ y); tmp = 0.0; if (y <= -36000000000.0) tmp = t_1; elseif (y <= 380.0) tmp = x * exp((a * -b)); elseif (y <= 3e+141) tmp = t_1; else tmp = x * (y * -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -36000000000.0], t$95$1, If[LessEqual[y, 380.0], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+141], t$95$1, N[(x * N[(y * (-t)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot {z}^{y}\\
\mathbf{if}\;y \leq -36000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 380:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+141}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\
\end{array}
\end{array}
if y < -3.6e10 or 380 < y < 2.9999999999999999e141Initial program 97.2%
Taylor expanded in y around inf 91.6%
Taylor expanded in t around 0 68.4%
if -3.6e10 < y < 380Initial program 97.7%
Taylor expanded in b around inf 80.1%
mul-1-neg80.1%
distribute-rgt-neg-out80.1%
Simplified80.1%
if 2.9999999999999999e141 < y Initial program 100.0%
Taylor expanded in t around inf 73.3%
mul-1-neg73.3%
distribute-lft-neg-out73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in y around 0 56.4%
mul-1-neg56.4%
unsub-neg56.4%
*-commutative56.4%
Simplified56.4%
Taylor expanded in y around inf 39.2%
associate-*r*51.8%
associate-*r*51.8%
*-commutative51.8%
mul-1-neg51.8%
distribute-rgt-neg-in51.8%
Simplified51.8%
Taylor expanded in y around 0 39.2%
mul-1-neg39.2%
*-commutative39.2%
associate-*r*56.5%
distribute-rgt-neg-in56.5%
*-commutative56.5%
distribute-rgt-neg-in56.5%
Simplified56.5%
Final simplification73.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -8.2e+23) (not (<= t 1.7e-29))) (* x (exp (* y (- t)))) (* x (exp (* a (- (- b) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -8.2e+23) || !(t <= 1.7e-29)) {
tmp = x * exp((y * -t));
} else {
tmp = x * exp((a * (-b - 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 ((t <= (-8.2d+23)) .or. (.not. (t <= 1.7d-29))) then
tmp = x * exp((y * -t))
else
tmp = x * exp((a * (-b - 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 ((t <= -8.2e+23) || !(t <= 1.7e-29)) {
tmp = x * Math.exp((y * -t));
} else {
tmp = x * Math.exp((a * (-b - z)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -8.2e+23) or not (t <= 1.7e-29): tmp = x * math.exp((y * -t)) else: tmp = x * math.exp((a * (-b - z))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -8.2e+23) || !(t <= 1.7e-29)) tmp = Float64(x * exp(Float64(y * Float64(-t)))); else tmp = Float64(x * exp(Float64(a * Float64(Float64(-b) - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -8.2e+23) || ~((t <= 1.7e-29))) tmp = x * exp((y * -t)); else tmp = x * exp((a * (-b - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -8.2e+23], N[Not[LessEqual[t, 1.7e-29]], $MachinePrecision]], N[(x * N[Exp[N[(y * (-t)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * N[((-b) - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+23} \lor \neg \left(t \leq 1.7 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(-t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(\left(-b\right) - z\right)}\\
\end{array}
\end{array}
if t < -8.19999999999999992e23 or 1.69999999999999986e-29 < t Initial program 97.1%
Taylor expanded in t around inf 82.3%
mul-1-neg82.3%
distribute-lft-neg-out82.3%
*-commutative82.3%
Simplified82.3%
if -8.19999999999999992e23 < t < 1.69999999999999986e-29Initial program 98.3%
Taylor expanded in y around 0 70.7%
sub-neg70.7%
log1p-define73.3%
Simplified73.3%
Taylor expanded in z around 0 73.3%
distribute-lft-out73.3%
mul-1-neg73.3%
distribute-lft-out73.3%
Simplified73.3%
Final simplification78.2%
(FPCore (x y z t a b) :precision binary64 (if (<= t -8.2e+15) (* x (- 1.0 (* y t))) (* x (pow z y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -8.2e+15) {
tmp = x * (1.0 - (y * t));
} 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) :: tmp
if (t <= (-8.2d+15)) then
tmp = x * (1.0d0 - (y * t))
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 tmp;
if (t <= -8.2e+15) {
tmp = x * (1.0 - (y * t));
} else {
tmp = x * Math.pow(z, y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -8.2e+15: tmp = x * (1.0 - (y * t)) else: tmp = x * math.pow(z, y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -8.2e+15) tmp = Float64(x * Float64(1.0 - Float64(y * t))); else tmp = Float64(x * (z ^ y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -8.2e+15) tmp = x * (1.0 - (y * t)); else tmp = x * (z ^ y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -8.2e+15], N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.2 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -8.2e15Initial program 96.2%
Taylor expanded in t around inf 83.7%
mul-1-neg83.7%
distribute-lft-neg-out83.7%
*-commutative83.7%
Simplified83.7%
Taylor expanded in y around 0 39.5%
mul-1-neg39.5%
unsub-neg39.5%
*-commutative39.5%
Simplified39.5%
if -8.2e15 < t Initial program 98.3%
Taylor expanded in y around inf 70.1%
Taylor expanded in t around 0 62.5%
Final simplification55.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -6e+33) (not (<= y 2.5e-10))) (* x (* y (- t))) (* x (- 1.0 (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -6e+33) || !(y <= 2.5e-10)) {
tmp = x * (y * -t);
} else {
tmp = x * (1.0 - (a * 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 <= (-6d+33)) .or. (.not. (y <= 2.5d-10))) then
tmp = x * (y * -t)
else
tmp = x * (1.0d0 - (a * 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 <= -6e+33) || !(y <= 2.5e-10)) {
tmp = x * (y * -t);
} else {
tmp = x * (1.0 - (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -6e+33) or not (y <= 2.5e-10): tmp = x * (y * -t) else: tmp = x * (1.0 - (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -6e+33) || !(y <= 2.5e-10)) tmp = Float64(x * Float64(y * Float64(-t))); else tmp = Float64(x * Float64(1.0 - Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -6e+33) || ~((y <= 2.5e-10))) tmp = x * (y * -t); else tmp = x * (1.0 - (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -6e+33], N[Not[LessEqual[y, 2.5e-10]], $MachinePrecision]], N[(x * N[(y * (-t)), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+33} \lor \neg \left(y \leq 2.5 \cdot 10^{-10}\right):\\
\;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if y < -5.99999999999999967e33 or 2.50000000000000016e-10 < y Initial program 97.7%
Taylor expanded in t around inf 65.0%
mul-1-neg65.0%
distribute-lft-neg-out65.0%
*-commutative65.0%
Simplified65.0%
Taylor expanded in y around 0 28.6%
mul-1-neg28.6%
unsub-neg28.6%
*-commutative28.6%
Simplified28.6%
Taylor expanded in y around inf 27.0%
associate-*r*27.0%
associate-*r*27.0%
*-commutative27.0%
mul-1-neg27.0%
distribute-rgt-neg-in27.0%
Simplified27.0%
Taylor expanded in y around 0 27.0%
mul-1-neg27.0%
*-commutative27.0%
associate-*r*31.5%
distribute-rgt-neg-in31.5%
*-commutative31.5%
distribute-rgt-neg-in31.5%
Simplified31.5%
if -5.99999999999999967e33 < y < 2.50000000000000016e-10Initial program 97.7%
Taylor expanded in b around inf 77.1%
mul-1-neg77.1%
distribute-rgt-neg-out77.1%
Simplified77.1%
Taylor expanded in a around 0 43.2%
mul-1-neg43.2%
unsub-neg43.2%
Simplified43.2%
Final simplification37.3%
(FPCore (x y z t a b) :precision binary64 (if (<= y -8.5e+33) (* x (- 1.0 (* y t))) (if (<= y 1.9e-15) (* x (- 1.0 (* a b))) (* x (* y (- t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -8.5e+33) {
tmp = x * (1.0 - (y * t));
} else if (y <= 1.9e-15) {
tmp = x * (1.0 - (a * b));
} else {
tmp = x * (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 (y <= (-8.5d+33)) then
tmp = x * (1.0d0 - (y * t))
else if (y <= 1.9d-15) then
tmp = x * (1.0d0 - (a * b))
else
tmp = x * (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 (y <= -8.5e+33) {
tmp = x * (1.0 - (y * t));
} else if (y <= 1.9e-15) {
tmp = x * (1.0 - (a * b));
} else {
tmp = x * (y * -t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -8.5e+33: tmp = x * (1.0 - (y * t)) elif y <= 1.9e-15: tmp = x * (1.0 - (a * b)) else: tmp = x * (y * -t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -8.5e+33) tmp = Float64(x * Float64(1.0 - Float64(y * t))); elseif (y <= 1.9e-15) tmp = Float64(x * Float64(1.0 - Float64(a * b))); else tmp = Float64(x * Float64(y * Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -8.5e+33) tmp = x * (1.0 - (y * t)); elseif (y <= 1.9e-15) tmp = x * (1.0 - (a * b)); else tmp = x * (y * -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -8.5e+33], N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e-15], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y * (-t)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+33}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-15}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\
\end{array}
\end{array}
if y < -8.4999999999999998e33Initial program 95.3%
Taylor expanded in t around inf 66.4%
mul-1-neg66.4%
distribute-lft-neg-out66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in y around 0 28.3%
mul-1-neg28.3%
unsub-neg28.3%
*-commutative28.3%
Simplified28.3%
if -8.4999999999999998e33 < y < 1.9000000000000001e-15Initial program 97.7%
Taylor expanded in b around inf 77.1%
mul-1-neg77.1%
distribute-rgt-neg-out77.1%
Simplified77.1%
Taylor expanded in a around 0 43.2%
mul-1-neg43.2%
unsub-neg43.2%
Simplified43.2%
if 1.9000000000000001e-15 < y Initial program 100.0%
Taylor expanded in t around inf 63.5%
mul-1-neg63.5%
distribute-lft-neg-out63.5%
*-commutative63.5%
Simplified63.5%
Taylor expanded in y around 0 28.9%
mul-1-neg28.9%
unsub-neg28.9%
*-commutative28.9%
Simplified28.9%
Taylor expanded in y around inf 27.5%
associate-*r*31.8%
associate-*r*31.8%
*-commutative31.8%
mul-1-neg31.8%
distribute-rgt-neg-in31.8%
Simplified31.8%
Taylor expanded in y around 0 27.5%
mul-1-neg27.5%
*-commutative27.5%
associate-*r*34.9%
distribute-rgt-neg-in34.9%
*-commutative34.9%
distribute-rgt-neg-in34.9%
Simplified34.9%
Final simplification37.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -4.5e+33) (not (<= y 2.15e-7))) (* x (* y (- t))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.5e+33) || !(y <= 2.15e-7)) {
tmp = x * (y * -t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-4.5d+33)) .or. (.not. (y <= 2.15d-7))) then
tmp = x * (y * -t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -4.5e+33) || !(y <= 2.15e-7)) {
tmp = x * (y * -t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -4.5e+33) or not (y <= 2.15e-7): tmp = x * (y * -t) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -4.5e+33) || !(y <= 2.15e-7)) tmp = Float64(x * Float64(y * Float64(-t))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -4.5e+33) || ~((y <= 2.15e-7))) tmp = x * (y * -t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -4.5e+33], N[Not[LessEqual[y, 2.15e-7]], $MachinePrecision]], N[(x * N[(y * (-t)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+33} \lor \neg \left(y \leq 2.15 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.5e33 or 2.1500000000000001e-7 < y Initial program 97.6%
Taylor expanded in t around inf 64.7%
mul-1-neg64.7%
distribute-lft-neg-out64.7%
*-commutative64.7%
Simplified64.7%
Taylor expanded in y around 0 28.8%
mul-1-neg28.8%
unsub-neg28.8%
*-commutative28.8%
Simplified28.8%
Taylor expanded in y around inf 27.2%
associate-*r*27.2%
associate-*r*27.2%
*-commutative27.2%
mul-1-neg27.2%
distribute-rgt-neg-in27.2%
Simplified27.2%
Taylor expanded in y around 0 27.2%
mul-1-neg27.2%
*-commutative27.2%
associate-*r*31.7%
distribute-rgt-neg-in31.7%
*-commutative31.7%
distribute-rgt-neg-in31.7%
Simplified31.7%
if -4.5e33 < y < 2.1500000000000001e-7Initial program 97.7%
Taylor expanded in b around inf 76.5%
mul-1-neg76.5%
distribute-rgt-neg-out76.5%
Simplified76.5%
Taylor expanded in a around 0 33.8%
Final simplification32.8%
(FPCore (x y z t a b) :precision binary64 (if (<= x 3.4e-185) (* x (* y t)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= 3.4e-185) {
tmp = x * (y * t);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= 3.4d-185) then
tmp = x * (y * t)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= 3.4e-185) {
tmp = x * (y * t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= 3.4e-185: tmp = x * (y * t) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= 3.4e-185) tmp = Float64(x * Float64(y * t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= 3.4e-185) tmp = x * (y * t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, 3.4e-185], N[(x * N[(y * t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.4 \cdot 10^{-185}:\\
\;\;\;\;x \cdot \left(y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < 3.3999999999999998e-185Initial program 97.6%
Taylor expanded in t around inf 56.3%
mul-1-neg56.3%
distribute-lft-neg-out56.3%
*-commutative56.3%
Simplified56.3%
Taylor expanded in y around 0 29.9%
mul-1-neg29.9%
unsub-neg29.9%
*-commutative29.9%
Simplified29.9%
Taylor expanded in y around inf 20.6%
associate-*r*20.7%
associate-*r*20.7%
*-commutative20.7%
mul-1-neg20.7%
distribute-rgt-neg-in20.7%
Simplified20.7%
pow120.7%
associate-*r*23.6%
*-commutative23.6%
add-sqr-sqrt15.9%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod5.2%
add-sqr-sqrt11.9%
Applied egg-rr11.9%
unpow111.9%
*-commutative11.9%
Simplified11.9%
if 3.3999999999999998e-185 < x Initial program 97.8%
Taylor expanded in b around inf 54.1%
mul-1-neg54.1%
distribute-rgt-neg-out54.1%
Simplified54.1%
Taylor expanded in a around 0 20.4%
Final simplification15.0%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return 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 = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.7%
Taylor expanded in b around inf 55.3%
mul-1-neg55.3%
distribute-rgt-neg-out55.3%
Simplified55.3%
Taylor expanded in a around 0 18.9%
Final simplification18.9%
herbie shell --seed 2024078
(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))))))