
(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 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
(FPCore (x y z t a b) :precision binary64 (* x (exp (+ (* y (- (log z) t)) (* a (- (log (- 1.0 z)) b))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b))));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * exp(((y * (log(z) - t)) + (a * (log((1.0d0 - z)) - b))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.exp(((y * (Math.log(z) - t)) + (a * (Math.log((1.0 - z)) - b))));
}
def code(x, y, z, t, a, b): return x * math.exp(((y * (math.log(z) - t)) + (a * (math.log((1.0 - z)) - b))))
function code(x, y, z, t, a, b) return Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + Float64(a * Float64(log(Float64(1.0 - z)) - b))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * exp(((y * (log(z) - t)) + (a * (log((1.0 - z)) - b)))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[Log[N[(1.0 - z), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot e^{y \cdot \left(\log z - t\right) + a \cdot \left(\log \left(1 - z\right) - b\right)}
\end{array}
Initial program 96.1%
(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)))))
(if (<= t_3 -2e+59) (* x t_2) (if (<= t_3 5e+168) t_1 (exp 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 t_3 = x * exp(((y * (log(z) - t)) + t_2));
double tmp;
if (t_3 <= -2e+59) {
tmp = x * t_2;
} else if (t_3 <= 5e+168) {
tmp = t_1;
} else {
tmp = exp(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) :: t_3
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))
if (t_3 <= (-2d+59)) then
tmp = x * t_2
else if (t_3 <= 5d+168) then
tmp = t_1
else
tmp = exp(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 t_3 = x * Math.exp(((y * (Math.log(z) - t)) + t_2));
double tmp;
if (t_3 <= -2e+59) {
tmp = x * t_2;
} else if (t_3 <= 5e+168) {
tmp = t_1;
} else {
tmp = Math.exp(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) t_3 = x * math.exp(((y * (math.log(z) - t)) + t_2)) tmp = 0 if t_3 <= -2e+59: tmp = x * t_2 elif t_3 <= 5e+168: tmp = t_1 else: tmp = math.exp(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)) t_3 = Float64(x * exp(Float64(Float64(y * Float64(log(z) - t)) + t_2))) tmp = 0.0 if (t_3 <= -2e+59) tmp = Float64(x * t_2); elseif (t_3 <= 5e+168) tmp = t_1; else tmp = exp(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); t_3 = x * exp(((y * (log(z) - t)) + t_2)); tmp = 0.0; if (t_3 <= -2e+59) tmp = x * t_2; elseif (t_3 <= 5e+168) tmp = t_1; else tmp = exp(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]}, 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]}, If[LessEqual[t$95$3, -2e+59], N[(x * t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 5e+168], t$95$1, N[Exp[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)\\
t_3 := x \cdot e^{y \cdot \left(\log z - t\right) + t\_2}\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{+59}:\\
\;\;\;\;x \cdot t\_2\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+168}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{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.99999999999999994e59Initial program 100.0%
Taylor expanded in y around 0
Applied rewrites21.6%
if -1.99999999999999994e59 < (*.f64 x (exp.f64 (+.f64 (*.f64 y (-.f64 (log.f64 z) t)) (*.f64 a (-.f64 (log.f64 (-.f64 #s(literal 1 binary64) z)) b))))) < 4.99999999999999967e168Initial program 96.8%
Taylor expanded in y around 0
Applied rewrites67.8%
if 4.99999999999999967e168 < (*.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 90.1%
Taylor expanded in y around 0
Applied rewrites90.1%
Taylor expanded in y around 0
Applied rewrites49.4%
Taylor expanded in y around 0
Applied rewrites31.3%
Taylor expanded in y around -inf
Applied rewrites49.4%
(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) -5e-274) (* 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) <= -5e-274) {
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) <= (-5d-274)) 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) <= -5e-274) {
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) <= -5e-274: 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) <= -5e-274) 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) <= -5e-274) 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], -5e-274], 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 -5 \cdot 10^{-274}:\\
\;\;\;\;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))))) < -5e-274Initial program 98.6%
Taylor expanded in y around 0
Applied rewrites17.8%
if -5e-274 < (*.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 95.2%
Taylor expanded in y around 0
Applied rewrites84.1%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (log (- 1.0 z))) (t_2 (* a (- t_1 b)))) (if (<= (* x (exp (+ (* y (- (log z) t)) t_2))) 1e+211) 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 ((x * exp(((y * (log(z) - t)) + t_2))) <= 1e+211) {
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 ((x * exp(((y * (log(z) - t)) + t_2))) <= 1d+211) 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 ((x * Math.exp(((y * (Math.log(z) - t)) + t_2))) <= 1e+211) {
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 (x * math.exp(((y * (math.log(z) - t)) + t_2))) <= 1e+211: 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(x * exp(Float64(Float64(y * Float64(log(z) - t)) + t_2))) <= 1e+211) 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 ((x * exp(((y * (log(z) - t)) + t_2))) <= 1e+211) 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[(x * N[Exp[N[(N[(y * N[(N[Log[z], $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e+211], 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}\;x \cdot e^{y \cdot \left(\log z - t\right) + t\_2} \leq 10^{+211}:\\
\;\;\;\;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))))) < 9.9999999999999996e210Initial program 97.2%
Taylor expanded in y around 0
Applied rewrites50.3%
if 9.9999999999999996e210 < (*.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 91.8%
Taylor expanded in y around 0
Applied rewrites91.8%
Taylor expanded in y around inf
Applied rewrites24.5%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (log (- 1.0 z))) (t_2 (* y (- (log z) t)))) (if (<= (* x (exp (+ t_2 (* a (- t_1 b))))) 5e+168) 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 ((x * exp((t_2 + (a * (t_1 - b))))) <= 5e+168) {
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 ((x * exp((t_2 + (a * (t_1 - b))))) <= 5d+168) 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 ((x * Math.exp((t_2 + (a * (t_1 - b))))) <= 5e+168) {
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 (x * math.exp((t_2 + (a * (t_1 - b))))) <= 5e+168: 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(x * exp(Float64(t_2 + Float64(a * Float64(t_1 - b))))) <= 5e+168) 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 ((x * exp((t_2 + (a * (t_1 - b))))) <= 5e+168) 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[(x * N[Exp[N[(t$95$2 + N[(a * N[(t$95$1 - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e+168], 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}\;x \cdot e^{t\_2 + a \cdot \left(t\_1 - b\right)} \leq 5 \cdot 10^{+168}:\\
\;\;\;\;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))))) < 4.99999999999999967e168Initial program 97.6%
Taylor expanded in y around 0
Applied rewrites50.5%
if 4.99999999999999967e168 < (*.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 90.1%
Taylor expanded in y around 0
Applied rewrites14.9%
(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) -1e-179) 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) <= -1e-179) {
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) <= (-1d-179)) 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) <= -1e-179) {
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) <= -1e-179: 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) <= -1e-179) 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) <= -1e-179) 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], -1e-179], 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 -1 \cdot 10^{-179}:\\
\;\;\;\;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))) < -1e-179Initial program 95.6%
Taylor expanded in y around 0
Applied rewrites77.2%
if -1e-179 < (+.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 rewrites20.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 96.1%
Taylor expanded in y around 0
Applied rewrites41.3%
(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 96.1%
Taylor expanded in y around 0
Applied rewrites61.3%
Taylor expanded in y around 0
Applied rewrites2.8%
herbie shell --seed 2024313
(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))))))