
(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 (- x 1.0) (log y) (* (log1p (- y)) (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), (log1p(-y) * (z + -1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(x - 1.0), log(y), Float64(log1p(Float64(-y)) * Float64(z + -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[Log[1 + (-y)], $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, \mathsf{log1p}\left(-y\right) \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 91.6%
cancel-sign-sub91.6%
distribute-lft-neg-in91.6%
fma-neg91.6%
remove-double-neg91.6%
sub-neg91.6%
log1p-def99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (fma (- (- -1.0) z) y (* (+ z -1.0) (* y (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + fma((-(-1.0) - z), y, ((z + -1.0) * (y * (y * -0.5))))) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + fma(Float64(Float64(-(-1.0)) - z), y, Float64(Float64(z + -1.0) * Float64(y * Float64(y * -0.5))))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[((--1.0) - z), $MachinePrecision] * y + N[(N[(z + -1.0), $MachinePrecision] * N[(y * N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \mathsf{fma}\left(\left(--1\right) - z, y, \left(z + -1\right) \cdot \left(y \cdot \left(y \cdot -0.5\right)\right)\right)\right) - t
\end{array}
Initial program 91.6%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
associate-*r*99.4%
fma-def99.4%
mul-1-neg99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
associate-*r*99.4%
unpow299.4%
associate-*r*99.4%
+-commutative99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (- (fma (- x 1.0) (log y) (* y (- z))) t))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), (y * -z)) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(x - 1.0), log(y), Float64(y * Float64(-z))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(y * (-z)), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, y \cdot \left(-z\right)\right) - t
\end{array}
Initial program 91.6%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
mul-1-neg99.3%
unsub-neg99.3%
*-commutative99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
*-commutative99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in z around inf 99.3%
*-commutative99.3%
Simplified99.3%
cancel-sign-sub-inv99.3%
+-commutative99.3%
*-commutative99.3%
fma-def99.3%
+-commutative99.3%
Applied egg-rr99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (- x 1.0) -10.0) (not (<= (- x 1.0) -0.99999998))) (- (* (- x 1.0) (log y)) t) (- (- (- (log y)) (* y z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x - 1.0) <= -10.0) || !((x - 1.0) <= -0.99999998)) {
tmp = ((x - 1.0) * log(y)) - t;
} else {
tmp = (-log(y) - (y * 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 - 1.0d0) <= (-10.0d0)) .or. (.not. ((x - 1.0d0) <= (-0.99999998d0)))) then
tmp = ((x - 1.0d0) * log(y)) - t
else
tmp = (-log(y) - (y * z)) - 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) <= -10.0) || !((x - 1.0) <= -0.99999998)) {
tmp = ((x - 1.0) * Math.log(y)) - t;
} else {
tmp = (-Math.log(y) - (y * z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x - 1.0) <= -10.0) or not ((x - 1.0) <= -0.99999998): tmp = ((x - 1.0) * math.log(y)) - t else: tmp = (-math.log(y) - (y * z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x - 1.0) <= -10.0) || !(Float64(x - 1.0) <= -0.99999998)) tmp = Float64(Float64(Float64(x - 1.0) * log(y)) - t); else tmp = Float64(Float64(Float64(-log(y)) - Float64(y * z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x - 1.0) <= -10.0) || ~(((x - 1.0) <= -0.99999998))) tmp = ((x - 1.0) * log(y)) - t; else tmp = (-log(y) - (y * z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x - 1.0), $MachinePrecision], -10.0], N[Not[LessEqual[N[(x - 1.0), $MachinePrecision], -0.99999998]], $MachinePrecision]], N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x - 1 \leq -10 \lor \neg \left(x - 1 \leq -0.99999998\right):\\
\;\;\;\;\left(x - 1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - y \cdot z\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -10 or -0.999999980000000011 < (-.f64 x 1) Initial program 95.1%
Taylor expanded in y around 0 93.7%
if -10 < (-.f64 x 1) < -0.999999980000000011Initial program 87.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
*-commutative100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around 0 99.8%
mul-1-neg99.8%
Simplified99.8%
Final simplification96.4%
(FPCore (x y z t) :precision binary64 (if (<= (+ z -1.0) 1e+254) (- (* (- x 1.0) (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= 1e+254) {
tmp = ((x - 1.0) * log(y)) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= 1e+254) {
tmp = ((x - 1.0) * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z + -1.0) <= 1e+254: tmp = ((x - 1.0) * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= 1e+254) tmp = Float64(Float64(Float64(x - 1.0) * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], 1e+254], N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq 10^{+254}:\\
\;\;\;\;\left(x - 1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if (-.f64 z 1) < 9.9999999999999994e253Initial program 93.8%
Taylor expanded in y around 0 93.7%
if 9.9999999999999994e253 < (-.f64 z 1) Initial program 43.0%
Taylor expanded in z around inf 28.6%
sub-neg28.6%
mul-1-neg28.6%
log1p-def77.4%
mul-1-neg77.4%
Simplified77.4%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (- (- (* (- x 1.0) (log y)) (* y z)) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) - (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 = (((x - 1.0d0) * log(y)) - (y * z)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) - (y * z)) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) - (y * z)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) - Float64(y * z)) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) - (y * z)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(y * z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y - y \cdot z\right) - t
\end{array}
Initial program 91.6%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
mul-1-neg99.3%
unsub-neg99.3%
*-commutative99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
*-commutative99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in z around inf 99.3%
*-commutative99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.35e-62) (not (<= x 440.0))) (- (* x (log y)) t) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.35e-62) || !(x <= 440.0)) {
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 <= (-1.35d-62)) .or. (.not. (x <= 440.0d0))) 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 <= -1.35e-62) || !(x <= 440.0)) {
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 <= -1.35e-62) or not (x <= 440.0): 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 <= -1.35e-62) || !(x <= 440.0)) 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 <= -1.35e-62) || ~((x <= 440.0))) 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, -1.35e-62], N[Not[LessEqual[x, 440.0]], $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 -1.35 \cdot 10^{-62} \lor \neg \left(x \leq 440\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if x < -1.3500000000000001e-62 or 440 < x Initial program 95.4%
Taylor expanded in y around 0 99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
associate-*r*99.0%
fma-def99.0%
mul-1-neg99.0%
+-commutative99.0%
sub-neg99.0%
metadata-eval99.0%
*-commutative99.0%
associate-*r*99.0%
unpow299.0%
associate-*r*99.0%
+-commutative99.0%
Simplified99.0%
Taylor expanded in x around inf 91.3%
if -1.3500000000000001e-62 < x < 440Initial program 86.6%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
associate-*r*100.0%
fma-def100.0%
mul-1-neg100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
*-commutative100.0%
associate-*r*100.0%
unpow2100.0%
associate-*r*100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
fma-def100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in y around inf 68.0%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (- (+ (* y (- 1.0 z)) (* -0.5 (* y (* y (+ z -1.0))))) t))
double code(double x, double y, double z, double t) {
return ((y * (1.0 - z)) + (-0.5 * (y * (y * (z + -1.0))))) - 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)) + ((-0.5d0) * (y * (y * (z + (-1.0d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((y * (1.0 - z)) + (-0.5 * (y * (y * (z + -1.0))))) - t;
}
def code(x, y, z, t): return ((y * (1.0 - z)) + (-0.5 * (y * (y * (z + -1.0))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(y * Float64(1.0 - z)) + Float64(-0.5 * Float64(y * Float64(y * Float64(z + -1.0))))) - t) end
function tmp = code(x, y, z, t) tmp = ((y * (1.0 - z)) + (-0.5 * (y * (y * (z + -1.0))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(y * N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(y \cdot \left(1 - z\right) + -0.5 \cdot \left(y \cdot \left(y \cdot \left(z + -1\right)\right)\right)\right) - t
\end{array}
Initial program 91.6%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
associate-*r*99.4%
fma-def99.4%
mul-1-neg99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
associate-*r*99.4%
unpow299.4%
associate-*r*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around inf 47.1%
+-commutative47.1%
fma-def47.1%
*-commutative47.1%
unpow247.1%
associate-*r*47.1%
associate-*l*47.1%
*-lft-identity47.1%
*-lft-identity47.1%
*-commutative47.1%
sub-neg47.1%
metadata-eval47.1%
Simplified47.1%
fma-udef47.1%
associate-*l*47.1%
*-commutative47.1%
+-commutative47.1%
Applied egg-rr47.1%
Final simplification47.1%
(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 91.6%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
associate-*r*99.4%
fma-def99.4%
mul-1-neg99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
associate-*r*99.4%
unpow299.4%
associate-*r*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in z around inf 47.0%
*-commutative47.0%
neg-mul-147.0%
unsub-neg47.0%
unpow247.0%
Simplified47.0%
Final simplification47.0%
(FPCore (x y z t) :precision binary64 (if (<= t -1.6e-58) (- y t) (if (<= t 62000.0) (- y (* y z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.6e-58) {
tmp = y - t;
} else if (t <= 62000.0) {
tmp = y - (y * z);
} else {
tmp = -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 (t <= (-1.6d-58)) then
tmp = y - t
else if (t <= 62000.0d0) then
tmp = y - (y * z)
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.6e-58) {
tmp = y - t;
} else if (t <= 62000.0) {
tmp = y - (y * z);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.6e-58: tmp = y - t elif t <= 62000.0: tmp = y - (y * z) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.6e-58) tmp = Float64(y - t); elseif (t <= 62000.0) tmp = Float64(y - Float64(y * z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.6e-58) tmp = y - t; elseif (t <= 62000.0) tmp = y - (y * z); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.6e-58], N[(y - t), $MachinePrecision], If[LessEqual[t, 62000.0], N[(y - N[(y * z), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{-58}:\\
\;\;\;\;y - t\\
\mathbf{elif}\;t \leq 62000:\\
\;\;\;\;y - y \cdot z\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -1.6e-58Initial program 96.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
associate-*r*99.9%
fma-def99.9%
mul-1-neg99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
*-commutative99.9%
associate-*r*99.9%
unpow299.9%
associate-*r*99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
fma-def99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 65.3%
Taylor expanded in z around 0 63.9%
if -1.6e-58 < t < 62000Initial program 84.6%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
associate-*r*98.7%
fma-def98.7%
mul-1-neg98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
*-commutative98.7%
associate-*r*98.7%
unpow298.7%
associate-*r*98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in y around 0 98.5%
fma-def98.5%
sub-neg98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in y around inf 16.4%
Taylor expanded in y around inf 16.4%
sub-neg16.4%
distribute-rgt-in16.4%
*-lft-identity16.4%
*-commutative16.4%
distribute-rgt-neg-in16.4%
unsub-neg16.4%
Simplified16.4%
if 62000 < t Initial program 96.9%
cancel-sign-sub96.9%
distribute-lft-neg-in96.9%
fma-neg96.9%
remove-double-neg96.9%
sub-neg96.9%
log1p-def100.0%
Simplified100.0%
Taylor expanded in t around inf 73.3%
neg-mul-173.3%
Simplified73.3%
Final simplification45.8%
(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 91.6%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
associate-*r*99.4%
fma-def99.4%
mul-1-neg99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
associate-*r*99.4%
unpow299.4%
associate-*r*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around 0 99.3%
fma-def99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around inf 47.0%
Final simplification47.0%
(FPCore (x y z t) :precision binary64 (- (+ t (* y z))))
double code(double x, double y, double z, double t) {
return -(t + (y * z));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -(t + (y * z))
end function
public static double code(double x, double y, double z, double t) {
return -(t + (y * z));
}
def code(x, y, z, t): return -(t + (y * z))
function code(x, y, z, t) return Float64(-Float64(t + Float64(y * z))) end
function tmp = code(x, y, z, t) tmp = -(t + (y * z)); end
code[x_, y_, z_, t_] := (-N[(t + N[(y * z), $MachinePrecision]), $MachinePrecision])
\begin{array}{l}
\\
-\left(t + y \cdot z\right)
\end{array}
Initial program 91.6%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
mul-1-neg99.3%
unsub-neg99.3%
*-commutative99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
*-commutative99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in z around inf 46.9%
associate-*r*46.9%
neg-mul-146.9%
Simplified46.9%
Final simplification46.9%
(FPCore (x y z t) :precision binary64 (- y t))
double code(double x, double y, double z, double t) {
return 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 = y - t
end function
public static double code(double x, double y, double z, double t) {
return y - t;
}
def code(x, y, z, t): return y - t
function code(x, y, z, t) return Float64(y - t) end
function tmp = code(x, y, z, t) tmp = y - t; end
code[x_, y_, z_, t_] := N[(y - t), $MachinePrecision]
\begin{array}{l}
\\
y - t
\end{array}
Initial program 91.6%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
associate-*r*99.4%
fma-def99.4%
mul-1-neg99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
*-commutative99.4%
associate-*r*99.4%
unpow299.4%
associate-*r*99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around 0 99.3%
fma-def99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around inf 47.0%
Taylor expanded in z around 0 40.0%
Final simplification40.0%
(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.6%
cancel-sign-sub91.6%
distribute-lft-neg-in91.6%
fma-neg91.6%
remove-double-neg91.6%
sub-neg91.6%
log1p-def99.9%
Simplified99.9%
Taylor expanded in t around inf 39.9%
neg-mul-139.9%
Simplified39.9%
Final simplification39.9%
herbie shell --seed 2023224
(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))