
(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 16 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) (* (log1p (- y)) (+ -1.0 z))) t))
double code(double x, double y, double z, double t) {
return fma((x + -1.0), log(y), (log1p(-y) * (-1.0 + z))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(x + -1.0), log(y), Float64(log1p(Float64(-y)) * Float64(-1.0 + z))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[Log[1 + (-y)], $MachinePrecision] * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{log1p}\left(-y\right) \cdot \left(-1 + z\right)\right) - t
\end{array}
Initial program 92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
log1p-define99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (+ x -1.0) (log y))
(*
(+ -1.0 z)
(* y (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5))))))
t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - 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)) + (((-1.0d0) + z) * (y * ((-1.0d0) + (y * ((y * ((y * (-0.25d0)) - 0.3333333333333333d0)) - 0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * Float64(Float64(y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * N[(N[(y * N[(N[(y * -0.25), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(-1 + z\right) \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right)\right) - t
\end{array}
Initial program 92.2%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (+ x -1.0) (log y))))
(if (<= (+ x -1.0) -1.00000000000002)
(- t_1 t)
(if (<= (+ x -1.0) -1.0)
(- (- (* y (- 1.0 z)) (log y)) t)
(- (+ y t_1) t)))))
double code(double x, double y, double z, double t) {
double t_1 = (x + -1.0) * log(y);
double tmp;
if ((x + -1.0) <= -1.00000000000002) {
tmp = t_1 - t;
} else if ((x + -1.0) <= -1.0) {
tmp = ((y * (1.0 - z)) - log(y)) - t;
} else {
tmp = (y + t_1) - 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) :: t_1
real(8) :: tmp
t_1 = (x + (-1.0d0)) * log(y)
if ((x + (-1.0d0)) <= (-1.00000000000002d0)) then
tmp = t_1 - t
else if ((x + (-1.0d0)) <= (-1.0d0)) then
tmp = ((y * (1.0d0 - z)) - log(y)) - t
else
tmp = (y + t_1) - t
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 ((x + -1.0) <= -1.00000000000002) {
tmp = t_1 - t;
} else if ((x + -1.0) <= -1.0) {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
} else {
tmp = (y + t_1) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + -1.0) * math.log(y) tmp = 0 if (x + -1.0) <= -1.00000000000002: tmp = t_1 - t elif (x + -1.0) <= -1.0: tmp = ((y * (1.0 - z)) - math.log(y)) - t else: tmp = (y + t_1) - t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + -1.0) * log(y)) tmp = 0.0 if (Float64(x + -1.0) <= -1.00000000000002) tmp = Float64(t_1 - t); elseif (Float64(x + -1.0) <= -1.0) tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); else tmp = Float64(Float64(y + t_1) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + -1.0) * log(y); tmp = 0.0; if ((x + -1.0) <= -1.00000000000002) tmp = t_1 - t; elseif ((x + -1.0) <= -1.0) tmp = ((y * (1.0 - z)) - log(y)) - t; else tmp = (y + t_1) - t; 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[LessEqual[N[(x + -1.0), $MachinePrecision], -1.00000000000002], N[(t$95$1 - t), $MachinePrecision], If[LessEqual[N[(x + -1.0), $MachinePrecision], -1.0], N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y + t$95$1), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + -1\right) \cdot \log y\\
\mathbf{if}\;x + -1 \leq -1.00000000000002:\\
\;\;\;\;t\_1 - t\\
\mathbf{elif}\;x + -1 \leq -1:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y + t\_1\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.00000000000002Initial program 97.6%
fma-define97.6%
sub-neg97.6%
metadata-eval97.6%
sub-neg97.6%
metadata-eval97.6%
sub-neg97.6%
log1p-define99.6%
Simplified99.6%
Taylor expanded in y around 0 97.6%
if -1.00000000000002 < (-.f64 x #s(literal 1 binary64)) < -1Initial program 87.7%
fma-define87.7%
sub-neg87.7%
metadata-eval87.7%
sub-neg87.7%
metadata-eval87.7%
sub-neg87.7%
log1p-define100.0%
Simplified100.0%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
fma-define99.4%
mul-1-neg99.4%
fmm-undef99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in x around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
if -1 < (-.f64 x #s(literal 1 binary64)) Initial program 98.3%
fma-define98.3%
sub-neg98.3%
metadata-eval98.3%
sub-neg98.3%
metadata-eval98.3%
sub-neg98.3%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
fma-define99.0%
+-commutative99.0%
mul-1-neg99.0%
distribute-rgt-neg-in99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
distribute-neg-in99.0%
metadata-eval99.0%
unsub-neg99.0%
Simplified99.0%
Taylor expanded in z around 0 96.9%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* (+ -1.0 z) (* y (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5)))))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - 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)) + (((-1.0d0) + z) * (y * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5)))))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(-1 + z\right) \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right)\right) - t
\end{array}
Initial program 92.2%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* y (+ (* -0.5 (* y (+ -1.0 z))) (- 1.0 z)))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (y * ((-0.5 * (y * (-1.0 + z))) + (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 * (((-0.5d0) * (y * ((-1.0d0) + z))) + (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 * ((-0.5 * (y * (-1.0 + z))) + (1.0 - z)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (y * ((-0.5 * (y * (-1.0 + z))) + (1.0 - z)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(y * Float64(Float64(-0.5 * Float64(y * Float64(-1.0 + z))) + Float64(1.0 - z)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (y * ((-0.5 * (y * (-1.0 + z))) + (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[(N[(-0.5 * N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + y \cdot \left(-0.5 \cdot \left(y \cdot \left(-1 + z\right)\right) + \left(1 - z\right)\right)\right) - t
\end{array}
Initial program 92.2%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* (+ -1.0 z) (* y (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - 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)) + (((-1.0d0) + z) * (y * ((-1.0d0) + (y * (-0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(-1 + z\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 92.2%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (<= (+ -1.0 z) 5e+207) (- (+ y (* (+ x -1.0) (log y))) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + z) <= 5e+207) {
tmp = (y + ((x + -1.0) * log(y))) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + z) <= 5e+207) {
tmp = (y + ((x + -1.0) * Math.log(y))) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (-1.0 + z) <= 5e+207: tmp = (y + ((x + -1.0) * math.log(y))) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(-1.0 + z) <= 5e+207) tmp = Float64(Float64(y + Float64(Float64(x + -1.0) * log(y))) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(-1.0 + z), $MachinePrecision], 5e+207], N[(N[(y + N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + z \leq 5 \cdot 10^{+207}:\\
\;\;\;\;\left(y + \left(x + -1\right) \cdot \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 4.9999999999999999e207Initial program 95.3%
fma-define95.3%
sub-neg95.3%
metadata-eval95.3%
sub-neg95.3%
metadata-eval95.3%
sub-neg95.3%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
fma-define99.5%
+-commutative99.5%
mul-1-neg99.5%
distribute-rgt-neg-in99.5%
sub-neg99.5%
metadata-eval99.5%
+-commutative99.5%
distribute-neg-in99.5%
metadata-eval99.5%
unsub-neg99.5%
Simplified99.5%
Taylor expanded in z around 0 94.8%
if 4.9999999999999999e207 < (-.f64 z #s(literal 1 binary64)) Initial program 59.9%
add-cbrt-cube59.6%
pow359.7%
Applied egg-rr59.7%
Taylor expanded in z around inf 37.9%
sub-neg37.9%
log1p-undefine78.1%
Simplified78.1%
Final simplification93.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.1e-67) (not (<= x 3.4e-16))) (- (* x (log y)) t) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.1e-67) || !(x <= 3.4e-16)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y * (1.0 - z)) - 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 <= (-2.1d-67)) .or. (.not. (x <= 3.4d-16))) then
tmp = (x * log(y)) - t
else
tmp = (y * (1.0d0 - z)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.1e-67) || !(x <= 3.4e-16)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y * (1.0 - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.1e-67) or not (x <= 3.4e-16): tmp = (x * math.log(y)) - t else: tmp = (y * (1.0 - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.1e-67) || !(x <= 3.4e-16)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y * Float64(1.0 - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.1e-67) || ~((x <= 3.4e-16))) tmp = (x * log(y)) - t; else tmp = (y * (1.0 - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.1e-67], N[Not[LessEqual[x, 3.4e-16]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.1 \cdot 10^{-67} \lor \neg \left(x \leq 3.4 \cdot 10^{-16}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if x < -2.1000000000000002e-67 or 3.4e-16 < x Initial program 98.2%
fma-define98.2%
sub-neg98.2%
metadata-eval98.2%
sub-neg98.2%
metadata-eval98.2%
sub-neg98.2%
log1p-define99.7%
Simplified99.7%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
+-commutative99.3%
mul-1-neg99.3%
distribute-rgt-neg-in99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
distribute-neg-in99.3%
metadata-eval99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in x around inf 92.5%
*-commutative92.5%
Simplified92.5%
if -2.1000000000000002e-67 < x < 3.4e-16Initial program 86.8%
fma-define86.8%
sub-neg86.8%
metadata-eval86.8%
sub-neg86.8%
metadata-eval86.8%
sub-neg86.8%
log1p-define100.0%
Simplified100.0%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
mul-1-neg99.3%
fmm-undef99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around inf 58.5%
Final simplification74.8%
(FPCore (x y z t) :precision binary64 (if (<= (+ -1.0 z) 5e+207) (- (* (+ x -1.0) (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + z) <= 5e+207) {
tmp = ((x + -1.0) * log(y)) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + z) <= 5e+207) {
tmp = ((x + -1.0) * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (-1.0 + z) <= 5e+207: tmp = ((x + -1.0) * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(-1.0 + z) <= 5e+207) tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(-1.0 + z), $MachinePrecision], 5e+207], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + z \leq 5 \cdot 10^{+207}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 4.9999999999999999e207Initial program 95.3%
fma-define95.3%
sub-neg95.3%
metadata-eval95.3%
sub-neg95.3%
metadata-eval95.3%
sub-neg95.3%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 94.4%
if 4.9999999999999999e207 < (-.f64 z #s(literal 1 binary64)) Initial program 59.9%
add-cbrt-cube59.6%
pow359.7%
Applied egg-rr59.7%
Taylor expanded in z around inf 37.9%
sub-neg37.9%
log1p-undefine78.1%
Simplified78.1%
Final simplification93.0%
(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 92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
mul-1-neg99.3%
fmm-undef99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (- (* y (- (* -0.5 (* y z)) z)) t))
double code(double x, double y, double z, double t) {
return (y * ((-0.5 * (y * z)) - 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 * (((-0.5d0) * (y * z)) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * ((-0.5 * (y * z)) - z)) - t;
}
def code(x, y, z, t): return (y * ((-0.5 * (y * z)) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(-0.5 * Float64(y * z)) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * ((-0.5 * (y * z)) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(-0.5 * N[(y * z), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(-0.5 \cdot \left(y \cdot z\right) - z\right) - t
\end{array}
Initial program 92.2%
add-cbrt-cube91.9%
pow391.9%
Applied egg-rr91.9%
Taylor expanded in z around inf 37.4%
sub-neg37.4%
log1p-undefine45.1%
Simplified45.1%
Taylor expanded in y around 0 45.0%
Final simplification45.0%
(FPCore (x y z t) :precision binary64 (- (* y (* z (+ -1.0 (* y -0.5)))) t))
double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * -0.5)))) - 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 * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * -0.5)))) - t;
}
def code(x, y, z, t): return (y * (z * (-1.0 + (y * -0.5)))) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t) end
function tmp = code(x, y, z, t) tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t
\end{array}
Initial program 92.2%
add-cbrt-cube91.9%
pow391.9%
Applied egg-rr91.9%
Taylor expanded in z around inf 37.4%
sub-neg37.4%
log1p-undefine45.1%
Simplified45.1%
Taylor expanded in y around 0 45.0%
associate-*r*45.0%
distribute-rgt-out45.0%
*-commutative45.0%
Simplified45.0%
(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 92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
mul-1-neg99.3%
fmm-undef99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around inf 45.0%
(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 92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
mul-1-neg99.3%
fmm-undef99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in z around inf 44.8%
associate-*r*44.8%
neg-mul-144.8%
Simplified44.8%
Final simplification44.8%
(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 92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
log1p-define99.9%
Simplified99.9%
Taylor expanded in t around inf 36.8%
neg-mul-136.8%
Simplified36.8%
(FPCore (x y z t) :precision binary64 0.0)
double code(double x, double y, double z, double t) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t) {
return 0.0;
}
def code(x, y, z, t): return 0.0
function code(x, y, z, t) return 0.0 end
function tmp = code(x, y, z, t) tmp = 0.0; end
code[x_, y_, z_, t_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
metadata-eval92.2%
sub-neg92.2%
log1p-define99.9%
Simplified99.9%
Taylor expanded in t around inf 36.8%
neg-mul-136.8%
Simplified36.8%
expm1-log1p-u17.2%
expm1-undefine17.1%
Applied egg-rr17.1%
sub-neg17.1%
log1p-undefine17.1%
rem-exp-log36.7%
unsub-neg36.7%
metadata-eval36.7%
Simplified36.7%
Taylor expanded in t around 0 2.4%
metadata-eval2.4%
Applied egg-rr2.4%
herbie shell --seed 2024181
(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))