
(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 10 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 97.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (log (- 1.0 z)))
(t_2 (* a (- t_1 b)))
(t_3 (* x (exp (+ (* y (- (log z) t)) t_2))))
(t_4 (* x t_2)))
(if (<= t_3 -10000000000.0) t_4 (if (<= t_3 5e-180) t_1 (exp t_4)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = log((1.0 - z));
double t_2 = a * (t_1 - b);
double t_3 = x * exp(((y * (log(z) - t)) + t_2));
double t_4 = x * t_2;
double tmp;
if (t_3 <= -10000000000.0) {
tmp = t_4;
} else if (t_3 <= 5e-180) {
tmp = t_1;
} else {
tmp = exp(t_4);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = log((1.0d0 - z))
t_2 = a * (t_1 - b)
t_3 = x * exp(((y * (log(z) - t)) + t_2))
t_4 = x * t_2
if (t_3 <= (-10000000000.0d0)) then
tmp = t_4
else if (t_3 <= 5d-180) then
tmp = t_1
else
tmp = exp(t_4)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.log((1.0 - z));
double t_2 = a * (t_1 - b);
double t_3 = x * Math.exp(((y * (Math.log(z) - t)) + t_2));
double t_4 = x * t_2;
double tmp;
if (t_3 <= -10000000000.0) {
tmp = t_4;
} else if (t_3 <= 5e-180) {
tmp = t_1;
} else {
tmp = Math.exp(t_4);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.log((1.0 - z)) t_2 = a * (t_1 - b) t_3 = x * math.exp(((y * (math.log(z) - t)) + t_2)) t_4 = x * t_2 tmp = 0 if t_3 <= -10000000000.0: tmp = t_4 elif t_3 <= 5e-180: tmp = t_1 else: tmp = math.exp(t_4) return tmp
function code(x, y, z, t, a, b) t_1 = log(Float64(1.0 - z)) t_2 = Float64(a * Float64(t_1 - b)) t_3 = Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + t_2))) t_4 = Float64(x * t_2) tmp = 0.0 if (t_3 <= -10000000000.0) tmp = t_4; elseif (t_3 <= 5e-180) tmp = t_1; else tmp = exp(t_4); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = log((1.0 - z)); t_2 = a * (t_1 - b); t_3 = x * exp(((y * (log(z) - t)) + t_2)); t_4 = x * t_2; tmp = 0.0; if (t_3 <= -10000000000.0) tmp = t_4; elseif (t_3 <= 5e-180) tmp = t_1; else tmp = exp(t_4); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(x * t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, -10000000000.0], t$95$4, If[LessEqual[t$95$3, 5e-180], t$95$1, N[Exp[t$95$4], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(1 - z\right)\\
t_2 := a \cdot \left(t\_1 - b\right)\\
t_3 := x \cdot e^{y \cdot \left(\log z - t\right) + t\_2}\\
t_4 := x \cdot t\_2\\
\mathbf{if}\;t\_3 \leq -10000000000:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{-180}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{t\_4}\\
\end{array}
\end{array}
if (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) < -1e10Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites24.0%
if -1e10 < (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) < 5.0000000000000001e-180Initial program 97.6%
Taylor expanded in y around 0
Applied rewrites80.8%
if 5.0000000000000001e-180 < (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) Initial program 94.8%
Taylor expanded in y around 0
Applied rewrites72.2%
Taylor expanded in y around 0
Applied rewrites42.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (log (- 1.0 z)))
(t_2 (* a (- t_1 b)))
(t_3 (- (log z) t))
(t_4 (* x (exp (+ (* y t_3) t_2)))))
(if (<= t_4 -10000000000.0) (* x t_2) (if (<= t_4 5e-153) t_1 (exp t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = log((1.0 - z));
double t_2 = a * (t_1 - b);
double t_3 = log(z) - t;
double t_4 = x * exp(((y * t_3) + t_2));
double tmp;
if (t_4 <= -10000000000.0) {
tmp = x * t_2;
} else if (t_4 <= 5e-153) {
tmp = t_1;
} else {
tmp = exp(t_3);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = log((1.0d0 - z))
t_2 = a * (t_1 - b)
t_3 = log(z) - t
t_4 = x * exp(((y * t_3) + t_2))
if (t_4 <= (-10000000000.0d0)) then
tmp = x * t_2
else if (t_4 <= 5d-153) then
tmp = t_1
else
tmp = exp(t_3)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.log((1.0 - z));
double t_2 = a * (t_1 - b);
double t_3 = Math.log(z) - t;
double t_4 = x * Math.exp(((y * t_3) + t_2));
double tmp;
if (t_4 <= -10000000000.0) {
tmp = x * t_2;
} else if (t_4 <= 5e-153) {
tmp = t_1;
} else {
tmp = Math.exp(t_3);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.log((1.0 - z)) t_2 = a * (t_1 - b) t_3 = math.log(z) - t t_4 = x * math.exp(((y * t_3) + t_2)) tmp = 0 if t_4 <= -10000000000.0: tmp = x * t_2 elif t_4 <= 5e-153: tmp = t_1 else: tmp = math.exp(t_3) return tmp
function code(x, y, z, t, a, b) t_1 = log(Float64(1.0 - z)) t_2 = Float64(a * Float64(t_1 - b)) t_3 = Float64(log(z) - t) t_4 = Float64(x * exp(Float64(Float64(y * t_3) + t_2))) tmp = 0.0 if (t_4 <= -10000000000.0) tmp = Float64(x * t_2); elseif (t_4 <= 5e-153) tmp = t_1; else tmp = exp(t_3); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = log((1.0 - z)); t_2 = a * (t_1 - b); t_3 = log(z) - t; t_4 = x * exp(((y * t_3) + t_2)); tmp = 0.0; if (t_4 <= -10000000000.0) tmp = x * t_2; elseif (t_4 <= 5e-153) tmp = t_1; else tmp = exp(t_3); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]}, Block[{t$95$4 = N[(x * N[Exp[N[(N[(y * t$95$3), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, -10000000000.0], N[(x * t$95$2), $MachinePrecision], If[LessEqual[t$95$4, 5e-153], t$95$1, N[Exp[t$95$3], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(1 - z\right)\\
t_2 := a \cdot \left(t\_1 - b\right)\\
t_3 := \log z - t\\
t_4 := x \cdot e^{y \cdot t\_3 + t\_2}\\
\mathbf{if}\;t\_4 \leq -10000000000:\\
\;\;\;\;x \cdot t\_2\\
\mathbf{elif}\;t\_4 \leq 5 \cdot 10^{-153}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{t\_3}\\
\end{array}
\end{array}
if (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) < -1e10Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites24.0%
if -1e10 < (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) < 5.00000000000000033e-153Initial program 97.6%
Taylor expanded in y around 0
Applied rewrites80.2%
if 5.00000000000000033e-153 < (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) Initial program 94.7%
Taylor expanded in y around 0
Applied rewrites73.1%
Taylor expanded in y around 0
Applied rewrites42.9%
Taylor expanded in y around 0
Applied rewrites27.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (- (log (- 1.0 z)) b)))
(t_2 (exp (+ (* y (- (log z) t)) t_1))))
(if (<= (* x t_2) -2e-304) (* x t_1) t_2)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (log((1.0 - z)) - b);
double t_2 = exp(((y * (log(z) - t)) + t_1));
double tmp;
if ((x * t_2) <= -2e-304) {
tmp = x * t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a * (log((1.0d0 - z)) - b)
t_2 = exp(((y * (log(z) - t)) + t_1))
if ((x * t_2) <= (-2d-304)) then
tmp = x * t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (Math.log((1.0 - z)) - b);
double t_2 = Math.exp(((y * (Math.log(z) - t)) + t_1));
double tmp;
if ((x * t_2) <= -2e-304) {
tmp = x * t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (math.log((1.0 - z)) - b) t_2 = math.exp(((y * (math.log(z) - t)) + t_1)) tmp = 0 if (x * t_2) <= -2e-304: tmp = x * t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(log(Float64(1.0 - z)) - b)) t_2 = exp(Float64(Float64(y * Float64(log(z) - t)) + t_1)) tmp = 0.0 if (Float64(x * t_2) <= -2e-304) tmp = Float64(x * t_1); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (log((1.0 - z)) - b); t_2 = exp(((y * (log(z) - t)) + t_1)); tmp = 0.0; if ((x * t_2) <= -2e-304) tmp = x * t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(x * t$95$2), $MachinePrecision], -2e-304], N[(x * t$95$1), $MachinePrecision], t$95$2]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(\log \left(1 - z\right) - b\right)\\
t_2 := e^{y \cdot \left(\log z - t\right) + t\_1}\\
\mathbf{if}\;x \cdot t\_2 \leq -2 \cdot 10^{-304}:\\
\;\;\;\;x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) < -1.99999999999999994e-304Initial program 98.7%
Taylor expanded in y around 0
Applied rewrites21.2%
if -1.99999999999999994e-304 < (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) Initial program 96.8%
Taylor expanded in y around 0
Applied rewrites84.8%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (log (- 1.0 z))) (t_2 (* a (- t_1 b)))) (if (<= (+ (* y (- (log z) t)) t_2) 20000000000000.0) t_1 (* x t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = log((1.0 - z));
double t_2 = a * (t_1 - b);
double tmp;
if (((y * (log(z) - t)) + t_2) <= 20000000000000.0) {
tmp = t_1;
} else {
tmp = x * t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log((1.0d0 - z))
t_2 = a * (t_1 - b)
if (((y * (log(z) - t)) + t_2) <= 20000000000000.0d0) then
tmp = t_1
else
tmp = x * t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.log((1.0 - z));
double t_2 = a * (t_1 - b);
double tmp;
if (((y * (Math.log(z) - t)) + t_2) <= 20000000000000.0) {
tmp = t_1;
} else {
tmp = x * t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.log((1.0 - z)) t_2 = a * (t_1 - b) tmp = 0 if ((y * (math.log(z) - t)) + t_2) <= 20000000000000.0: tmp = t_1 else: tmp = x * t_2 return tmp
function code(x, y, z, t, a, b) t_1 = log(Float64(1.0 - z)) t_2 = Float64(a * Float64(t_1 - b)) tmp = 0.0 if (Float64(Float64(y * Float64(log(z) - t)) + t_2) <= 20000000000000.0) tmp = t_1; else tmp = Float64(x * t_2); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = log((1.0 - z)); t_2 = a * (t_1 - b); tmp = 0.0; if (((y * (log(z) - t)) + t_2) <= 20000000000000.0) tmp = t_1; else tmp = x * t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], 20000000000000.0], t$95$1, N[(x * t$95$2), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(1 - z\right)\\
t_2 := a \cdot \left(t\_1 - b\right)\\
\mathbf{if}\;y \cdot \left(\log z - t\right) + t\_2 \leq 20000000000000:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot t\_2\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 2e13Initial program 96.8%
Taylor expanded in y around 0
Applied rewrites64.1%
if 2e13 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 98.1%
Taylor expanded in y around 0
Applied rewrites28.4%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (log (- 1.0 z))) (t_2 (* a (- t_1 b)))) (if (<= (+ (* y (- (log z) t)) t_2) 2.5e+133) t_1 t_2)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = log((1.0 - z));
double t_2 = a * (t_1 - b);
double tmp;
if (((y * (log(z) - t)) + t_2) <= 2.5e+133) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log((1.0d0 - z))
t_2 = a * (t_1 - b)
if (((y * (log(z) - t)) + t_2) <= 2.5d+133) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.log((1.0 - z));
double t_2 = a * (t_1 - b);
double tmp;
if (((y * (Math.log(z) - t)) + t_2) <= 2.5e+133) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.log((1.0 - z)) t_2 = a * (t_1 - b) tmp = 0 if ((y * (math.log(z) - t)) + t_2) <= 2.5e+133: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = log(Float64(1.0 - z)) t_2 = Float64(a * Float64(t_1 - b)) tmp = 0.0 if (Float64(Float64(y * Float64(log(z) - t)) + t_2) <= 2.5e+133) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = log((1.0 - z)); t_2 = a * (t_1 - b); tmp = 0.0; if (((y * (log(z) - t)) + t_2) <= 2.5e+133) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(a * N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision], 2.5e+133], t$95$1, t$95$2]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(1 - z\right)\\
t_2 := a \cdot \left(t\_1 - b\right)\\
\mathbf{if}\;y \cdot \left(\log z - t\right) + t\_2 \leq 2.5 \cdot 10^{+133}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 2.4999999999999998e133Initial program 96.7%
Taylor expanded in y around 0
Applied rewrites55.1%
if 2.4999999999999998e133 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 98.7%
Taylor expanded in y around 0
Applied rewrites55.7%
Taylor expanded in y around inf
Applied rewrites14.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (log (- 1.0 z))) (t_2 (* y (- (log z) t)))) (if (<= (+ t_2 (* a (- t_1 b))) 5e+178) t_1 t_2)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = log((1.0 - z));
double t_2 = y * (log(z) - t);
double tmp;
if ((t_2 + (a * (t_1 - b))) <= 5e+178) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = log((1.0d0 - z))
t_2 = y * (log(z) - t)
if ((t_2 + (a * (t_1 - b))) <= 5d+178) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = Math.log((1.0 - z));
double t_2 = y * (Math.log(z) - t);
double tmp;
if ((t_2 + (a * (t_1 - b))) <= 5e+178) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = math.log((1.0 - z)) t_2 = y * (math.log(z) - t) tmp = 0 if (t_2 + (a * (t_1 - b))) <= 5e+178: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = log(Float64(1.0 - z)) t_2 = Float64(y * Float64(log(z) - t)) tmp = 0.0 if (Float64(t_2 + Float64(a * Float64(t_1 - b))) <= 5e+178) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = log((1.0 - z)); t_2 = y * (log(z) - t); tmp = 0.0; if ((t_2 + (a * (t_1 - b))) <= 5e+178) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 + N[(a * N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 5e+178], t$95$1, t$95$2]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log \left(1 - z\right)\\
t_2 := y \cdot \left(\log z - t\right)\\
\mathbf{if}\;t\_2 + a \cdot \left(t\_1 - b\right) \leq 5 \cdot 10^{+178}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) < 4.9999999999999999e178Initial program 96.9%
Taylor expanded in y around 0
Applied rewrites52.0%
if 4.9999999999999999e178 < (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))) Initial program 98.5%
Taylor expanded in y around 0
Applied rewrites14.9%
(FPCore (x y z t a b) :precision binary64 (log (- 1.0 z)))
double code(double x, double y, double z, double t, double a, double b) {
return log((1.0 - z));
}
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 = log((1.0d0 - z))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.log((1.0 - z));
}
def code(x, y, z, t, a, b): return math.log((1.0 - z))
function code(x, y, z, t, a, b) return log(Float64(1.0 - z)) end
function tmp = code(x, y, z, t, a, b) tmp = log((1.0 - z)); end
code[x_, y_, z_, t_, a_, b_] := N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\log \left(1 - z\right)
\end{array}
Initial program 97.4%
Taylor expanded in y around 0
Applied rewrites38.6%
(FPCore (x y z t a b) :precision binary64 (- (log z) t))
double code(double x, double y, double z, double t, double a, double b) {
return log(z) - 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 = log(z) - t
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return Math.log(z) - t;
}
def code(x, y, z, t, a, b): return math.log(z) - t
function code(x, y, z, t, a, b) return Float64(log(z) - t) end
function tmp = code(x, y, z, t, a, b) tmp = log(z) - t; end
code[x_, y_, z_, t_, a_, b_] := N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log z - t
\end{array}
Initial program 97.4%
Taylor expanded in y around 0
Applied rewrites60.1%
Taylor expanded in y around 0
Applied rewrites2.9%
(FPCore (x y z t a b) :precision binary64 (- 1.0 z))
double code(double x, double y, double z, double t, double a, double b) {
return 1.0 - z;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = 1.0d0 - z
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return 1.0 - z;
}
def code(x, y, z, t, a, b): return 1.0 - z
function code(x, y, z, t, a, b) return Float64(1.0 - z) end
function tmp = code(x, y, z, t, a, b) tmp = 1.0 - z; end
code[x_, y_, z_, t_, a_, b_] := N[(1.0 - z), $MachinePrecision]
\begin{array}{l}
\\
1 - z
\end{array}
Initial program 97.4%
Taylor expanded in y around 0
Applied rewrites60.1%
Taylor expanded in y around 0
Applied rewrites2.7%
herbie shell --seed 2024321
(FPCore (x y z t a b)
:name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, B"
:precision binary64
:pre (TRUE)
(* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))