
(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 90.0%
associate--l+90.0%
fma-def90.1%
sub-neg90.1%
metadata-eval90.1%
fma-neg90.1%
sub-neg90.1%
metadata-eval90.1%
sub-neg90.1%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 z) (log1p (- y)) (* (log y) (+ x -1.0))) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + z), log1p(-y), (log(y) * (x + -1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + z), log1p(Float64(-y)), Float64(log(y) * Float64(x + -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + z), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + z, \mathsf{log1p}\left(-y\right), \log y \cdot \left(x + -1\right)\right) - t
\end{array}
Initial program 90.0%
+-commutative90.0%
fma-def90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (log y) (+ x -1.0))
(-
(* (+ -1.0 z) (+ (* -0.3333333333333333 (pow y 3.0)) (* y (* y -0.5))))
(* y (+ -1.0 z))))
t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (((-1.0 + z) * ((-0.3333333333333333 * pow(y, 3.0)) + (y * (y * -0.5)))) - (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 = ((log(y) * (x + (-1.0d0))) + ((((-1.0d0) + z) * (((-0.3333333333333333d0) * (y ** 3.0d0)) + (y * (y * (-0.5d0))))) - (y * ((-1.0d0) + z)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + (((-1.0 + z) * ((-0.3333333333333333 * Math.pow(y, 3.0)) + (y * (y * -0.5)))) - (y * (-1.0 + z)))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (((-1.0 + z) * ((-0.3333333333333333 * math.pow(y, 3.0)) + (y * (y * -0.5)))) - (y * (-1.0 + z)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(Float64(-1.0 + z) * Float64(Float64(-0.3333333333333333 * (y ^ 3.0)) + Float64(y * Float64(y * -0.5)))) - Float64(y * Float64(-1.0 + z)))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + (((-1.0 + z) * ((-0.3333333333333333 * (y ^ 3.0)) + (y * (y * -0.5)))) - (y * (-1.0 + z)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-1.0 + z), $MachinePrecision] * N[(N[(-0.3333333333333333 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision] + N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \left(\left(-1 + z\right) \cdot \left(-0.3333333333333333 \cdot {y}^{3} + y \cdot \left(y \cdot -0.5\right)\right) - y \cdot \left(-1 + z\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
Simplified99.6%
fma-udef99.6%
*-commutative99.6%
*-commutative99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* (+ -1.0 z) (- (* y (* y -0.5)) y))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + ((-1.0 + z) * ((y * (y * -0.5)) - 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 = ((log(y) * (x + (-1.0d0))) + (((-1.0d0) + z) * ((y * (y * (-0.5d0))) - y))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) + ((-1.0 + z) * ((y * (y * -0.5)) - y))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + ((-1.0 + z) * ((y * (y * -0.5)) - y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(-1.0 + z) * Float64(Float64(y * Float64(y * -0.5)) - y))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + ((-1.0 + z) * ((y * (y * -0.5)) - y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 + z), $MachinePrecision] * N[(N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + \left(-1 + z\right) \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
unpow299.5%
associate-*r*99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(if (<= (+ x -1.0) -4e+32)
(- (* x (log y)) t)
(if (<= (+ x -1.0) -1.0)
(- (- (* y (- 1.0 z)) (log y)) t)
(- (* (log y) (+ x -1.0)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x + -1.0) <= -4e+32) {
tmp = (x * log(y)) - t;
} else if ((x + -1.0) <= -1.0) {
tmp = ((y * (1.0 - z)) - log(y)) - t;
} else {
tmp = (log(y) * (x + -1.0)) - 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)) <= (-4d+32)) then
tmp = (x * log(y)) - t
else if ((x + (-1.0d0)) <= (-1.0d0)) then
tmp = ((y * (1.0d0 - z)) - log(y)) - t
else
tmp = (log(y) * (x + (-1.0d0))) - 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) <= -4e+32) {
tmp = (x * Math.log(y)) - t;
} else if ((x + -1.0) <= -1.0) {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
} else {
tmp = (Math.log(y) * (x + -1.0)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x + -1.0) <= -4e+32: tmp = (x * math.log(y)) - t elif (x + -1.0) <= -1.0: tmp = ((y * (1.0 - z)) - math.log(y)) - t else: tmp = (math.log(y) * (x + -1.0)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x + -1.0) <= -4e+32) tmp = Float64(Float64(x * log(y)) - t); elseif (Float64(x + -1.0) <= -1.0) tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); else tmp = Float64(Float64(log(y) * Float64(x + -1.0)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x + -1.0) <= -4e+32) tmp = (x * log(y)) - t; elseif ((x + -1.0) <= -1.0) tmp = ((y * (1.0 - z)) - log(y)) - t; else tmp = (log(y) * (x + -1.0)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x + -1.0), $MachinePrecision], -4e+32], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - 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[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -4 \cdot 10^{+32}:\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{elif}\;x + -1 \leq -1:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -4.00000000000000021e32Initial program 92.0%
Taylor expanded in y around 0 99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in x around inf 92.0%
*-commutative92.0%
Simplified92.0%
if -4.00000000000000021e32 < (-.f64 x 1) < -1Initial program 84.4%
Taylor expanded in y around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
Taylor expanded in x around 0 98.7%
+-commutative98.7%
mul-1-neg98.7%
unsub-neg98.7%
mul-1-neg98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
distribute-rgt-neg-in98.7%
distribute-neg-in98.7%
metadata-eval98.7%
unsub-neg98.7%
Simplified98.7%
if -1 < (-.f64 x 1) Initial program 99.1%
+-commutative99.1%
fma-def99.1%
sub-neg99.1%
metadata-eval99.1%
sub-neg99.1%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 97.7%
Final simplification96.7%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ x -1.0)) (* y z)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) - (y * 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 = ((log(y) * (x + (-1.0d0))) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) - (y * z)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) - y \cdot z\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Taylor expanded in z around inf 99.2%
associate-*r*99.2%
mul-1-neg99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.2e+54) (not (<= t 2.5e+18))) (- (* z (- (* -0.5 (* y y)) y)) t) (* (log y) (+ x -1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.2e+54) || !(t <= 2.5e+18)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = log(y) * (x + -1.0);
}
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 ((t <= (-1.2d+54)) .or. (.not. (t <= 2.5d+18))) then
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
else
tmp = log(y) * (x + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.2e+54) || !(t <= 2.5e+18)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = Math.log(y) * (x + -1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.2e+54) or not (t <= 2.5e+18): tmp = (z * ((-0.5 * (y * y)) - y)) - t else: tmp = math.log(y) * (x + -1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.2e+54) || !(t <= 2.5e+18)) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); else tmp = Float64(log(y) * Float64(x + -1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.2e+54) || ~((t <= 2.5e+18))) tmp = (z * ((-0.5 * (y * y)) - y)) - t; else tmp = log(y) * (x + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.2e+54], N[Not[LessEqual[t, 2.5e+18]], $MachinePrecision]], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+54} \lor \neg \left(t \leq 2.5 \cdot 10^{+18}\right):\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if t < -1.19999999999999999e54 or 2.5e18 < t Initial program 90.4%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
mul-1-neg99.3%
unsub-neg99.3%
unpow299.3%
associate-*r*99.3%
Simplified99.3%
Taylor expanded in x around 0 77.4%
mul-1-neg77.4%
Simplified77.4%
Taylor expanded in z around inf 77.4%
unpow277.4%
Simplified77.4%
if -1.19999999999999999e54 < t < 2.5e18Initial program 89.7%
+-commutative89.7%
fma-def89.7%
sub-neg89.7%
metadata-eval89.7%
sub-neg89.7%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 89.2%
Taylor expanded in t around 0 84.8%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -490.0) (not (<= t 400.0))) (- (* x (log y)) t) (* (log y) (+ x -1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -490.0) || !(t <= 400.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = log(y) * (x + -1.0);
}
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 ((t <= (-490.0d0)) .or. (.not. (t <= 400.0d0))) then
tmp = (x * log(y)) - t
else
tmp = log(y) * (x + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -490.0) || !(t <= 400.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = Math.log(y) * (x + -1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -490.0) or not (t <= 400.0): tmp = (x * math.log(y)) - t else: tmp = math.log(y) * (x + -1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -490.0) || !(t <= 400.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(log(y) * Float64(x + -1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -490.0) || ~((t <= 400.0))) tmp = (x * log(y)) - t; else tmp = log(y) * (x + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -490.0], N[Not[LessEqual[t, 400.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -490 \lor \neg \left(t \leq 400\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x + -1\right)\\
\end{array}
\end{array}
if t < -490 or 400 < t Initial program 91.4%
Taylor expanded in y around 0 99.1%
mul-1-neg99.1%
Simplified99.1%
Taylor expanded in x around inf 90.3%
*-commutative90.3%
Simplified90.3%
if -490 < t < 400Initial program 88.5%
+-commutative88.5%
fma-def88.5%
sub-neg88.5%
metadata-eval88.5%
sub-neg88.5%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 87.9%
Taylor expanded in t around 0 86.9%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= z 2.55e+211) (- (* (log y) (+ x -1.0)) t) (- (* z (- (* -0.5 (* y y)) y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.55e+211) {
tmp = (log(y) * (x + -1.0)) - t;
} else {
tmp = (z * ((-0.5 * (y * y)) - 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 (z <= 2.55d+211) then
tmp = (log(y) * (x + (-1.0d0))) - t
else
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 2.55e+211) {
tmp = (Math.log(y) * (x + -1.0)) - t;
} else {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 2.55e+211: tmp = (math.log(y) * (x + -1.0)) - t else: tmp = (z * ((-0.5 * (y * y)) - y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 2.55e+211) tmp = Float64(Float64(log(y) * Float64(x + -1.0)) - t); else tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 2.55e+211) tmp = (log(y) * (x + -1.0)) - t; else tmp = (z * ((-0.5 * (y * y)) - y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 2.55e+211], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.55 \cdot 10^{+211}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\end{array}
\end{array}
if z < 2.54999999999999981e211Initial program 95.4%
+-commutative95.4%
fma-def95.4%
sub-neg95.4%
metadata-eval95.4%
sub-neg95.4%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 94.9%
if 2.54999999999999981e211 < z Initial program 40.8%
Taylor expanded in y around 0 96.9%
+-commutative96.9%
mul-1-neg96.9%
unsub-neg96.9%
unpow296.9%
associate-*r*96.9%
Simplified96.9%
Taylor expanded in x around 0 85.4%
mul-1-neg85.4%
Simplified85.4%
Taylor expanded in z around inf 77.5%
unpow277.5%
Simplified77.5%
Final simplification93.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.25e+193) (not (<= z 1.7e+158))) (- (* z (- (* -0.5 (* y y)) y)) t) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+193) || !(z <= 1.7e+158)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = -t - log(y);
}
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.25d+193)) .or. (.not. (z <= 1.7d+158))) then
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.25e+193) || !(z <= 1.7e+158)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.25e+193) or not (z <= 1.7e+158): tmp = (z * ((-0.5 * (y * y)) - y)) - t else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.25e+193) || !(z <= 1.7e+158)) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.25e+193) || ~((z <= 1.7e+158))) tmp = (z * ((-0.5 * (y * y)) - y)) - t; else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.25e+193], N[Not[LessEqual[z, 1.7e+158]], $MachinePrecision]], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.25 \cdot 10^{+193} \lor \neg \left(z \leq 1.7 \cdot 10^{+158}\right):\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if z < -1.24999999999999993e193 or 1.7e158 < z Initial program 68.0%
Taylor expanded in y around 0 98.6%
+-commutative98.6%
mul-1-neg98.6%
unsub-neg98.6%
unpow298.6%
associate-*r*98.6%
Simplified98.6%
Taylor expanded in x around 0 66.9%
mul-1-neg66.9%
Simplified66.9%
Taylor expanded in z around inf 60.7%
unpow260.7%
Simplified60.7%
if -1.24999999999999993e193 < z < 1.7e158Initial program 97.9%
+-commutative97.9%
fma-def97.9%
sub-neg97.9%
metadata-eval97.9%
sub-neg97.9%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 97.9%
fma-neg97.9%
sub-neg97.9%
metadata-eval97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in x around 0 61.5%
mul-1-neg61.5%
Simplified61.5%
Final simplification61.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.1e-61) (not (<= t 0.00195))) (- (* z (- (* -0.5 (* y y)) y)) t) (- (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e-61) || !(t <= 0.00195)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = -log(y);
}
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 ((t <= (-2.1d-61)) .or. (.not. (t <= 0.00195d0))) then
tmp = (z * (((-0.5d0) * (y * y)) - y)) - t
else
tmp = -log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.1e-61) || !(t <= 0.00195)) {
tmp = (z * ((-0.5 * (y * y)) - y)) - t;
} else {
tmp = -Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.1e-61) or not (t <= 0.00195): tmp = (z * ((-0.5 * (y * y)) - y)) - t else: tmp = -math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.1e-61) || !(t <= 0.00195)) tmp = Float64(Float64(z * Float64(Float64(-0.5 * Float64(y * y)) - y)) - t); else tmp = Float64(-log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.1e-61) || ~((t <= 0.00195))) tmp = (z * ((-0.5 * (y * y)) - y)) - t; else tmp = -log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.1e-61], N[Not[LessEqual[t, 0.00195]], $MachinePrecision]], N[(N[(z * N[(N[(-0.5 * N[(y * y), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], (-N[Log[y], $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{-61} \lor \neg \left(t \leq 0.00195\right):\\
\;\;\;\;z \cdot \left(-0.5 \cdot \left(y \cdot y\right) - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;-\log y\\
\end{array}
\end{array}
if t < -2.0999999999999999e-61 or 0.0019499999999999999 < t Initial program 89.9%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
unpow299.4%
associate-*r*99.4%
Simplified99.4%
Taylor expanded in x around 0 72.3%
mul-1-neg72.3%
Simplified72.3%
Taylor expanded in z around inf 70.5%
unpow270.5%
Simplified70.5%
if -2.0999999999999999e-61 < t < 0.0019499999999999999Initial program 90.2%
+-commutative90.2%
fma-def90.2%
sub-neg90.2%
metadata-eval90.2%
sub-neg90.2%
log1p-def99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 89.6%
fma-neg89.6%
sub-neg89.6%
metadata-eval89.6%
+-commutative89.6%
Simplified89.6%
Taylor expanded in x around 0 43.4%
mul-1-neg43.4%
Simplified43.4%
Taylor expanded in t around 0 42.8%
neg-mul-142.8%
Simplified42.8%
Final simplification58.7%
(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 90.0%
Taylor expanded in y around 0 99.5%
+-commutative99.5%
mul-1-neg99.5%
unsub-neg99.5%
unpow299.5%
associate-*r*99.5%
Simplified99.5%
Taylor expanded in x around 0 64.2%
mul-1-neg64.2%
Simplified64.2%
Taylor expanded in z around inf 45.5%
unpow245.5%
Simplified45.5%
Final simplification45.5%
(FPCore (x y z t) :precision binary64 (if (<= z 7.6e+202) (- t) (* y (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.6e+202) {
tmp = -t;
} else {
tmp = 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 <= 7.6d+202) then
tmp = -t
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.6e+202) {
tmp = -t;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 7.6e+202: tmp = -t else: tmp = y * -z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 7.6e+202) tmp = Float64(-t); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 7.6e+202) tmp = -t; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 7.6e+202], (-t), N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.6 \cdot 10^{+202}:\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if z < 7.6000000000000001e202Initial program 95.3%
+-commutative95.3%
fma-def95.3%
sub-neg95.3%
metadata-eval95.3%
sub-neg95.3%
log1p-def99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 38.0%
mul-1-neg38.0%
Simplified38.0%
if 7.6000000000000001e202 < z Initial program 47.1%
Taylor expanded in y around 0 97.1%
mul-1-neg97.1%
Simplified97.1%
Taylor expanded in x around 0 97.1%
+-commutative97.1%
associate-+r+97.1%
distribute-rgt-in97.1%
mul-1-neg97.1%
sub-neg97.1%
metadata-eval97.1%
+-commutative97.1%
*-commutative97.1%
sub-neg97.1%
associate--l-97.1%
*-commutative97.1%
fma-def97.2%
Simplified97.2%
Taylor expanded in z around inf 50.3%
associate-*r*50.3%
neg-mul-150.3%
*-commutative50.3%
Simplified50.3%
Final simplification39.3%
(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 90.0%
Taylor expanded in y around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
sub-neg99.2%
metadata-eval99.2%
flip-+74.8%
associate-*l/74.8%
metadata-eval74.8%
fma-neg74.8%
metadata-eval74.8%
sub-neg74.8%
metadata-eval74.8%
+-commutative74.8%
Applied egg-rr74.8%
Taylor expanded in z around inf 45.2%
associate-*r*45.2%
neg-mul-145.2%
Simplified45.2%
Final simplification45.2%
(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 90.0%
+-commutative90.0%
fma-def90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.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 2023271
(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))