
(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 95.8%
fma-define96.5%
sub-neg96.5%
log1p-define99.2%
Simplified99.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 95.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -5.6e-14) (not (<= y 6.8e-8))) (* x (pow (/ z (exp t)) y)) (* x (exp (* (- a) (+ z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -5.6e-14) || !(y <= 6.8e-8)) {
tmp = x * pow((z / exp(t)), y);
} else {
tmp = x * exp((-a * (z + b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-5.6d-14)) .or. (.not. (y <= 6.8d-8))) then
tmp = x * ((z / exp(t)) ** y)
else
tmp = x * exp((-a * (z + b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -5.6e-14) || !(y <= 6.8e-8)) {
tmp = x * Math.pow((z / Math.exp(t)), y);
} else {
tmp = x * Math.exp((-a * (z + b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -5.6e-14) or not (y <= 6.8e-8): tmp = x * math.pow((z / math.exp(t)), y) else: tmp = x * math.exp((-a * (z + b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -5.6e-14) || !(y <= 6.8e-8)) tmp = Float64(x * (Float64(z / exp(t)) ^ y)); else tmp = Float64(x * exp(Float64(Float64(-a) * Float64(z + b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -5.6e-14) || ~((y <= 6.8e-8))) tmp = x * ((z / exp(t)) ^ y); else tmp = x * exp((-a * (z + b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -5.6e-14], N[Not[LessEqual[y, 6.8e-8]], $MachinePrecision]], N[(x * N[Power[N[(z / N[Exp[t], $MachinePrecision]), $MachinePrecision], y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-a) * N[(z + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.6 \cdot 10^{-14} \lor \neg \left(y \leq 6.8 \cdot 10^{-8}\right):\\
\;\;\;\;x \cdot {\left(\frac{z}{e^{t}}\right)}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\
\end{array}
\end{array}
if y < -5.6000000000000001e-14 or 6.8e-8 < y Initial program 95.7%
fma-define97.2%
sub-neg97.2%
log1p-define98.6%
Simplified98.6%
Taylor expanded in a around 0 95.1%
*-commutative95.1%
exp-prod95.1%
exp-diff95.1%
rem-exp-log95.1%
Simplified95.1%
if -5.6000000000000001e-14 < y < 6.8e-8Initial program 95.8%
Taylor expanded in y around 0 89.1%
sub-neg89.1%
log1p-define93.3%
Simplified93.3%
Taylor expanded in z around 0 93.3%
associate-*r*93.3%
associate-*r*93.3%
distribute-lft-out93.3%
mul-1-neg93.3%
Simplified93.3%
Final simplification94.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.8e+21) (not (<= y 0.0022))) (* x (pow z y)) (* x (exp (* (- a) (+ z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.8e+21) || !(y <= 0.0022)) {
tmp = x * pow(z, y);
} else {
tmp = x * exp((-a * (z + b)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-1.8d+21)) .or. (.not. (y <= 0.0022d0))) then
tmp = x * (z ** y)
else
tmp = x * exp((-a * (z + b)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.8e+21) || !(y <= 0.0022)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * Math.exp((-a * (z + b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.8e+21) or not (y <= 0.0022): tmp = x * math.pow(z, y) else: tmp = x * math.exp((-a * (z + b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.8e+21) || !(y <= 0.0022)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(Float64(-a) * Float64(z + b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.8e+21) || ~((y <= 0.0022))) tmp = x * (z ^ y); else tmp = x * exp((-a * (z + b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.8e+21], N[Not[LessEqual[y, 0.0022]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[((-a) * N[(z + b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+21} \lor \neg \left(y \leq 0.0022\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{\left(-a\right) \cdot \left(z + b\right)}\\
\end{array}
\end{array}
if y < -1.8e21 or 0.00220000000000000013 < y Initial program 95.5%
fma-define97.0%
sub-neg97.0%
log1p-define98.5%
Simplified98.5%
Taylor expanded in a around 0 95.6%
*-commutative95.6%
exp-prod95.5%
exp-diff95.5%
rem-exp-log95.6%
Simplified95.6%
Taylor expanded in t around 0 77.1%
if -1.8e21 < y < 0.00220000000000000013Initial program 96.0%
Taylor expanded in y around 0 86.1%
sub-neg86.1%
log1p-define90.1%
Simplified90.1%
Taylor expanded in z around 0 90.1%
associate-*r*90.1%
associate-*r*90.1%
distribute-lft-out90.1%
mul-1-neg90.1%
Simplified90.1%
Final simplification83.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.15e+21) (not (<= y 0.008))) (* x (pow z y)) (* x (exp (* a (- b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.15e+21) || !(y <= 0.008)) {
tmp = x * pow(z, y);
} else {
tmp = x * exp((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 <= (-2.15d+21)) .or. (.not. (y <= 0.008d0))) then
tmp = x * (z ** y)
else
tmp = x * exp((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 <= -2.15e+21) || !(y <= 0.008)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * Math.exp((a * -b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.15e+21) or not (y <= 0.008): tmp = x * math.pow(z, y) else: tmp = x * math.exp((a * -b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.15e+21) || !(y <= 0.008)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(a * Float64(-b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.15e+21) || ~((y <= 0.008))) tmp = x * (z ^ y); else tmp = x * exp((a * -b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.15e+21], N[Not[LessEqual[y, 0.008]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[N[(a * (-b)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+21} \lor \neg \left(y \leq 0.008\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{a \cdot \left(-b\right)}\\
\end{array}
\end{array}
if y < -2.15e21 or 0.0080000000000000002 < y Initial program 95.5%
fma-define97.0%
sub-neg97.0%
log1p-define98.5%
Simplified98.5%
Taylor expanded in a around 0 95.6%
*-commutative95.6%
exp-prod95.5%
exp-diff95.5%
rem-exp-log95.6%
Simplified95.6%
Taylor expanded in t around 0 77.1%
if -2.15e21 < y < 0.0080000000000000002Initial program 96.0%
Taylor expanded in b around inf 84.5%
mul-1-neg84.5%
distribute-rgt-neg-out84.5%
Simplified84.5%
Final simplification80.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -6500000.0) (* 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 <= -6500000.0) {
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 <= (-6500000.0d0)) 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 <= -6500000.0) {
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 <= -6500000.0: 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 <= -6500000.0) 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 <= -6500000.0) 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, -6500000.0], 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 -6500000:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot {z}^{y}\\
\end{array}
\end{array}
if t < -6.5e6Initial program 92.4%
Taylor expanded in t around inf 88.7%
mul-1-neg88.7%
distribute-lft-neg-out88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in y around 0 30.9%
mul-1-neg30.9%
unsub-neg30.9%
Simplified30.9%
Taylor expanded in x around 0 36.3%
if -6.5e6 < t Initial program 96.6%
fma-define97.1%
sub-neg97.1%
log1p-define99.5%
Simplified99.5%
Taylor expanded in a around 0 74.8%
*-commutative74.8%
exp-prod72.3%
exp-diff72.3%
rem-exp-log72.3%
Simplified72.3%
Taylor expanded in t around 0 70.2%
Final simplification63.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.05e-15) (not (<= y 3.9e-48))) (* t (* x (- y))) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.05e-15) || !(y <= 3.9e-48)) {
tmp = t * (x * -y);
} 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 <= (-1.05d-15)) .or. (.not. (y <= 3.9d-48))) then
tmp = t * (x * -y)
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 <= -1.05e-15) || !(y <= 3.9e-48)) {
tmp = t * (x * -y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.05e-15) or not (y <= 3.9e-48): tmp = t * (x * -y) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.05e-15) || !(y <= 3.9e-48)) tmp = Float64(t * Float64(x * Float64(-y))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.05e-15) || ~((y <= 3.9e-48))) tmp = t * (x * -y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.05e-15], N[Not[LessEqual[y, 3.9e-48]], $MachinePrecision]], N[(t * N[(x * (-y)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{-15} \lor \neg \left(y \leq 3.9 \cdot 10^{-48}\right):\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.0499999999999999e-15 or 3.9e-48 < y Initial program 95.9%
Taylor expanded in t around inf 59.7%
mul-1-neg59.7%
distribute-lft-neg-out59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in y around 0 17.9%
mul-1-neg17.9%
unsub-neg17.9%
Simplified17.9%
Taylor expanded in t around inf 18.9%
mul-1-neg18.9%
distribute-rgt-neg-in18.9%
distribute-rgt-neg-in18.9%
Simplified18.9%
if -1.0499999999999999e-15 < y < 3.9e-48Initial program 95.6%
fma-define95.6%
sub-neg95.6%
log1p-define100.0%
Simplified100.0%
Taylor expanded in a around 0 56.4%
*-commutative56.4%
exp-prod50.2%
exp-diff50.2%
rem-exp-log50.2%
Simplified50.2%
Taylor expanded in y around 0 41.8%
Final simplification28.8%
(FPCore (x y z t a b) :precision binary64 (if (<= y -7e-16) (* t (* x (- y))) (if (<= y 3.9e-48) x (* x (* t (- y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7e-16) {
tmp = t * (x * -y);
} else if (y <= 3.9e-48) {
tmp = x;
} else {
tmp = x * (t * -y);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y <= (-7d-16)) then
tmp = t * (x * -y)
else if (y <= 3.9d-48) then
tmp = x
else
tmp = x * (t * -y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -7e-16) {
tmp = t * (x * -y);
} else if (y <= 3.9e-48) {
tmp = x;
} else {
tmp = x * (t * -y);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -7e-16: tmp = t * (x * -y) elif y <= 3.9e-48: tmp = x else: tmp = x * (t * -y) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -7e-16) tmp = Float64(t * Float64(x * Float64(-y))); elseif (y <= 3.9e-48) tmp = x; else tmp = Float64(x * Float64(t * Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -7e-16) tmp = t * (x * -y); elseif (y <= 3.9e-48) tmp = x; else tmp = x * (t * -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -7e-16], N[(t * N[(x * (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.9e-48], x, N[(x * N[(t * (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7 \cdot 10^{-16}:\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\
\mathbf{elif}\;y \leq 3.9 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(t \cdot \left(-y\right)\right)\\
\end{array}
\end{array}
if y < -7.00000000000000035e-16Initial program 98.5%
Taylor expanded in t around inf 64.2%
mul-1-neg64.2%
distribute-lft-neg-out64.2%
*-commutative64.2%
Simplified64.2%
Taylor expanded in y around 0 21.7%
mul-1-neg21.7%
unsub-neg21.7%
Simplified21.7%
Taylor expanded in t around inf 21.5%
mul-1-neg21.5%
distribute-rgt-neg-in21.5%
distribute-rgt-neg-in21.5%
Simplified21.5%
if -7.00000000000000035e-16 < y < 3.9e-48Initial program 95.6%
fma-define95.6%
sub-neg95.6%
log1p-define100.0%
Simplified100.0%
Taylor expanded in a around 0 56.4%
*-commutative56.4%
exp-prod50.2%
exp-diff50.2%
rem-exp-log50.2%
Simplified50.2%
Taylor expanded in y around 0 41.8%
if 3.9e-48 < y Initial program 93.6%
Taylor expanded in t around inf 55.7%
mul-1-neg55.7%
distribute-lft-neg-out55.7%
*-commutative55.7%
Simplified55.7%
Taylor expanded in y around 0 14.7%
mul-1-neg14.7%
unsub-neg14.7%
Simplified14.7%
Taylor expanded in t around inf 16.7%
*-commutative16.7%
associate-*r*16.7%
neg-mul-116.7%
distribute-rgt-neg-in16.7%
associate-*r*20.3%
Simplified20.3%
Final simplification29.9%
(FPCore (x y z t a b) :precision binary64 (if (<= y 8.5e-149) (* t (- (/ x t) (* x y))) (* y (- (/ x y) (* x t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= 8.5e-149) {
tmp = t * ((x / t) - (x * y));
} else {
tmp = y * ((x / y) - (x * 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-149) then
tmp = t * ((x / t) - (x * y))
else
tmp = y * ((x / y) - (x * 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-149) {
tmp = t * ((x / t) - (x * y));
} else {
tmp = y * ((x / y) - (x * t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= 8.5e-149: tmp = t * ((x / t) - (x * y)) else: tmp = y * ((x / y) - (x * t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= 8.5e-149) tmp = Float64(t * Float64(Float64(x / t) - Float64(x * y))); else tmp = Float64(y * Float64(Float64(x / y) - Float64(x * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= 8.5e-149) tmp = t * ((x / t) - (x * y)); else tmp = y * ((x / y) - (x * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, 8.5e-149], N[(t * N[(N[(x / t), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(x / y), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.5 \cdot 10^{-149}:\\
\;\;\;\;t \cdot \left(\frac{x}{t} - x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{x}{y} - x \cdot t\right)\\
\end{array}
\end{array}
if y < 8.5000000000000006e-149Initial program 97.6%
Taylor expanded in t around inf 58.0%
mul-1-neg58.0%
distribute-lft-neg-out58.0%
*-commutative58.0%
Simplified58.0%
Taylor expanded in y around 0 34.6%
mul-1-neg34.6%
unsub-neg34.6%
Simplified34.6%
Taylor expanded in t around inf 36.9%
if 8.5000000000000006e-149 < y Initial program 92.5%
Taylor expanded in t around inf 58.7%
mul-1-neg58.7%
distribute-lft-neg-out58.7%
*-commutative58.7%
Simplified58.7%
Taylor expanded in y around 0 19.1%
mul-1-neg19.1%
unsub-neg19.1%
Simplified19.1%
Taylor expanded in y around inf 27.3%
*-commutative27.3%
Simplified27.3%
(FPCore (x y z t a b) :precision binary64 (if (<= x 3.8e+54) (* x (- 1.0 (* y t))) (* t (- (/ x t) (* x y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= 3.8e+54) {
tmp = x * (1.0 - (y * t));
} else {
tmp = t * ((x / t) - (x * 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 (x <= 3.8d+54) then
tmp = x * (1.0d0 - (y * t))
else
tmp = t * ((x / t) - (x * 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 (x <= 3.8e+54) {
tmp = x * (1.0 - (y * t));
} else {
tmp = t * ((x / t) - (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= 3.8e+54: tmp = x * (1.0 - (y * t)) else: tmp = t * ((x / t) - (x * y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= 3.8e+54) tmp = Float64(x * Float64(1.0 - Float64(y * t))); else tmp = Float64(t * Float64(Float64(x / t) - Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= 3.8e+54) tmp = x * (1.0 - (y * t)); else tmp = t * ((x / t) - (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, 3.8e+54], N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(x / t), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.8 \cdot 10^{+54}:\\
\;\;\;\;x \cdot \left(1 - y \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\frac{x}{t} - x \cdot y\right)\\
\end{array}
\end{array}
if x < 3.8000000000000002e54Initial program 96.6%
Taylor expanded in t around inf 57.0%
mul-1-neg57.0%
distribute-lft-neg-out57.0%
*-commutative57.0%
Simplified57.0%
Taylor expanded in y around 0 26.1%
mul-1-neg26.1%
unsub-neg26.1%
Simplified26.1%
Taylor expanded in x around 0 27.6%
if 3.8000000000000002e54 < x Initial program 92.4%
Taylor expanded in t around inf 63.2%
mul-1-neg63.2%
distribute-lft-neg-out63.2%
*-commutative63.2%
Simplified63.2%
Taylor expanded in y around 0 40.1%
mul-1-neg40.1%
unsub-neg40.1%
Simplified40.1%
Taylor expanded in t around inf 41.9%
Final simplification30.5%
(FPCore (x y z t a b) :precision binary64 (* x (- 1.0 (* y t))))
double code(double x, double y, double z, double t, double a, double b) {
return x * (1.0 - (y * t));
}
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 - (y * t))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * (1.0 - (y * t));
}
def code(x, y, z, t, a, b): return x * (1.0 - (y * t))
function code(x, y, z, t, a, b) return Float64(x * Float64(1.0 - Float64(y * t))) end
function tmp = code(x, y, z, t, a, b) tmp = x * (1.0 - (y * t)); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[(1.0 - N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y \cdot t\right)
\end{array}
Initial program 95.8%
Taylor expanded in t around inf 58.2%
mul-1-neg58.2%
distribute-lft-neg-out58.2%
*-commutative58.2%
Simplified58.2%
Taylor expanded in y around 0 29.0%
mul-1-neg29.0%
unsub-neg29.0%
Simplified29.0%
Taylor expanded in x around 0 29.9%
Final simplification29.9%
(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 95.8%
fma-define96.5%
sub-neg96.5%
log1p-define99.2%
Simplified99.2%
Taylor expanded in a around 0 77.6%
*-commutative77.6%
exp-prod74.9%
exp-diff74.9%
rem-exp-log74.9%
Simplified74.9%
Taylor expanded in y around 0 20.5%
herbie shell --seed 2024091
(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))))))