
(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 (+ (* 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 98.1%
Final simplification98.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.9e-69) (not (<= y 6.9e-28))) (* x (exp (* y (- (log z) t)))) (* x (exp (- (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.9e-69) || !(y <= 6.9e-28)) {
tmp = x * exp((y * (log(z) - t)));
} 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 <= (-1.9d-69)) .or. (.not. (y <= 6.9d-28))) then
tmp = x * exp((y * (log(z) - t)))
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 <= -1.9e-69) || !(y <= 6.9e-28)) {
tmp = x * Math.exp((y * (Math.log(z) - t)));
} else {
tmp = x * Math.exp(-(a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.9e-69) or not (y <= 6.9e-28): tmp = x * math.exp((y * (math.log(z) - t))) else: tmp = x * math.exp(-(a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.9e-69) || !(y <= 6.9e-28)) tmp = Float64(x * exp(Float64(y * Float64(log(z) - t)))); else tmp = Float64(x * exp(Float64(-Float64(a * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.9e-69) || ~((y <= 6.9e-28))) tmp = x * exp((y * (log(z) - t))); else tmp = x * exp(-(a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.9e-69], N[Not[LessEqual[y, 6.9e-28]], $MachinePrecision]], N[(x * N[Exp[N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[Exp[(-N[(a * b), $MachinePrecision])], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{-69} \lor \neg \left(y \leq 6.9 \cdot 10^{-28}\right):\\
\;\;\;\;x \cdot e^{y \cdot \left(\log z - t\right)}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{-a \cdot b}\\
\end{array}
\end{array}
if y < -1.8999999999999999e-69 or 6.90000000000000001e-28 < y Initial program 97.3%
Taylor expanded in y around inf 92.9%
if -1.8999999999999999e-69 < y < 6.90000000000000001e-28Initial program 99.1%
Taylor expanded in b around inf 85.7%
mul-1-neg85.7%
distribute-rgt-neg-out85.7%
Simplified85.7%
Final simplification89.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -5.6e+24) (not (<= y 7.0))) (* 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 <= -5.6e+24) || !(y <= 7.0)) {
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 <= (-5.6d+24)) .or. (.not. (y <= 7.0d0))) 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 <= -5.6e+24) || !(y <= 7.0)) {
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 <= -5.6e+24) or not (y <= 7.0): 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 <= -5.6e+24) || !(y <= 7.0)) tmp = Float64(x * (z ^ y)); else tmp = Float64(x * exp(Float64(-Float64(a * b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -5.6e+24) || ~((y <= 7.0))) 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, -5.6e+24], N[Not[LessEqual[y, 7.0]], $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 -5.6 \cdot 10^{+24} \lor \neg \left(y \leq 7\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot e^{-a \cdot b}\\
\end{array}
\end{array}
if y < -5.6000000000000003e24 or 7 < y Initial program 97.6%
Taylor expanded in y around inf 96.8%
Taylor expanded in t around 0 79.4%
if -5.6000000000000003e24 < y < 7Initial program 98.5%
Taylor expanded in b around inf 80.1%
mul-1-neg80.1%
distribute-rgt-neg-out80.1%
Simplified80.1%
Final simplification79.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.08e-17) (not (<= y 4.5e-5))) (* x (pow z y)) (* x (- 1.0 (* a b)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.08e-17) || !(y <= 4.5e-5)) {
tmp = x * pow(z, y);
} 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 <= (-1.08d-17)) .or. (.not. (y <= 4.5d-5))) then
tmp = x * (z ** y)
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 <= -1.08e-17) || !(y <= 4.5e-5)) {
tmp = x * Math.pow(z, y);
} else {
tmp = x * (1.0 - (a * b));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.08e-17) or not (y <= 4.5e-5): tmp = x * math.pow(z, y) else: tmp = x * (1.0 - (a * b)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.08e-17) || !(y <= 4.5e-5)) tmp = Float64(x * (z ^ y)); 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 <= -1.08e-17) || ~((y <= 4.5e-5))) tmp = x * (z ^ y); else tmp = x * (1.0 - (a * b)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.08e-17], N[Not[LessEqual[y, 4.5e-5]], $MachinePrecision]], N[(x * N[Power[z, y], $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{-17} \lor \neg \left(y \leq 4.5 \cdot 10^{-5}\right):\\
\;\;\;\;x \cdot {z}^{y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\end{array}
\end{array}
if y < -1.07999999999999995e-17 or 4.50000000000000028e-5 < y Initial program 97.7%
Taylor expanded in y around inf 96.3%
Taylor expanded in t around 0 76.3%
if -1.07999999999999995e-17 < y < 4.50000000000000028e-5Initial program 98.4%
Taylor expanded in b around inf 81.4%
mul-1-neg81.4%
distribute-rgt-neg-out81.4%
Simplified81.4%
Taylor expanded in a around 0 49.9%
mul-1-neg49.9%
unsub-neg49.9%
Simplified49.9%
Final simplification63.6%
(FPCore (x y z t a b) :precision binary64 (if (<= y -9.5e+44) (* t (* x (- y))) (if (<= y 1.8e-51) (* x (- 1.0 (* a b))) (* x (- (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -9.5e+44) {
tmp = t * (x * -y);
} else if (y <= 1.8e-51) {
tmp = x * (1.0 - (a * b));
} else {
tmp = x * -(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 <= (-9.5d+44)) then
tmp = t * (x * -y)
else if (y <= 1.8d-51) then
tmp = x * (1.0d0 - (a * b))
else
tmp = x * -(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 <= -9.5e+44) {
tmp = t * (x * -y);
} else if (y <= 1.8e-51) {
tmp = x * (1.0 - (a * b));
} else {
tmp = x * -(a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -9.5e+44: tmp = t * (x * -y) elif y <= 1.8e-51: tmp = x * (1.0 - (a * b)) else: tmp = x * -(a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -9.5e+44) tmp = Float64(t * Float64(x * Float64(-y))); elseif (y <= 1.8e-51) tmp = Float64(x * Float64(1.0 - Float64(a * b))); else tmp = Float64(x * Float64(-Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -9.5e+44) tmp = t * (x * -y); elseif (y <= 1.8e-51) tmp = x * (1.0 - (a * b)); else tmp = x * -(a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -9.5e+44], N[(t * N[(x * (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e-51], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * (-N[(a * b), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+44}:\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-51}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-a \cdot b\right)\\
\end{array}
\end{array}
if y < -9.5000000000000004e44Initial program 98.4%
Taylor expanded in t around inf 62.6%
associate-*r*62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in t around 0 34.0%
mul-1-neg34.0%
unsub-neg34.0%
Simplified34.0%
Taylor expanded in t around inf 35.3%
if -9.5000000000000004e44 < y < 1.8e-51Initial program 98.4%
Taylor expanded in b around inf 81.4%
mul-1-neg81.4%
distribute-rgt-neg-out81.4%
Simplified81.4%
Taylor expanded in a around 0 48.2%
mul-1-neg48.2%
unsub-neg48.2%
Simplified48.2%
if 1.8e-51 < y Initial program 97.3%
Taylor expanded in b around inf 42.4%
mul-1-neg42.4%
distribute-rgt-neg-out42.4%
Simplified42.4%
Taylor expanded in a around 0 9.7%
mul-1-neg9.7%
unsub-neg9.7%
*-commutative9.7%
Simplified9.7%
Taylor expanded in a around inf 24.3%
mul-1-neg24.3%
associate-*r*30.8%
*-commutative30.8%
distribute-rgt-neg-in30.8%
distribute-rgt-neg-in30.8%
Simplified30.8%
Final simplification40.0%
(FPCore (x y z t a b) :precision binary64 (if (<= y -4.2e+42) (- x (* t (* x y))) (if (<= y 1.8e-51) (* x (- 1.0 (* a b))) (* x (- (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -4.2e+42) {
tmp = x - (t * (x * y));
} else if (y <= 1.8e-51) {
tmp = x * (1.0 - (a * b));
} else {
tmp = x * -(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 <= (-4.2d+42)) then
tmp = x - (t * (x * y))
else if (y <= 1.8d-51) then
tmp = x * (1.0d0 - (a * b))
else
tmp = x * -(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 <= -4.2e+42) {
tmp = x - (t * (x * y));
} else if (y <= 1.8e-51) {
tmp = x * (1.0 - (a * b));
} else {
tmp = x * -(a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -4.2e+42: tmp = x - (t * (x * y)) elif y <= 1.8e-51: tmp = x * (1.0 - (a * b)) else: tmp = x * -(a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -4.2e+42) tmp = Float64(x - Float64(t * Float64(x * y))); elseif (y <= 1.8e-51) tmp = Float64(x * Float64(1.0 - Float64(a * b))); else tmp = Float64(x * Float64(-Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -4.2e+42) tmp = x - (t * (x * y)); elseif (y <= 1.8e-51) tmp = x * (1.0 - (a * b)); else tmp = x * -(a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -4.2e+42], N[(x - N[(t * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e-51], N[(x * N[(1.0 - N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * (-N[(a * b), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+42}:\\
\;\;\;\;x - t \cdot \left(x \cdot y\right)\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-51}:\\
\;\;\;\;x \cdot \left(1 - a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-a \cdot b\right)\\
\end{array}
\end{array}
if y < -4.19999999999999991e42Initial program 98.4%
Taylor expanded in t around inf 62.6%
associate-*r*62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in t around 0 35.4%
mul-1-neg35.4%
unsub-neg35.4%
*-commutative35.4%
Simplified35.4%
if -4.19999999999999991e42 < y < 1.8e-51Initial program 98.4%
Taylor expanded in b around inf 81.4%
mul-1-neg81.4%
distribute-rgt-neg-out81.4%
Simplified81.4%
Taylor expanded in a around 0 48.2%
mul-1-neg48.2%
unsub-neg48.2%
Simplified48.2%
if 1.8e-51 < y Initial program 97.3%
Taylor expanded in b around inf 42.4%
mul-1-neg42.4%
distribute-rgt-neg-out42.4%
Simplified42.4%
Taylor expanded in a around 0 9.7%
mul-1-neg9.7%
unsub-neg9.7%
*-commutative9.7%
Simplified9.7%
Taylor expanded in a around inf 24.3%
mul-1-neg24.3%
associate-*r*30.8%
*-commutative30.8%
distribute-rgt-neg-in30.8%
distribute-rgt-neg-in30.8%
Simplified30.8%
Final simplification40.1%
(FPCore (x y z t a b) :precision binary64 (if (<= y -2.3e+24) (* b (* x a)) (if (<= y 1.02e-53) x (* b (* x (- a))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -2.3e+24) {
tmp = b * (x * a);
} else if (y <= 1.02e-53) {
tmp = x;
} else {
tmp = b * (x * -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.3d+24)) then
tmp = b * (x * a)
else if (y <= 1.02d-53) then
tmp = x
else
tmp = b * (x * -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.3e+24) {
tmp = b * (x * a);
} else if (y <= 1.02e-53) {
tmp = x;
} else {
tmp = b * (x * -a);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -2.3e+24: tmp = b * (x * a) elif y <= 1.02e-53: tmp = x else: tmp = b * (x * -a) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -2.3e+24) tmp = Float64(b * Float64(x * a)); elseif (y <= 1.02e-53) tmp = x; else tmp = Float64(b * Float64(x * Float64(-a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -2.3e+24) tmp = b * (x * a); elseif (y <= 1.02e-53) tmp = x; else tmp = b * (x * -a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -2.3e+24], N[(b * N[(x * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.02e-53], x, N[(b * N[(x * (-a)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+24}:\\
\;\;\;\;b \cdot \left(x \cdot a\right)\\
\mathbf{elif}\;y \leq 1.02 \cdot 10^{-53}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(x \cdot \left(-a\right)\right)\\
\end{array}
\end{array}
if y < -2.2999999999999999e24Initial program 98.5%
Taylor expanded in b around inf 25.6%
mul-1-neg25.6%
distribute-rgt-neg-out25.6%
Simplified25.6%
Taylor expanded in a around 0 12.1%
mul-1-neg12.1%
unsub-neg12.1%
*-commutative12.1%
Simplified12.1%
Taylor expanded in a around inf 18.1%
mul-1-neg18.1%
associate-*r*15.4%
*-commutative15.4%
distribute-rgt-neg-in15.4%
distribute-rgt-neg-in15.4%
Simplified15.4%
expm1-log1p-u8.9%
expm1-udef16.0%
add-sqr-sqrt1.9%
sqrt-unprod16.1%
sqr-neg16.1%
sqrt-unprod14.1%
add-sqr-sqrt17.8%
Applied egg-rr17.8%
expm1-def10.7%
expm1-log1p12.8%
associate-*r*17.1%
Simplified17.1%
if -2.2999999999999999e24 < y < 1.02000000000000002e-53Initial program 98.3%
Taylor expanded in b around inf 84.0%
mul-1-neg84.0%
distribute-rgt-neg-out84.0%
Simplified84.0%
Taylor expanded in a around 0 37.7%
if 1.02000000000000002e-53 < y Initial program 97.3%
Taylor expanded in b around inf 42.4%
mul-1-neg42.4%
distribute-rgt-neg-out42.4%
Simplified42.4%
Taylor expanded in a around 0 9.7%
mul-1-neg9.7%
unsub-neg9.7%
*-commutative9.7%
Simplified9.7%
Taylor expanded in a around inf 24.3%
mul-1-neg24.3%
associate-*r*30.8%
*-commutative30.8%
distribute-rgt-neg-in30.8%
distribute-rgt-neg-in30.8%
Simplified30.8%
Taylor expanded in x around 0 24.3%
mul-1-neg24.3%
associate-*r*30.8%
*-commutative30.8%
associate-*r*25.5%
Simplified25.5%
Final simplification28.8%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.6e+24) (* b (* x a)) (if (<= y 7.4e-52) x (* x (- (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.6e+24) {
tmp = b * (x * a);
} else if (y <= 7.4e-52) {
tmp = x;
} else {
tmp = x * -(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 <= (-1.6d+24)) then
tmp = b * (x * a)
else if (y <= 7.4d-52) then
tmp = x
else
tmp = x * -(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 <= -1.6e+24) {
tmp = b * (x * a);
} else if (y <= 7.4e-52) {
tmp = x;
} else {
tmp = x * -(a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.6e+24: tmp = b * (x * a) elif y <= 7.4e-52: tmp = x else: tmp = x * -(a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.6e+24) tmp = Float64(b * Float64(x * a)); elseif (y <= 7.4e-52) tmp = x; else tmp = Float64(x * Float64(-Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.6e+24) tmp = b * (x * a); elseif (y <= 7.4e-52) tmp = x; else tmp = x * -(a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.6e+24], N[(b * N[(x * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.4e-52], x, N[(x * (-N[(a * b), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+24}:\\
\;\;\;\;b \cdot \left(x \cdot a\right)\\
\mathbf{elif}\;y \leq 7.4 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-a \cdot b\right)\\
\end{array}
\end{array}
if y < -1.5999999999999999e24Initial program 98.5%
Taylor expanded in b around inf 25.6%
mul-1-neg25.6%
distribute-rgt-neg-out25.6%
Simplified25.6%
Taylor expanded in a around 0 12.1%
mul-1-neg12.1%
unsub-neg12.1%
*-commutative12.1%
Simplified12.1%
Taylor expanded in a around inf 18.1%
mul-1-neg18.1%
associate-*r*15.4%
*-commutative15.4%
distribute-rgt-neg-in15.4%
distribute-rgt-neg-in15.4%
Simplified15.4%
expm1-log1p-u8.9%
expm1-udef16.0%
add-sqr-sqrt1.9%
sqrt-unprod16.1%
sqr-neg16.1%
sqrt-unprod14.1%
add-sqr-sqrt17.8%
Applied egg-rr17.8%
expm1-def10.7%
expm1-log1p12.8%
associate-*r*17.1%
Simplified17.1%
if -1.5999999999999999e24 < y < 7.3999999999999995e-52Initial program 98.3%
Taylor expanded in b around inf 84.0%
mul-1-neg84.0%
distribute-rgt-neg-out84.0%
Simplified84.0%
Taylor expanded in a around 0 37.7%
if 7.3999999999999995e-52 < y Initial program 97.3%
Taylor expanded in b around inf 42.4%
mul-1-neg42.4%
distribute-rgt-neg-out42.4%
Simplified42.4%
Taylor expanded in a around 0 9.7%
mul-1-neg9.7%
unsub-neg9.7%
*-commutative9.7%
Simplified9.7%
Taylor expanded in a around inf 24.3%
mul-1-neg24.3%
associate-*r*30.8%
*-commutative30.8%
distribute-rgt-neg-in30.8%
distribute-rgt-neg-in30.8%
Simplified30.8%
Final simplification30.4%
(FPCore (x y z t a b) :precision binary64 (if (<= y -1.32e+39) (* x (* y (- t))) (if (<= y 5.5e-54) x (* x (- (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.32e+39) {
tmp = x * (y * -t);
} else if (y <= 5.5e-54) {
tmp = x;
} else {
tmp = x * -(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 <= (-1.32d+39)) then
tmp = x * (y * -t)
else if (y <= 5.5d-54) then
tmp = x
else
tmp = x * -(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 <= -1.32e+39) {
tmp = x * (y * -t);
} else if (y <= 5.5e-54) {
tmp = x;
} else {
tmp = x * -(a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -1.32e+39: tmp = x * (y * -t) elif y <= 5.5e-54: tmp = x else: tmp = x * -(a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.32e+39) tmp = Float64(x * Float64(y * Float64(-t))); elseif (y <= 5.5e-54) tmp = x; else tmp = Float64(x * Float64(-Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -1.32e+39) tmp = x * (y * -t); elseif (y <= 5.5e-54) tmp = x; else tmp = x * -(a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.32e+39], N[(x * N[(y * (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e-54], x, N[(x * (-N[(a * b), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.32 \cdot 10^{+39}:\\
\;\;\;\;x \cdot \left(y \cdot \left(-t\right)\right)\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-54}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-a \cdot b\right)\\
\end{array}
\end{array}
if y < -1.32e39Initial program 98.4%
Taylor expanded in t around inf 62.6%
associate-*r*62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in t around 0 34.0%
mul-1-neg34.0%
unsub-neg34.0%
Simplified34.0%
Taylor expanded in t around inf 35.3%
mul-1-neg35.3%
*-commutative35.3%
associate-*r*33.7%
distribute-lft-neg-in33.7%
*-commutative33.7%
Simplified33.7%
if -1.32e39 < y < 5.50000000000000046e-54Initial program 98.4%
Taylor expanded in b around inf 81.4%
mul-1-neg81.4%
distribute-rgt-neg-out81.4%
Simplified81.4%
Taylor expanded in a around 0 36.6%
if 5.50000000000000046e-54 < y Initial program 97.3%
Taylor expanded in b around inf 42.4%
mul-1-neg42.4%
distribute-rgt-neg-out42.4%
Simplified42.4%
Taylor expanded in a around 0 9.7%
mul-1-neg9.7%
unsub-neg9.7%
*-commutative9.7%
Simplified9.7%
Taylor expanded in a around inf 24.3%
mul-1-neg24.3%
associate-*r*30.8%
*-commutative30.8%
distribute-rgt-neg-in30.8%
distribute-rgt-neg-in30.8%
Simplified30.8%
Final simplification34.2%
(FPCore (x y z t a b) :precision binary64 (if (<= y -5e+37) (* t (* x (- y))) (if (<= y 3.1e-52) x (* x (- (* a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -5e+37) {
tmp = t * (x * -y);
} else if (y <= 3.1e-52) {
tmp = x;
} else {
tmp = x * -(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 <= (-5d+37)) then
tmp = t * (x * -y)
else if (y <= 3.1d-52) then
tmp = x
else
tmp = x * -(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 <= -5e+37) {
tmp = t * (x * -y);
} else if (y <= 3.1e-52) {
tmp = x;
} else {
tmp = x * -(a * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y <= -5e+37: tmp = t * (x * -y) elif y <= 3.1e-52: tmp = x else: tmp = x * -(a * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -5e+37) tmp = Float64(t * Float64(x * Float64(-y))); elseif (y <= 3.1e-52) tmp = x; else tmp = Float64(x * Float64(-Float64(a * b))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y <= -5e+37) tmp = t * (x * -y); elseif (y <= 3.1e-52) tmp = x; else tmp = x * -(a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -5e+37], N[(t * N[(x * (-y)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e-52], x, N[(x * (-N[(a * b), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+37}:\\
\;\;\;\;t \cdot \left(x \cdot \left(-y\right)\right)\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-a \cdot b\right)\\
\end{array}
\end{array}
if y < -4.99999999999999989e37Initial program 98.4%
Taylor expanded in t around inf 62.6%
associate-*r*62.6%
mul-1-neg62.6%
Simplified62.6%
Taylor expanded in t around 0 34.0%
mul-1-neg34.0%
unsub-neg34.0%
Simplified34.0%
Taylor expanded in t around inf 35.3%
if -4.99999999999999989e37 < y < 3.0999999999999999e-52Initial program 98.4%
Taylor expanded in b around inf 81.4%
mul-1-neg81.4%
distribute-rgt-neg-out81.4%
Simplified81.4%
Taylor expanded in a around 0 36.6%
if 3.0999999999999999e-52 < y Initial program 97.3%
Taylor expanded in b around inf 42.4%
mul-1-neg42.4%
distribute-rgt-neg-out42.4%
Simplified42.4%
Taylor expanded in a around 0 9.7%
mul-1-neg9.7%
unsub-neg9.7%
*-commutative9.7%
Simplified9.7%
Taylor expanded in a around inf 24.3%
mul-1-neg24.3%
associate-*r*30.8%
*-commutative30.8%
distribute-rgt-neg-in30.8%
distribute-rgt-neg-in30.8%
Simplified30.8%
Final simplification34.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -1.5e+24) (not (<= y 1.8e-51))) (* b (* x a)) x))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.5e+24) || !(y <= 1.8e-51)) {
tmp = b * (x * a);
} 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.5d+24)) .or. (.not. (y <= 1.8d-51))) then
tmp = b * (x * a)
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.5e+24) || !(y <= 1.8e-51)) {
tmp = b * (x * a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.5e+24) or not (y <= 1.8e-51): tmp = b * (x * a) else: tmp = x return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.5e+24) || !(y <= 1.8e-51)) tmp = Float64(b * Float64(x * a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -1.5e+24) || ~((y <= 1.8e-51))) tmp = b * (x * a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.5e+24], N[Not[LessEqual[y, 1.8e-51]], $MachinePrecision]], N[(b * N[(x * a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{+24} \lor \neg \left(y \leq 1.8 \cdot 10^{-51}\right):\\
\;\;\;\;b \cdot \left(x \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.49999999999999997e24 or 1.8e-51 < y Initial program 97.9%
Taylor expanded in b around inf 34.5%
mul-1-neg34.5%
distribute-rgt-neg-out34.5%
Simplified34.5%
Taylor expanded in a around 0 10.8%
mul-1-neg10.8%
unsub-neg10.8%
*-commutative10.8%
Simplified10.8%
Taylor expanded in a around inf 21.4%
mul-1-neg21.4%
associate-*r*23.5%
*-commutative23.5%
distribute-rgt-neg-in23.5%
distribute-rgt-neg-in23.5%
Simplified23.5%
expm1-log1p-u19.6%
expm1-udef33.7%
add-sqr-sqrt16.1%
sqrt-unprod31.4%
sqr-neg31.4%
sqrt-unprod16.8%
add-sqr-sqrt29.3%
Applied egg-rr29.3%
expm1-def15.1%
expm1-log1p17.1%
associate-*r*19.1%
Simplified19.1%
if -1.49999999999999997e24 < y < 1.8e-51Initial program 98.3%
Taylor expanded in b around inf 84.0%
mul-1-neg84.0%
distribute-rgt-neg-out84.0%
Simplified84.0%
Taylor expanded in a around 0 37.7%
Final simplification27.5%
(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 98.1%
Taylor expanded in b around inf 56.9%
mul-1-neg56.9%
distribute-rgt-neg-out56.9%
Simplified56.9%
Taylor expanded in a around 0 19.6%
Final simplification19.6%
herbie shell --seed 2024031
(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))))))