
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (+ x -1.0) (log y) (fma (+ -1.0 z) (log1p (- y)) (- t))))
double code(double x, double y, double z, double t) {
return fma((x + -1.0), log(y), fma((-1.0 + z), log1p(-y), -t));
}
function code(x, y, z, t) return fma(Float64(x + -1.0), log(y), fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), -t\right)\right)
\end{array}
Initial program 89.0%
associate--l+89.0%
fma-def89.0%
sub-neg89.0%
metadata-eval89.0%
fma-neg89.0%
sub-neg89.0%
metadata-eval89.0%
sub-neg89.0%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 z) (log1p (- y)) (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + z), log1p(-y), ((x + -1.0) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(Float64(x + -1.0) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Initial program 89.0%
+-commutative89.0%
fma-def89.0%
sub-neg89.0%
metadata-eval89.0%
sub-neg89.0%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (- (* y (* y -0.5)) y) (+ -1.0 z)) (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return ((((y * (y * -0.5)) - y) * (-1.0 + z)) + ((x + -1.0) * log(y))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((y * (y * (-0.5d0))) - y) * ((-1.0d0) + z)) + ((x + (-1.0d0)) * log(y))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((((y * (y * -0.5)) - y) * (-1.0 + z)) + ((x + -1.0) * Math.log(y))) - t;
}
def code(x, y, z, t): return ((((y * (y * -0.5)) - y) * (-1.0 + z)) + ((x + -1.0) * math.log(y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(y * Float64(y * -0.5)) - y) * Float64(-1.0 + z)) + Float64(Float64(x + -1.0) * log(y))) - t) end
function tmp = code(x, y, z, t) tmp = ((((y * (y * -0.5)) - y) * (-1.0 + z)) + ((x + -1.0) * log(y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision] * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision] + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y \cdot \left(y \cdot -0.5\right) - y\right) \cdot \left(-1 + z\right) + \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Initial program 89.0%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
unpow299.7%
associate-*l*99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (<= (+ x -1.0) -1.0)))
(if (or t_1 (not t_1))
(- (* (+ x -1.0) (log y)) t)
(- (- (* y (- (- z) -1.0)) (log y)) t))))
double code(double x, double y, double z, double t) {
int t_1 = (x + -1.0) <= -1.0;
double tmp;
if (t_1 || !t_1) {
tmp = ((x + -1.0) * log(y)) - t;
} else {
tmp = ((y * (-z - -1.0)) - log(y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
logical :: t_1
real(8) :: tmp
t_1 = (x + (-1.0d0)) <= (-1.0d0)
if (t_1 .or. (.not. t_1)) then
tmp = ((x + (-1.0d0)) * log(y)) - t
else
tmp = ((y * (-z - (-1.0d0))) - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
boolean t_1 = (x + -1.0) <= -1.0;
double tmp;
if (t_1 || !t_1) {
tmp = ((x + -1.0) * Math.log(y)) - t;
} else {
tmp = ((y * (-z - -1.0)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + -1.0) <= -1.0 tmp = 0 if t_1 or not t_1: tmp = ((x + -1.0) * math.log(y)) - t else: tmp = ((y * (-z - -1.0)) - math.log(y)) - t return tmp
function code(x, y, z, t) t_1 = Float64(x + -1.0) <= -1.0 tmp = 0.0 if (t_1 || !t_1) tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); else tmp = Float64(Float64(Float64(y * Float64(Float64(-z) - -1.0)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + -1.0) <= -1.0; tmp = 0.0; if (t_1 || ~(t_1)) tmp = ((x + -1.0) * log(y)) - t; else tmp = ((y * (-z - -1.0)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = LessEqual[N[(x + -1.0), $MachinePrecision], -1.0]}, If[Or[t$95$1, N[Not[t$95$1], $MachinePrecision]], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y * N[((-z) - -1.0), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + -1 \leq -1\\
\mathbf{if}\;t_1 \lor \neg t_1:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(\left(-z\right) - -1\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -1 or -1 < (-.f64 x 1) Initial program 89.0%
+-commutative89.0%
fma-def89.0%
sub-neg89.0%
metadata-eval89.0%
sub-neg89.0%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 88.3%
if -1 < (-.f64 x 1) < -1Initial program 89.0%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around 0 65.7%
mul-1-neg65.7%
Simplified65.7%
Final simplification88.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (+ x -1.0) (log y))))
(if (or (<= t -2.6e-7) (not (<= t 1.55e-38)))
(- t_1 t)
(- t_1 (* y (+ -1.0 z))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + -1.0) * log(y);
double tmp;
if ((t <= -2.6e-7) || !(t <= 1.55e-38)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (y * (-1.0 + z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x + (-1.0d0)) * log(y)
if ((t <= (-2.6d-7)) .or. (.not. (t <= 1.55d-38))) then
tmp = t_1 - t
else
tmp = t_1 - (y * ((-1.0d0) + z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + -1.0) * Math.log(y);
double tmp;
if ((t <= -2.6e-7) || !(t <= 1.55e-38)) {
tmp = t_1 - t;
} else {
tmp = t_1 - (y * (-1.0 + z));
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + -1.0) * math.log(y) tmp = 0 if (t <= -2.6e-7) or not (t <= 1.55e-38): tmp = t_1 - t else: tmp = t_1 - (y * (-1.0 + z)) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + -1.0) * log(y)) tmp = 0.0 if ((t <= -2.6e-7) || !(t <= 1.55e-38)) tmp = Float64(t_1 - t); else tmp = Float64(t_1 - Float64(y * Float64(-1.0 + z))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + -1.0) * log(y); tmp = 0.0; if ((t <= -2.6e-7) || ~((t <= 1.55e-38))) tmp = t_1 - t; else tmp = t_1 - (y * (-1.0 + z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t, -2.6e-7], N[Not[LessEqual[t, 1.55e-38]], $MachinePrecision]], N[(t$95$1 - t), $MachinePrecision], N[(t$95$1 - N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + -1\right) \cdot \log y\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{-7} \lor \neg \left(t \leq 1.55 \cdot 10^{-38}\right):\\
\;\;\;\;t_1 - t\\
\mathbf{else}:\\
\;\;\;\;t_1 - y \cdot \left(-1 + z\right)\\
\end{array}
\end{array}
if t < -2.59999999999999999e-7 or 1.54999999999999991e-38 < t Initial program 95.7%
+-commutative95.7%
fma-def95.7%
sub-neg95.7%
metadata-eval95.7%
sub-neg95.7%
log1p-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 95.3%
if -2.59999999999999999e-7 < t < 1.54999999999999991e-38Initial program 81.6%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
*-commutative99.0%
mul-1-neg99.0%
unsub-neg99.0%
*-commutative99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in t around 0 99.0%
Final simplification97.1%
(FPCore (x y z t) :precision binary64 (- (- (* (+ x -1.0) (log y)) (* y (+ -1.0 z))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) - (y * (-1.0 + z))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x + (-1.0d0)) * log(y)) - (y * ((-1.0d0) + z))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) - (y * (-1.0 + z))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) - (y * (-1.0 + z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) - Float64(y * Float64(-1.0 + z))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) - (y * (-1.0 + z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y - y \cdot \left(-1 + z\right)\right) - t
\end{array}
Initial program 89.0%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (- (* x (log y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = -log(y) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = -log(y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 94.4%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
*-commutative99.6%
unpow299.6%
associate-*l*99.6%
Simplified99.6%
Taylor expanded in x around inf 94.0%
*-commutative94.0%
Simplified94.0%
if -1 < x < 1Initial program 84.5%
add-log-exp84.0%
+-commutative84.0%
exp-sum84.0%
sub-neg84.0%
metadata-eval84.0%
*-commutative84.0%
exp-to-pow84.0%
sub-neg84.0%
add-sqr-sqrt0.0%
sqrt-unprod83.5%
sqr-neg83.5%
sqrt-unprod83.5%
add-sqr-sqrt83.5%
*-commutative83.5%
exp-to-pow83.5%
sub-neg83.5%
metadata-eval83.5%
Applied egg-rr83.5%
Taylor expanded in y around 0 83.6%
Taylor expanded in x around 0 82.1%
log-pow82.1%
mul-1-neg82.1%
Simplified82.1%
Final simplification87.5%
(FPCore (x y z t) :precision binary64 (- (+ y (* (+ x -1.0) (log y))) t))
double code(double x, double y, double z, double t) {
return (y + ((x + -1.0) * log(y))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y + ((x + (-1.0d0)) * log(y))) - t
end function
public static double code(double x, double y, double z, double t) {
return (y + ((x + -1.0) * Math.log(y))) - t;
}
def code(x, y, z, t): return (y + ((x + -1.0) * math.log(y))) - t
function code(x, y, z, t) return Float64(Float64(y + Float64(Float64(x + -1.0) * log(y))) - t) end
function tmp = code(x, y, z, t) tmp = (y + ((x + -1.0) * log(y))) - t; end
code[x_, y_, z_, t_] := N[(N[(y + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y + \left(x + -1\right) \cdot \log y\right) - t
\end{array}
Initial program 89.0%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
unpow299.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
mul-1-neg99.4%
sub-neg99.4%
fma-neg99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
distribute-rgt-neg-in99.4%
neg-sub099.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
associate--r+99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 88.4%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (if (<= z -1.2e+223) (- (* z (- (* -0.5 (* y y)) y)) t) (if (<= z 1.28e+126) (- (- (log y)) t) (- (- t) (* y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+223) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else if (z <= 1.28e+126) {
tmp = -log(y) - t;
} else {
tmp = -t - (y * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.2d+223)) then
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
else if (z <= 1.28d+126) then
tmp = -log(y) - t
else
tmp = -t - (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.2e+223) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else if (z <= 1.28e+126) {
tmp = -Math.log(y) - t;
} else {
tmp = -t - (y * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.2e+223: tmp = (z * ((-0.5 * (y * y)) - y)) - t elif z <= 1.28e+126: tmp = -math.log(y) - t else: tmp = -t - (y * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.2e+223) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); elseif (z <= 1.28e+126) tmp = Float64(Float64(-log(y)) - t); else tmp = Float64(Float64(-t) - Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.2e+223) tmp = (z * ((-0.5 * (y * y)) - y)) - t; elseif (z <= 1.28e+126) tmp = -log(y) - t; else tmp = -t - (y * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.2e+223], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 1.28e+126], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+223}:\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{elif}\;z \leq 1.28 \cdot 10^{+126}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - y \cdot z\\
\end{array}
\end{array}
if z < -1.20000000000000006e223Initial program 60.2%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
*-commutative99.5%
unpow299.5%
associate-*l*99.5%
Simplified99.5%
Taylor expanded in z around inf 66.5%
unpow266.5%
Simplified66.5%
if -1.20000000000000006e223 < z < 1.27999999999999993e126Initial program 97.3%
add-log-exp55.5%
+-commutative55.5%
exp-sum55.5%
sub-neg55.5%
metadata-eval55.5%
*-commutative55.5%
exp-to-pow55.5%
sub-neg55.5%
add-sqr-sqrt0.0%
sqrt-unprod55.1%
sqr-neg55.1%
sqrt-unprod55.1%
add-sqr-sqrt55.1%
*-commutative55.1%
exp-to-pow55.1%
sub-neg55.1%
metadata-eval55.1%
Applied egg-rr55.1%
Taylor expanded in y around 0 55.2%
Taylor expanded in x around 0 64.1%
log-pow64.1%
mul-1-neg64.1%
Simplified64.1%
if 1.27999999999999993e126 < z Initial program 74.1%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
*-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in z around inf 52.5%
associate-*r*52.5%
neg-mul-152.5%
Simplified52.5%
Final simplification62.5%
(FPCore (x y z t) :precision binary64 (- (* (+ x -1.0) (log y)) t))
double code(double x, double y, double z, double t) {
return ((x + -1.0) * log(y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((x + (-1.0d0)) * log(y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((x + -1.0) * Math.log(y)) - t;
}
def code(x, y, z, t): return ((x + -1.0) * math.log(y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(x + -1.0) * log(y)) - t) end
function tmp = code(x, y, z, t) tmp = ((x + -1.0) * log(y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(x + -1\right) \cdot \log y - t
\end{array}
Initial program 89.0%
+-commutative89.0%
fma-def89.0%
sub-neg89.0%
metadata-eval89.0%
sub-neg89.0%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 88.3%
Final simplification88.3%
(FPCore (x y z t) :precision binary64 (- (* (+ -1.0 z) (- (* -0.5 (* y y)) y)) t))
double code(double x, double y, double z, double t) {
return ((-1.0 + z) * ((-0.5 * (y * y)) - y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((-1.0d0) + z) * (((-0.5d0) * (y * y)) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((-1.0 + z) * ((-0.5 * (y * y)) - y)) - t;
}
def code(x, y, z, t): return ((-1.0 + z) * ((-0.5 * (y * y)) - y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(-1.0 + z) * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t) end
function tmp = code(x, y, z, t) tmp = ((-1.0 + z) * ((-0.5 * (y * y)) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + z), $MachinePrecision] * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(-1 + z\right) \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t
\end{array}
Initial program 89.0%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
unpow299.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in y around inf 46.4%
+-commutative46.4%
associate-*r*46.4%
mul-1-neg46.4%
distribute-lft-neg-in46.4%
distribute-rgt-in46.4%
sub-neg46.4%
metadata-eval46.4%
+-commutative46.4%
sub-neg46.4%
unpow246.4%
Simplified46.4%
Final simplification46.4%
(FPCore (x y z t) :precision binary64 (- (* z (- (* -0.5 (* y y)) y)) t))
double code(double x, double y, double z, double t) {
return (z * ((-0.5 * (y * y)) - y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (z * (((-0.5d0) * (y * y)) - y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * ((-0.5 * (y * y)) - y)) - t;
}
def code(x, y, z, t): return (z * ((-0.5 * (y * y)) - y)) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * ((-0.5 * (y * y)) - y)) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t
\end{array}
Initial program 89.0%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
mul-1-neg99.7%
unsub-neg99.7%
*-commutative99.7%
unpow299.7%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in z around inf 46.2%
unpow246.2%
Simplified46.2%
Final simplification46.2%
(FPCore (x y z t) :precision binary64 (- (* y (- 1.0 z)) t))
double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * (1.0d0 - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (1.0 - z)) - t;
}
def code(x, y, z, t): return (y * (1.0 - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(1.0 - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * (1.0 - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(1 - z\right) - t
\end{array}
Initial program 89.0%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around inf 46.1%
Final simplification46.1%
(FPCore (x y z t) :precision binary64 (- (- t) (* y z)))
double code(double x, double y, double z, double t) {
return -t - (y * z);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t - (y * z)
end function
public static double code(double x, double y, double z, double t) {
return -t - (y * z);
}
def code(x, y, z, t): return -t - (y * z)
function code(x, y, z, t) return Float64(Float64(-t) - Float64(y * z)) end
function tmp = code(x, y, z, t) tmp = -t - (y * z); end
code[x_, y_, z_, t_] := N[((-t) - N[(y * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) - y \cdot z
\end{array}
Initial program 89.0%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
*-commutative99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in z around inf 46.0%
associate-*r*46.0%
neg-mul-146.0%
Simplified46.0%
Final simplification46.0%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 89.0%
+-commutative89.0%
fma-def89.0%
sub-neg89.0%
metadata-eval89.0%
sub-neg89.0%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 35.6%
mul-1-neg35.6%
Simplified35.6%
Final simplification35.6%
herbie shell --seed 2023275
(FPCore (x y z t)
:name "Statistics.Distribution.Beta:$cdensity from math-functions-0.1.5.2"
:precision binary64
(- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))