
(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 13 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 (log1p (- y)) (+ -1.0 z) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma(log1p(-y), (-1.0 + z), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(fma(log1p(Float64(-y)), Float64(-1.0 + z), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[Log[1 + (-y)], $MachinePrecision] * N[(-1.0 + z), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{log1p}\left(-y\right), -1 + z, \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 87.8%
Taylor expanded in x around 0 87.8%
+-commutative87.8%
+-commutative87.8%
associate-+r+87.8%
distribute-rgt-in87.8%
*-commutative87.8%
fma-define87.8%
sub-neg87.8%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
*-commutative99.8%
+-commutative99.8%
Simplified99.8%
(FPCore (x y z t) :precision binary64 (- (fma y (* (+ -1.0 z) (+ -1.0 (* y -0.5))) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma(y, ((-1.0 + z) * (-1.0 + (y * -0.5))), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(Float64(-1.0 + z) * Float64(-1.0 + Float64(y * -0.5))), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(-1.0 + z), $MachinePrecision] * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \left(-1 + z\right) \cdot \left(-1 + y \cdot -0.5\right), \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 87.8%
Taylor expanded in x around 0 87.8%
+-commutative87.8%
+-commutative87.8%
associate-+r+87.8%
distribute-rgt-in87.8%
*-commutative87.8%
fma-define87.8%
sub-neg87.8%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
*-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.5%
fma-define99.6%
associate-*r*99.6%
distribute-rgt-out99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -4e+28) (not (<= (+ -1.0 x) -0.5))) (- (- (* (log y) x) (* y (+ -1.0 z))) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -4e+28) || !((-1.0 + x) <= -0.5)) {
tmp = ((log(y) * x) - (y * (-1.0 + z))) - t;
} else {
tmp = ((y * (1.0 - z)) - log(y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((((-1.0d0) + x) <= (-4d+28)) .or. (.not. (((-1.0d0) + x) <= (-0.5d0)))) then
tmp = ((log(y) * x) - (y * ((-1.0d0) + z))) - t
else
tmp = ((y * (1.0d0 - z)) - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -4e+28) || !((-1.0 + x) <= -0.5)) {
tmp = ((Math.log(y) * x) - (y * (-1.0 + z))) - t;
} else {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -4e+28) or not ((-1.0 + x) <= -0.5): tmp = ((math.log(y) * x) - (y * (-1.0 + z))) - t else: tmp = ((y * (1.0 - z)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -4e+28) || !(Float64(-1.0 + x) <= -0.5)) tmp = Float64(Float64(Float64(log(y) * x) - Float64(y * Float64(-1.0 + z))) - t); else tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -4e+28) || ~(((-1.0 + x) <= -0.5))) tmp = ((log(y) * x) - (y * (-1.0 + z))) - t; else tmp = ((y * (1.0 - z)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -4e+28], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.5]], $MachinePrecision]], N[(N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -4 \cdot 10^{+28} \lor \neg \left(-1 + x \leq -0.5\right):\\
\;\;\;\;\left(\log y \cdot x - y \cdot \left(-1 + z\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -3.99999999999999983e28 or -0.5 < (-.f64 x #s(literal 1 binary64)) Initial program 92.3%
Taylor expanded in x around 0 92.3%
+-commutative92.3%
+-commutative92.3%
associate-+r+92.3%
distribute-rgt-in92.3%
*-commutative92.3%
fma-define92.3%
sub-neg92.3%
log1p-define99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
*-commutative99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
mul-1-neg99.0%
unsub-neg99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in x around inf 99.0%
*-commutative99.0%
Simplified99.0%
if -3.99999999999999983e28 < (-.f64 x #s(literal 1 binary64)) < -0.5Initial program 84.0%
Taylor expanded in x around 0 84.0%
+-commutative84.0%
+-commutative84.0%
associate-+r+84.0%
distribute-rgt-in84.0%
*-commutative84.0%
fma-define84.0%
sub-neg84.0%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
*-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
mul-1-neg99.3%
unsub-neg99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in x around 0 97.9%
sub-neg97.9%
neg-mul-197.9%
mul-1-neg97.9%
+-commutative97.9%
unsub-neg97.9%
mul-1-neg97.9%
sub-neg97.9%
metadata-eval97.9%
+-commutative97.9%
distribute-rgt-neg-in97.9%
distribute-neg-in97.9%
metadata-eval97.9%
sub-neg97.9%
Simplified97.9%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -1.00000001) (not (<= (+ -1.0 x) 5e+29))) (- (* (log y) (+ -1.0 x)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -1.00000001) || !((-1.0 + x) <= 5e+29)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = ((y * (1.0 - z)) - log(y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((((-1.0d0) + x) <= (-1.00000001d0)) .or. (.not. (((-1.0d0) + x) <= 5d+29))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = ((y * (1.0d0 - z)) - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -1.00000001) || !((-1.0 + x) <= 5e+29)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -1.00000001) or not ((-1.0 + x) <= 5e+29): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = ((y * (1.0 - z)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -1.00000001) || !(Float64(-1.0 + x) <= 5e+29)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -1.00000001) || ~(((-1.0 + x) <= 5e+29))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = ((y * (1.0 - z)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.00000001], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 5e+29]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -1.00000001 \lor \neg \left(-1 + x \leq 5 \cdot 10^{+29}\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.0000000099999999 or 5.0000000000000001e29 < (-.f64 x #s(literal 1 binary64)) Initial program 93.6%
Taylor expanded in y around 0 92.4%
if -1.0000000099999999 < (-.f64 x #s(literal 1 binary64)) < 5.0000000000000001e29Initial program 82.8%
Taylor expanded in x around 0 82.8%
+-commutative82.8%
+-commutative82.8%
associate-+r+82.8%
distribute-rgt-in82.8%
*-commutative82.8%
fma-define82.8%
sub-neg82.8%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
*-commutative99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around 0 98.1%
sub-neg98.1%
neg-mul-198.1%
mul-1-neg98.1%
+-commutative98.1%
unsub-neg98.1%
mul-1-neg98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
distribute-rgt-neg-in98.1%
distribute-neg-in98.1%
metadata-eval98.1%
sub-neg98.1%
Simplified98.1%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.7e+176) (not (<= z 1.55e+133))) (- (* (log1p (- y)) z) t) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e+176) || !(z <= 1.55e+133)) {
tmp = (log1p(-y) * z) - t;
} else {
tmp = (log(y) * (-1.0 + x)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e+176) || !(z <= 1.55e+133)) {
tmp = (Math.log1p(-y) * z) - t;
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.7e+176) or not (z <= 1.55e+133): tmp = (math.log1p(-y) * z) - t else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.7e+176) || !(z <= 1.55e+133)) tmp = Float64(Float64(log1p(Float64(-y)) * z) - t); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.7e+176], N[Not[LessEqual[z, 1.55e+133]], $MachinePrecision]], N[(N[(N[Log[1 + (-y)], $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{+176} \lor \neg \left(z \leq 1.55 \cdot 10^{+133}\right):\\
\;\;\;\;\mathsf{log1p}\left(-y\right) \cdot z - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if z < -1.70000000000000007e176 or 1.55e133 < z Initial program 53.7%
Taylor expanded in z around inf 38.8%
*-commutative38.8%
sub-neg38.8%
log1p-define82.2%
Simplified82.2%
if -1.70000000000000007e176 < z < 1.55e133Initial program 98.0%
Taylor expanded in y around 0 98.0%
Final simplification94.4%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* y (+ -1.0 z))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (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) * ((-1.0d0) + x)) - (y * ((-1.0d0) + z))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (y * (-1.0 + z))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (y * (-1.0 + z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(y * Float64(-1.0 + z))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (y * (-1.0 + z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(-1 + z\right)\right) - t
\end{array}
Initial program 87.8%
Taylor expanded in x around 0 87.8%
+-commutative87.8%
+-commutative87.8%
associate-+r+87.8%
distribute-rgt-in87.8%
*-commutative87.8%
fma-define87.8%
sub-neg87.8%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
*-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
mul-1-neg99.2%
unsub-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (- (* (log1p (- y)) z) t))
double code(double x, double y, double z, double t) {
return (log1p(-y) * z) - t;
}
public static double code(double x, double y, double z, double t) {
return (Math.log1p(-y) * z) - t;
}
def code(x, y, z, t): return (math.log1p(-y) * z) - t
function code(x, y, z, t) return Float64(Float64(log1p(Float64(-y)) * z) - t) end
code[x_, y_, z_, t_] := N[(N[(N[Log[1 + (-y)], $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{log1p}\left(-y\right) \cdot z - t
\end{array}
Initial program 87.8%
Taylor expanded in z around inf 38.1%
*-commutative38.1%
sub-neg38.1%
log1p-define49.1%
Simplified49.1%
(FPCore (x y z t) :precision binary64 (- (* y (- (* y (+ (* z -0.5) (* -0.3333333333333333 (* y z)))) z)) t))
double code(double x, double y, double z, double t) {
return (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (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 * ((y * ((z * (-0.5d0)) + ((-0.3333333333333333d0) * (y * z)))) - z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t;
}
def code(x, y, z, t): return (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(Float64(y * Float64(Float64(z * -0.5) + Float64(-0.3333333333333333 * Float64(y * z)))) - z)) - t) end
function tmp = code(x, y, z, t) tmp = (y * ((y * ((z * -0.5) + (-0.3333333333333333 * (y * z)))) - z)) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(N[(y * N[(N[(z * -0.5), $MachinePrecision] + N[(-0.3333333333333333 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(y \cdot \left(z \cdot -0.5 + -0.3333333333333333 \cdot \left(y \cdot z\right)\right) - z\right) - t
\end{array}
Initial program 87.8%
Taylor expanded in z around inf 38.1%
*-commutative38.1%
sub-neg38.1%
log1p-define49.1%
Simplified49.1%
Taylor expanded in y around 0 48.9%
Final simplification48.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -0.00105) (not (<= t 17500000.0))) (- t) (* (- y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -0.00105) || !(t <= 17500000.0)) {
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 ((t <= (-0.00105d0)) .or. (.not. (t <= 17500000.0d0))) 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 ((t <= -0.00105) || !(t <= 17500000.0)) {
tmp = -t;
} else {
tmp = -y * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -0.00105) or not (t <= 17500000.0): tmp = -t else: tmp = -y * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -0.00105) || !(t <= 17500000.0)) tmp = Float64(-t); else tmp = Float64(Float64(-y) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -0.00105) || ~((t <= 17500000.0))) tmp = -t; else tmp = -y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -0.00105], N[Not[LessEqual[t, 17500000.0]], $MachinePrecision]], (-t), N[((-y) * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.00105 \lor \neg \left(t \leq 17500000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\end{array}
\end{array}
if t < -0.00104999999999999994 or 1.75e7 < t Initial program 94.1%
Taylor expanded in t around inf 67.3%
neg-mul-167.3%
Simplified67.3%
if -0.00104999999999999994 < t < 1.75e7Initial program 80.7%
Taylor expanded in z around inf 4.0%
*-commutative4.0%
sub-neg4.0%
log1p-define21.0%
Simplified21.0%
Taylor expanded in y around 0 20.4%
mul-1-neg20.4%
distribute-rgt-neg-in20.4%
Simplified20.4%
Taylor expanded in y around inf 20.2%
mul-1-neg20.2%
distribute-rgt-neg-in20.2%
Simplified20.2%
Final simplification45.2%
(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 87.8%
Taylor expanded in z around inf 38.1%
*-commutative38.1%
sub-neg38.1%
log1p-define49.1%
Simplified49.1%
Taylor expanded in y around 0 48.9%
Final simplification48.9%
(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 87.8%
Taylor expanded in x around 0 87.8%
+-commutative87.8%
+-commutative87.8%
associate-+r+87.8%
distribute-rgt-in87.8%
*-commutative87.8%
fma-define87.8%
sub-neg87.8%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
*-commutative99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
mul-1-neg99.2%
unsub-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around inf 48.6%
(FPCore (x y z t) :precision binary64 (- (* (- y) z) t))
double code(double x, double y, double z, double t) {
return (-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 = (-y * z) - t
end function
public static double code(double x, double y, double z, double t) {
return (-y * z) - t;
}
def code(x, y, z, t): return (-y * z) - t
function code(x, y, z, t) return Float64(Float64(Float64(-y) * z) - t) end
function tmp = code(x, y, z, t) tmp = (-y * z) - t; end
code[x_, y_, z_, t_] := N[(N[((-y) * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(-y\right) \cdot z - t
\end{array}
Initial program 87.8%
Taylor expanded in z around inf 38.1%
*-commutative38.1%
sub-neg38.1%
log1p-define49.1%
Simplified49.1%
Taylor expanded in y around 0 48.5%
mul-1-neg48.5%
distribute-rgt-neg-in48.5%
Simplified48.5%
Final simplification48.5%
(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 87.8%
Taylor expanded in t around inf 37.1%
neg-mul-137.1%
Simplified37.1%
herbie shell --seed 2024096
(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))