
(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 11 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)) (fma (+ -1.0 x) (log y) (- t))))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), fma((-1.0 + x), log(y), -t));
}
function code(x, y, z, t) return fma(Float64(z + -1.0), log1p(Float64(-y)), fma(Float64(-1.0 + x), log(y), Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \mathsf{fma}\left(-1 + x, \log y, -t\right)\right)
\end{array}
Initial program 87.1%
sub-neg87.1%
+-commutative87.1%
associate-+l+87.1%
fma-define87.1%
sub-neg87.1%
metadata-eval87.1%
sub-neg87.1%
log1p-define99.8%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (fma (+ z -1.0) (log1p (- y)) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 87.1%
+-commutative87.1%
fma-define87.1%
sub-neg87.1%
metadata-eval87.1%
sub-neg87.1%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -500.0) (not (<= (+ -1.0 x) -0.99999999999998))) (- (- (* x (log y)) (* z y)) t) (- (- t) (+ (log y) (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -500.0) || !((-1.0 + x) <= -0.99999999999998)) {
tmp = ((x * log(y)) - (z * y)) - t;
} else {
tmp = -t - (log(y) + (z * 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 ((((-1.0d0) + x) <= (-500.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.99999999999998d0)))) then
tmp = ((x * log(y)) - (z * y)) - t
else
tmp = -t - (log(y) + (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -500.0) || !((-1.0 + x) <= -0.99999999999998)) {
tmp = ((x * Math.log(y)) - (z * y)) - t;
} else {
tmp = -t - (Math.log(y) + (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -500.0) or not ((-1.0 + x) <= -0.99999999999998): tmp = ((x * math.log(y)) - (z * y)) - t else: tmp = -t - (math.log(y) + (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -500.0) || !(Float64(-1.0 + x) <= -0.99999999999998)) tmp = Float64(Float64(Float64(x * log(y)) - Float64(z * y)) - t); else tmp = Float64(Float64(-t) - Float64(log(y) + Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -500.0) || ~(((-1.0 + x) <= -0.99999999999998))) tmp = ((x * log(y)) - (z * y)) - t; else tmp = -t - (log(y) + (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -500.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.99999999999998]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[Log[y], $MachinePrecision] + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -500 \lor \neg \left(-1 + x \leq -0.99999999999998\right):\\
\;\;\;\;\left(x \cdot \log y - z \cdot y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\log y + z \cdot y\right)\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -500 or -0.99999999999998002 < (-.f64 x #s(literal 1 binary64)) Initial program 93.7%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
mul-1-neg99.3%
fmm-def99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in z around inf 99.3%
Taylor expanded in x around inf 96.9%
*-commutative96.9%
Simplified96.9%
if -500 < (-.f64 x #s(literal 1 binary64)) < -0.99999999999998002Initial program 80.4%
Taylor expanded in y around 0 98.8%
+-commutative98.8%
sub-neg98.8%
metadata-eval98.8%
fma-define98.8%
mul-1-neg98.8%
fmm-def98.8%
+-commutative98.8%
sub-neg98.8%
metadata-eval98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in z around inf 98.8%
Taylor expanded in x around 0 98.8%
mul-1-neg98.8%
Simplified98.8%
Final simplification97.8%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -500.0) (not (<= (+ -1.0 x) -0.999999999999999))) (- (* (log y) (+ -1.0 x)) t) (- (- t) (+ (log y) (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -500.0) || !((-1.0 + x) <= -0.999999999999999)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = -t - (log(y) + (z * 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 ((((-1.0d0) + x) <= (-500.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.999999999999999d0)))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = -t - (log(y) + (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -500.0) || !((-1.0 + x) <= -0.999999999999999)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = -t - (Math.log(y) + (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -500.0) or not ((-1.0 + x) <= -0.999999999999999): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = -t - (math.log(y) + (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -500.0) || !(Float64(-1.0 + x) <= -0.999999999999999)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(-t) - Float64(log(y) + Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -500.0) || ~(((-1.0 + x) <= -0.999999999999999))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = -t - (log(y) + (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -500.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.999999999999999]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[(N[Log[y], $MachinePrecision] + N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -500 \lor \neg \left(-1 + x \leq -0.999999999999999\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \left(\log y + z \cdot y\right)\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -500 or -0.999999999999999001 < (-.f64 x #s(literal 1 binary64)) Initial program 93.7%
+-commutative93.7%
fma-define93.7%
sub-neg93.7%
metadata-eval93.7%
sub-neg93.7%
log1p-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 93.1%
if -500 < (-.f64 x #s(literal 1 binary64)) < -0.999999999999999001Initial program 80.2%
Taylor expanded in y around 0 98.8%
+-commutative98.8%
sub-neg98.8%
metadata-eval98.8%
fma-define98.8%
mul-1-neg98.8%
fmm-def98.8%
+-commutative98.8%
sub-neg98.8%
metadata-eval98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in z around inf 98.8%
Taylor expanded in x around 0 98.8%
mul-1-neg98.8%
Simplified98.8%
Final simplification95.9%
(FPCore (x y z t) :precision binary64 (if (<= z -7.5e+169) (- (* z (log1p (- y))) t) (if (<= z 3.9e+192) (- (* (log y) (+ -1.0 x)) t) (- (* z (- y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e+169) {
tmp = (z * log1p(-y)) - t;
} else if (z <= 3.9e+192) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7.5e+169) {
tmp = (z * Math.log1p(-y)) - t;
} else if (z <= 3.9e+192) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (z * -y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7.5e+169: tmp = (z * math.log1p(-y)) - t elif z <= 3.9e+192: tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (z * -y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7.5e+169) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); elseif (z <= 3.9e+192) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(z * Float64(-y)) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -7.5e+169], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 3.9e+192], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+169}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{+192}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\end{array}
\end{array}
if z < -7.49999999999999992e169Initial program 45.7%
Taylor expanded in z around inf 13.3%
*-commutative13.3%
sub-neg13.3%
log1p-define68.6%
Simplified68.6%
if -7.49999999999999992e169 < z < 3.8999999999999998e192Initial program 97.1%
+-commutative97.1%
fma-define97.1%
sub-neg97.1%
metadata-eval97.1%
sub-neg97.1%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 95.7%
if 3.8999999999999998e192 < z Initial program 41.1%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
fma-define99.8%
mul-1-neg99.8%
fmm-def99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 73.4%
mul-1-neg73.4%
distribute-rgt-neg-in73.4%
Simplified73.4%
Final simplification91.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -950000.0) (not (<= x 1.2e-15))) (- (* x (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -950000.0) || !(x <= 1.2e-15)) {
tmp = (x * 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 ((x <= -950000.0) || !(x <= 1.2e-15)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -950000.0) or not (x <= 1.2e-15): tmp = (x * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -950000.0) || !(x <= 1.2e-15)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -950000.0], N[Not[LessEqual[x, 1.2e-15]], $MachinePrecision]], N[(N[(x * 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}\;x \leq -950000 \lor \neg \left(x \leq 1.2 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if x < -9.5e5 or 1.19999999999999997e-15 < x Initial program 94.4%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
mul-1-neg99.3%
fmm-def99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in z around inf 99.3%
Taylor expanded in x around inf 91.8%
*-commutative91.8%
Simplified91.8%
if -9.5e5 < x < 1.19999999999999997e-15Initial program 79.9%
Taylor expanded in z around inf 38.2%
*-commutative38.2%
sub-neg38.2%
log1p-define57.5%
Simplified57.5%
Final simplification74.5%
(FPCore (x y z t) :precision binary64 (if (or (<= x -600000.0) (not (<= x 1.2e-15))) (- (* x (log y)) t) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -600000.0) || !(x <= 1.2e-15)) {
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 <= (-600000.0d0)) .or. (.not. (x <= 1.2d-15))) 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 <= -600000.0) || !(x <= 1.2e-15)) {
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 <= -600000.0) or not (x <= 1.2e-15): 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 <= -600000.0) || !(x <= 1.2e-15)) 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 <= -600000.0) || ~((x <= 1.2e-15))) 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, -600000.0], N[Not[LessEqual[x, 1.2e-15]], $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 -600000 \lor \neg \left(x \leq 1.2 \cdot 10^{-15}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if x < -6e5 or 1.19999999999999997e-15 < x Initial program 94.4%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
mul-1-neg99.3%
fmm-def99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in z around inf 99.3%
Taylor expanded in x around inf 91.8%
*-commutative91.8%
Simplified91.8%
if -6e5 < x < 1.19999999999999997e-15Initial program 79.9%
Taylor expanded in y around 0 98.8%
+-commutative98.8%
sub-neg98.8%
metadata-eval98.8%
fma-define98.8%
mul-1-neg98.8%
fmm-def98.8%
+-commutative98.8%
sub-neg98.8%
metadata-eval98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in y around inf 56.8%
Final simplification74.2%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (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) * ((-1.0d0) + x)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (z * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - z \cdot y\right) - t
\end{array}
Initial program 87.1%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
fma-define99.0%
mul-1-neg99.0%
fmm-def99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in z around inf 99.0%
Final simplification99.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 87.1%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
fma-define99.0%
mul-1-neg99.0%
fmm-def99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in y around inf 45.0%
Final simplification45.0%
(FPCore (x y z t) :precision binary64 (- (* z (- y)) t))
double code(double x, double y, double z, double t) {
return (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 = (z * -y) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * -y) - t;
}
def code(x, y, z, t): return (z * -y) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(-y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * -y) - t; end
code[x_, y_, z_, t_] := N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-y\right) - t
\end{array}
Initial program 87.1%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
fma-define99.0%
mul-1-neg99.0%
fmm-def99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in z around inf 44.7%
mul-1-neg44.7%
distribute-rgt-neg-in44.7%
Simplified44.7%
Final simplification44.7%
(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.1%
+-commutative87.1%
fma-define87.1%
sub-neg87.1%
metadata-eval87.1%
sub-neg87.1%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 32.0%
mul-1-neg32.0%
Simplified32.0%
Final simplification32.0%
herbie shell --seed 2024115
(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))