
(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 14 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 (+ z -1.0) (log1p (- y)) (- (* (log y) (+ x -1.0)) t)))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), ((log(y) * (x + -1.0)) - t));
}
function code(x, y, z, t) return fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(log(y) * Float64(x + -1.0)) - t)) end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(x + -1\right) - t\right)
\end{array}
Initial program 91.2%
+-commutative91.2%
associate--l+91.2%
fma-def91.2%
sub-neg91.2%
log1p-def99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (log y) (+ x -1.0))
(+
(+
(* -0.5 (* y (* y (+ z -1.0))))
(* (pow y 3.0) (+ 0.3333333333333333 (* z -0.3333333333333333))))
(* y (- 1.0 z))))
t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (((-0.5 * (y * (y * (z + -1.0)))) + (pow(y, 3.0) * (0.3333333333333333 + (z * -0.3333333333333333)))) + (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))) + ((((-0.5d0) * (y * (y * (z + (-1.0d0))))) + ((y ** 3.0d0) * (0.3333333333333333d0 + (z * (-0.3333333333333333d0))))) + (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)) + (((-0.5 * (y * (y * (z + -1.0)))) + (Math.pow(y, 3.0) * (0.3333333333333333 + (z * -0.3333333333333333)))) + (y * (1.0 - z)))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (((-0.5 * (y * (y * (z + -1.0)))) + (math.pow(y, 3.0) * (0.3333333333333333 + (z * -0.3333333333333333)))) + (y * (1.0 - z)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(Float64(-0.5 * Float64(y * Float64(y * Float64(z + -1.0)))) + Float64((y ^ 3.0) * Float64(0.3333333333333333 + Float64(z * -0.3333333333333333)))) + Float64(y * Float64(1.0 - z)))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + (((-0.5 * (y * (y * (z + -1.0)))) + ((y ^ 3.0) * (0.3333333333333333 + (z * -0.3333333333333333)))) + (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[(-0.5 * N[(y * N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[y, 3.0], $MachinePrecision] * N[(0.3333333333333333 + N[(z * -0.3333333333333333), $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(-0.5 \cdot \left(y \cdot \left(y \cdot \left(z + -1\right)\right)\right) + {y}^{3} \cdot \left(0.3333333333333333 + z \cdot -0.3333333333333333\right)\right) + y \cdot \left(1 - z\right)\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
fma-udef99.7%
+-commutative99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (+ (* y (* -0.5 (- (* z y) y))) (* y (- 1.0 z)))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + ((y * (-0.5 * ((z * y) - 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 = ((log(y) * (x + (-1.0d0))) + ((y * ((-0.5d0) * ((z * y) - y))) + (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)) + ((y * (-0.5 * ((z * y) - y))) + (y * (1.0 - z)))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + ((y * (-0.5 * ((z * y) - y))) + (y * (1.0 - z)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(Float64(y * Float64(-0.5 * Float64(Float64(z * y) - y))) + Float64(y * Float64(1.0 - z)))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + ((y * (-0.5 * ((z * y) - y))) + (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[(y * N[(-0.5 * N[(N[(z * y), $MachinePrecision] - y), $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(y \cdot \left(-0.5 \cdot \left(z \cdot y - y\right)\right) + y \cdot \left(1 - z\right)\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.6%
*-commutative99.6%
*-commutative99.6%
unpow299.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
distribute-rgt-in99.6%
*-commutative99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (- (+ (+ (* (log y) (+ x -1.0)) (* y (* -0.5 (- (* z y) y)))) (- y (* z y))) t))
double code(double x, double y, double z, double t) {
return (((log(y) * (x + -1.0)) + (y * (-0.5 * ((z * y) - y)))) + (y - (z * 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))) + (y * ((-0.5d0) * ((z * y) - y)))) + (y - (z * y))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((Math.log(y) * (x + -1.0)) + (y * (-0.5 * ((z * y) - y)))) + (y - (z * y))) - t;
}
def code(x, y, z, t): return (((math.log(y) * (x + -1.0)) + (y * (-0.5 * ((z * y) - y)))) + (y - (z * y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(y * Float64(-0.5 * Float64(Float64(z * y) - y)))) + Float64(y - Float64(z * y))) - t) end
function tmp = code(x, y, z, t) tmp = (((log(y) * (x + -1.0)) + (y * (-0.5 * ((z * y) - y)))) + (y - (z * y))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] + N[(y * N[(-0.5 * N[(N[(z * y), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y - N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log y \cdot \left(x + -1\right) + y \cdot \left(-0.5 \cdot \left(z \cdot y - y\right)\right)\right) + \left(y - z \cdot y\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.6%
*-commutative99.6%
*-commutative99.6%
unpow299.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
distribute-rgt-in99.6%
*-commutative99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
associate-+r-99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
*-commutative99.6%
+-commutative99.6%
+-commutative99.6%
distribute-rgt-in99.6%
*-commutative99.6%
neg-mul-199.6%
sub-neg99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.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)) + (((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))) + (((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)) + (((y * y) * 0.5) + (y * (1.0 - z)))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.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(y * y) * 0.5) + Float64(y * Float64(1.0 - z)))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.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[(y * y), $MachinePrecision] * 0.5), $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(y \cdot y\right) \cdot 0.5 + y \cdot \left(1 - z\right)\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.6%
*-commutative99.6%
*-commutative99.6%
unpow299.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
distribute-rgt-in99.6%
*-commutative99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in z around 0 99.1%
*-commutative99.1%
unpow299.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -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)) + (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))) + (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)) + (z * ((y * (y * -0.5)) - y))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -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(z * Float64(Float64(y * Float64(y * -0.5)) - y))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -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[(z * 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) + z \cdot \left(y \cdot \left(y \cdot -0.5\right) - y\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in z around inf 90.8%
*-commutative90.8%
sub-neg90.8%
mul-1-neg90.8%
log1p-def99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
associate-*r*99.1%
neg-mul-199.1%
associate-*r*99.1%
distribute-rgt-out99.1%
*-commutative99.1%
unpow299.1%
associate-*l*99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4e+183) (not (<= z 2.2e+176))) (- (- (* x (log y)) (* z y)) t) (- (* (log y) (+ x -1.0)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e+183) || !(z <= 2.2e+176)) {
tmp = ((x * log(y)) - (z * 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 ((z <= (-4d+183)) .or. (.not. (z <= 2.2d+176))) then
tmp = ((x * log(y)) - (z * 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 ((z <= -4e+183) || !(z <= 2.2e+176)) {
tmp = ((x * Math.log(y)) - (z * y)) - t;
} else {
tmp = (Math.log(y) * (x + -1.0)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4e+183) or not (z <= 2.2e+176): tmp = ((x * math.log(y)) - (z * y)) - t else: tmp = (math.log(y) * (x + -1.0)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4e+183) || !(z <= 2.2e+176)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(z * 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 ((z <= -4e+183) || ~((z <= 2.2e+176))) tmp = ((x * log(y)) - (z * y)) - t; else tmp = (log(y) * (x + -1.0)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4e+183], N[Not[LessEqual[z, 2.2e+176]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * 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}\;z \leq -4 \cdot 10^{+183} \lor \neg \left(z \leq 2.2 \cdot 10^{+176}\right):\\
\;\;\;\;\left(x \cdot \log y - z \cdot y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\end{array}
\end{array}
if z < -3.99999999999999979e183 or 2.20000000000000007e176 < z Initial program 62.3%
Taylor expanded in z around inf 62.3%
*-commutative62.3%
sub-neg62.3%
mul-1-neg62.3%
log1p-def99.8%
mul-1-neg99.8%
Simplified99.8%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
associate-*r*99.6%
neg-mul-199.6%
associate-*r*99.6%
distribute-rgt-out99.5%
*-commutative99.5%
unpow299.5%
associate-*l*99.5%
Simplified99.5%
Taylor expanded in x around inf 90.8%
Taylor expanded in y around 0 88.8%
mul-1-neg88.8%
distribute-lft-neg-out88.8%
*-commutative88.8%
Simplified88.8%
if -3.99999999999999979e183 < z < 2.20000000000000007e176Initial program 97.7%
Taylor expanded in y around 0 96.8%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ x -1.0)) (* y (- 1.0 z))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) + (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))) + (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)) + (y * (1.0 - z))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) + (y * (1.0 - z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) + Float64(y * Float64(1.0 - z))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) + (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[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) + y \cdot \left(1 - z\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.6%
*-commutative99.6%
*-commutative99.6%
unpow299.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
distribute-rgt-in99.6%
*-commutative99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in y around 0 99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ x -1.0)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (x + -1.0)) - (z * 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))) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (x + -1.0)) - (z * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (x + -1.0)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(x + -1.0)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (x + -1.0)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(x + -1\right) - z \cdot y\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in z around inf 90.8%
*-commutative90.8%
sub-neg90.8%
mul-1-neg90.8%
log1p-def99.3%
mul-1-neg99.3%
Simplified99.3%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
mul-1-neg98.7%
unsub-neg98.7%
*-commutative98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.5e+33) (not (<= x 20.0))) (- (* x (log y)) t) (- (* z (* y (+ -1.0 (* y -0.5)))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5e+33) || !(x <= 20.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = (z * (y * (-1.0 + (y * -0.5)))) - 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.5d+33)) .or. (.not. (x <= 20.0d0))) then
tmp = (x * log(y)) - t
else
tmp = (z * (y * ((-1.0d0) + (y * (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.5e+33) || !(x <= 20.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (z * (y * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.5e+33) or not (x <= 20.0): tmp = (x * math.log(y)) - t else: tmp = (z * (y * (-1.0 + (y * -0.5)))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.5e+33) || !(x <= 20.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.5e+33) || ~((x <= 20.0))) tmp = (x * log(y)) - t; else tmp = (z * (y * (-1.0 + (y * -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.5e+33], N[Not[LessEqual[x, 20.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+33} \lor \neg \left(x \leq 20\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if x < -2.49999999999999986e33 or 20 < x Initial program 97.8%
Taylor expanded in z around inf 97.8%
*-commutative97.8%
sub-neg97.8%
mul-1-neg97.8%
log1p-def99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in x around inf 96.5%
if -2.49999999999999986e33 < x < 20Initial program 85.4%
Taylor expanded in y around 0 100.0%
associate-+r+100.0%
mul-1-neg100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
*-commutative100.0%
*-commutative100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
associate-*l*100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-in100.0%
*-commutative100.0%
neg-mul-1100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 56.4%
*-commutative56.4%
sub-neg56.4%
*-commutative56.4%
unpow256.4%
associate-*r*56.4%
neg-mul-156.4%
*-commutative56.4%
distribute-lft-out56.4%
*-commutative56.4%
Simplified56.4%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (<= z 1.1e+244) (- (* (log y) (+ x -1.0)) t) (- (* z (* y (+ -1.0 (* y -0.5)))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.1e+244) {
tmp = (log(y) * (x + -1.0)) - t;
} else {
tmp = (z * (y * (-1.0 + (y * -0.5)))) - 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 <= 1.1d+244) then
tmp = (log(y) * (x + (-1.0d0))) - t
else
tmp = (z * (y * ((-1.0d0) + (y * (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 1.1e+244) {
tmp = (Math.log(y) * (x + -1.0)) - t;
} else {
tmp = (z * (y * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 1.1e+244: tmp = (math.log(y) * (x + -1.0)) - t else: tmp = (z * (y * (-1.0 + (y * -0.5)))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 1.1e+244) tmp = Float64(Float64(log(y) * Float64(x + -1.0)) - t); else tmp = Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 1.1e+244) tmp = (log(y) * (x + -1.0)) - t; else tmp = (z * (y * (-1.0 + (y * -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 1.1e+244], N[(N[(N[Log[y], $MachinePrecision] * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.1 \cdot 10^{+244}:\\
\;\;\;\;\log y \cdot \left(x + -1\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if z < 1.10000000000000001e244Initial program 93.8%
Taylor expanded in y around 0 92.2%
if 1.10000000000000001e244 < z Initial program 50.6%
Taylor expanded in y around 0 99.9%
associate-+r+99.9%
mul-1-neg99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
*-commutative99.9%
*-commutative99.9%
unpow299.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
distribute-rgt-in99.9%
*-commutative99.9%
neg-mul-199.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in z around inf 78.7%
*-commutative78.7%
sub-neg78.7%
*-commutative78.7%
unpow278.7%
associate-*r*78.7%
neg-mul-178.7%
*-commutative78.7%
distribute-lft-out78.7%
*-commutative78.7%
Simplified78.7%
Final simplification91.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.45e+47) (not (<= x 1.2e+16))) (* x (log y)) (- (* z (* y (+ -1.0 (* y -0.5)))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.45e+47) || !(x <= 1.2e+16)) {
tmp = x * log(y);
} else {
tmp = (z * (y * (-1.0 + (y * -0.5)))) - 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.45d+47)) .or. (.not. (x <= 1.2d+16))) then
tmp = x * log(y)
else
tmp = (z * (y * ((-1.0d0) + (y * (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.45e+47) || !(x <= 1.2e+16)) {
tmp = x * Math.log(y);
} else {
tmp = (z * (y * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.45e+47) or not (x <= 1.2e+16): tmp = x * math.log(y) else: tmp = (z * (y * (-1.0 + (y * -0.5)))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.45e+47) || !(x <= 1.2e+16)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.45e+47) || ~((x <= 1.2e+16))) tmp = x * log(y); else tmp = (z * (y * (-1.0 + (y * -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.45e+47], N[Not[LessEqual[x, 1.2e+16]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{+47} \lor \neg \left(x \leq 1.2 \cdot 10^{+16}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if x < -1.4499999999999999e47 or 1.2e16 < x Initial program 97.7%
Taylor expanded in z around inf 97.7%
*-commutative97.7%
sub-neg97.7%
mul-1-neg97.7%
log1p-def99.6%
mul-1-neg99.6%
Simplified99.6%
Taylor expanded in x around inf 97.1%
Taylor expanded in x around inf 81.3%
if -1.4499999999999999e47 < x < 1.2e16Initial program 85.9%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.6%
*-commutative99.6%
*-commutative99.6%
unpow299.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
distribute-rgt-in99.6%
*-commutative99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in z around inf 56.8%
*-commutative56.8%
sub-neg56.8%
*-commutative56.8%
unpow256.8%
associate-*r*56.8%
neg-mul-156.8%
*-commutative56.8%
distribute-lft-out56.9%
*-commutative56.9%
Simplified56.9%
Final simplification67.9%
(FPCore (x y z t) :precision binary64 (- (* z (* y (+ -1.0 (* y -0.5)))) t))
double code(double x, double y, double z, double t) {
return (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 = (z * (y * ((-1.0d0) + (y * (-0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * (y * (-1.0 + (y * -0.5)))) - t;
}
def code(x, y, z, t): return (z * (y * (-1.0 + (y * -0.5)))) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(y * Float64(-1.0 + Float64(y * -0.5)))) - t) end
function tmp = code(x, y, z, t) tmp = (z * (y * (-1.0 + (y * -0.5)))) - t; end
code[x_, y_, z_, t_] := N[(N[(z * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) - t
\end{array}
Initial program 91.2%
Taylor expanded in y around 0 99.7%
associate-+r+99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in y around 0 99.6%
*-commutative99.6%
*-commutative99.6%
unpow299.6%
associate-*r*99.6%
*-commutative99.6%
associate-*l*99.6%
*-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
distribute-rgt-in99.6%
*-commutative99.6%
neg-mul-199.6%
unsub-neg99.6%
Simplified99.6%
Taylor expanded in z around inf 39.3%
*-commutative39.3%
sub-neg39.3%
*-commutative39.3%
unpow239.3%
associate-*r*39.3%
neg-mul-139.3%
*-commutative39.3%
distribute-lft-out39.3%
*-commutative39.3%
Simplified39.3%
Final simplification39.3%
(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 91.2%
Taylor expanded in t around inf 30.9%
neg-mul-130.9%
Simplified30.9%
Final simplification30.9%
herbie shell --seed 2023242
(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))