
(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 16 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) (+ -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 fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(log(y) * Float64(-1.0 + x)) - 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[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right) - t\right)
\end{array}
Initial program 90.7%
sub-neg90.7%
+-commutative90.7%
associate-+l+90.7%
fma-def90.7%
sub-neg90.7%
metadata-eval90.7%
sub-neg90.7%
log1p-def99.8%
sub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (+ (* (log y) (+ -1.0 x)) (* -0.5 (* (+ z -1.0) (pow y 2.0)))) (* y (- 1.0 z))) t))
double code(double x, double y, double z, double t) {
return (((log(y) * (-1.0 + x)) + (-0.5 * ((z + -1.0) * pow(y, 2.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) * ((-1.0d0) + x)) + ((-0.5d0) * ((z + (-1.0d0)) * (y ** 2.0d0)))) + (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)) + (-0.5 * ((z + -1.0) * Math.pow(y, 2.0)))) + (y * (1.0 - z))) - t;
}
def code(x, y, z, t): return (((math.log(y) * (-1.0 + x)) + (-0.5 * ((z + -1.0) * math.pow(y, 2.0)))) + (y * (1.0 - z))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(-0.5 * Float64(Float64(z + -1.0) * (y ^ 2.0)))) + Float64(y * Float64(1.0 - z))) - t) end
function tmp = code(x, y, z, t) tmp = (((log(y) * (-1.0 + x)) + (-0.5 * ((z + -1.0) * (y ^ 2.0)))) + (y * (1.0 - z))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(z + -1.0), $MachinePrecision] * N[Power[y, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\log y \cdot \left(-1 + x\right) + -0.5 \cdot \left(\left(z + -1\right) \cdot {y}^{2}\right)\right) + y \cdot \left(1 - z\right)\right) - t
\end{array}
Initial program 90.7%
Taylor expanded in y around 0 99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (- (fma y (- 1.0 z) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma(y, (1.0 - z), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(fma(y, Float64(1.0 - z), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(y * 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(y, 1 - z, \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 90.7%
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%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
fma-def99.3%
sub-neg99.3%
metadata-eval99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -5000000000000.0) (not (<= (+ -1.0 x) -0.99999999999))) (- (* (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) <= -5000000000000.0) || !((-1.0 + x) <= -0.99999999999)) {
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) <= (-5000000000000.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.99999999999d0)))) 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) <= -5000000000000.0) || !((-1.0 + x) <= -0.99999999999)) {
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) <= -5000000000000.0) or not ((-1.0 + x) <= -0.99999999999): 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) <= -5000000000000.0) || !(Float64(-1.0 + x) <= -0.99999999999)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(y * Float64(1.0 - z)) - Float64(log(y) + t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -5000000000000.0) || ~(((-1.0 + x) <= -0.99999999999))) 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], -5000000000000.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.99999999999]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[(N[Log[y], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5000000000000 \lor \neg \left(-1 + x \leq -0.99999999999\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - \left(\log y + t\right)\\
\end{array}
\end{array}
if (-.f64 x 1) < -5e12 or -0.99999999999 < (-.f64 x 1) Initial program 96.5%
Taylor expanded in y around 0 96.5%
if -5e12 < (-.f64 x 1) < -0.99999999999Initial program 84.9%
sub-neg84.9%
+-commutative84.9%
associate-+l+84.9%
fma-def84.9%
sub-neg84.9%
metadata-eval84.9%
sub-neg84.9%
log1p-def100.0%
sub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 98.4%
mul-1-neg98.4%
unsub-neg98.4%
mul-1-neg98.4%
distribute-rgt-neg-in98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
+-commutative98.4%
Simplified98.4%
Final simplification97.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (- 1.0 z))))
(if (<= (+ -1.0 x) -5000000000000.0)
(- (+ (* x (log y)) t_1) t)
(if (<= (+ -1.0 x) -0.99999999999)
(- t_1 (+ (log y) t))
(- (* (log y) (+ -1.0 x)) t)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (1.0 - z);
double tmp;
if ((-1.0 + x) <= -5000000000000.0) {
tmp = ((x * log(y)) + t_1) - t;
} else if ((-1.0 + x) <= -0.99999999999) {
tmp = t_1 - (log(y) + t);
} else {
tmp = (log(y) * (-1.0 + x)) - 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) :: t_1
real(8) :: tmp
t_1 = y * (1.0d0 - z)
if (((-1.0d0) + x) <= (-5000000000000.0d0)) then
tmp = ((x * log(y)) + t_1) - t
else if (((-1.0d0) + x) <= (-0.99999999999d0)) then
tmp = t_1 - (log(y) + t)
else
tmp = (log(y) * ((-1.0d0) + x)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (1.0 - z);
double tmp;
if ((-1.0 + x) <= -5000000000000.0) {
tmp = ((x * Math.log(y)) + t_1) - t;
} else if ((-1.0 + x) <= -0.99999999999) {
tmp = t_1 - (Math.log(y) + t);
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (1.0 - z) tmp = 0 if (-1.0 + x) <= -5000000000000.0: tmp = ((x * math.log(y)) + t_1) - t elif (-1.0 + x) <= -0.99999999999: tmp = t_1 - (math.log(y) + t) else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(1.0 - z)) tmp = 0.0 if (Float64(-1.0 + x) <= -5000000000000.0) tmp = Float64(Float64(Float64(x * log(y)) + t_1) - t); elseif (Float64(-1.0 + x) <= -0.99999999999) tmp = Float64(t_1 - Float64(log(y) + t)); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (1.0 - z); tmp = 0.0; if ((-1.0 + x) <= -5000000000000.0) tmp = ((x * log(y)) + t_1) - t; elseif ((-1.0 + x) <= -0.99999999999) tmp = t_1 - (log(y) + t); else tmp = (log(y) * (-1.0 + x)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(-1.0 + x), $MachinePrecision], -5000000000000.0], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.99999999999], N[(t$95$1 - N[(N[Log[y], $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(1 - z\right)\\
\mathbf{if}\;-1 + x \leq -5000000000000:\\
\;\;\;\;\left(x \cdot \log y + t_1\right) - t\\
\mathbf{elif}\;-1 + x \leq -0.99999999999:\\
\;\;\;\;t_1 - \left(\log y + t\right)\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -5e12Initial program 95.6%
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%
+-commutative99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified99.6%
Taylor expanded in x around inf 99.2%
*-commutative99.2%
Simplified99.2%
if -5e12 < (-.f64 x 1) < -0.99999999999Initial program 84.9%
sub-neg84.9%
+-commutative84.9%
associate-+l+84.9%
fma-def84.9%
sub-neg84.9%
metadata-eval84.9%
sub-neg84.9%
log1p-def100.0%
sub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 99.5%
mul-1-neg99.5%
Simplified99.5%
Taylor expanded in y around 0 98.4%
mul-1-neg98.4%
unsub-neg98.4%
mul-1-neg98.4%
distribute-rgt-neg-in98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
+-commutative98.4%
Simplified98.4%
if -0.99999999999 < (-.f64 x 1) Initial program 97.3%
Taylor expanded in y around 0 97.3%
Final simplification98.3%
(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 90.7%
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%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (if (<= (+ z -1.0) 1e+178) (- (* (log y) (+ -1.0 x)) t) (- (fma y z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z + -1.0) <= 1e+178) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = -fma(y, z, t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z + -1.0) <= 1e+178) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(-fma(y, z, t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z + -1.0), $MachinePrecision], 1e+178], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], (-N[(y * z + t), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z + -1 \leq 10^{+178}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(y, z, t\right)\\
\end{array}
\end{array}
if (-.f64 z 1) < 1.0000000000000001e178Initial program 93.6%
Taylor expanded in y around 0 92.6%
if 1.0000000000000001e178 < (-.f64 z 1) Initial program 62.9%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
*-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 86.5%
mul-1-neg86.5%
distribute-rgt-neg-in86.5%
Simplified86.5%
Taylor expanded in y around 0 86.5%
neg-mul-186.5%
+-commutative86.5%
mul-1-neg86.5%
distribute-neg-in86.5%
fma-udef86.6%
Simplified86.6%
Final simplification92.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.07) (not (<= x 1.0))) (- (* x (log y)) t) (- (- t) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.07) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = -t - log(y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-0.07d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = -t - log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.07) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -t - Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.07) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = -t - math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.07) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-t) - log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.07) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = -t - log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.07], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.07 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-t\right) - \log y\\
\end{array}
\end{array}
if x < -0.070000000000000007 or 1 < x Initial program 95.0%
Taylor expanded in y around 0 95.0%
Taylor expanded in x around inf 92.1%
if -0.070000000000000007 < x < 1Initial program 86.4%
sub-neg86.4%
+-commutative86.4%
associate-+l+86.4%
fma-def86.4%
sub-neg86.4%
metadata-eval86.4%
sub-neg86.4%
log1p-def100.0%
sub-neg100.0%
sub-neg100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 98.5%
mul-1-neg98.5%
Simplified98.5%
Taylor expanded in y around 0 83.2%
mul-1-neg83.2%
distribute-neg-in83.2%
+-commutative83.2%
sub-neg83.2%
Simplified83.2%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -0.07) (not (<= x 1.0))) (- (* x (log y)) t) (- (- y (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.07) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y - 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 ((x <= (-0.07d0)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = (y - log(y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.07) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -0.07) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = (y - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.07) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -0.07) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = (y - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.07], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.07 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\end{array}
\end{array}
if x < -0.070000000000000007 or 1 < x Initial program 95.0%
Taylor expanded in y around 0 95.0%
Taylor expanded in x around inf 92.1%
if -0.070000000000000007 < x < 1Initial program 86.4%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
*-commutative98.9%
mul-1-neg98.9%
unsub-neg98.9%
*-commutative98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in x around 0 97.4%
sub-neg97.4%
mul-1-neg97.4%
distribute-lft-in97.4%
mul-1-neg97.4%
+-commutative97.4%
fma-def97.4%
sub-neg97.4%
metadata-eval97.4%
+-commutative97.4%
Simplified97.4%
Taylor expanded in z around 0 83.4%
neg-mul-183.4%
unsub-neg83.4%
Simplified83.4%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (<= z -2.6e+166) (- (* z (- y)) t) (if (<= z 8.2e+177) (- (- t) (log y)) (- (fma y z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.6e+166) {
tmp = (z * -y) - t;
} else if (z <= 8.2e+177) {
tmp = -t - log(y);
} else {
tmp = -fma(y, z, t);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -2.6e+166) tmp = Float64(Float64(z * Float64(-y)) - t); elseif (z <= 8.2e+177) tmp = Float64(Float64(-t) - log(y)); else tmp = Float64(-fma(y, z, t)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.6e+166], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 8.2e+177], N[((-t) - N[Log[y], $MachinePrecision]), $MachinePrecision], (-N[(y * z + t), $MachinePrecision])]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{+166}:\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+177}:\\
\;\;\;\;\left(-t\right) - \log y\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(y, z, t\right)\\
\end{array}
\end{array}
if z < -2.5999999999999999e166Initial program 73.5%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
*-commutative99.9%
mul-1-neg99.9%
unsub-neg99.9%
*-commutative99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 59.7%
mul-1-neg59.7%
distribute-rgt-neg-in59.7%
Simplified59.7%
if -2.5999999999999999e166 < z < 8.20000000000000029e177Initial program 96.8%
sub-neg96.8%
+-commutative96.8%
associate-+l+96.8%
fma-def96.8%
sub-neg96.8%
metadata-eval96.8%
sub-neg96.8%
log1p-def99.8%
sub-neg99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 59.5%
mul-1-neg59.5%
Simplified59.5%
Taylor expanded in y around 0 55.6%
mul-1-neg55.6%
distribute-neg-in55.6%
+-commutative55.6%
sub-neg55.6%
Simplified55.6%
if 8.20000000000000029e177 < z Initial program 62.9%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
*-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 86.5%
mul-1-neg86.5%
distribute-rgt-neg-in86.5%
Simplified86.5%
Taylor expanded in y around 0 86.5%
neg-mul-186.5%
+-commutative86.5%
mul-1-neg86.5%
distribute-neg-in86.5%
fma-udef86.6%
Simplified86.6%
Final simplification59.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.15e-19) (not (<= t 4.9e+29))) (- t) (* y (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.15e-19) || !(t <= 4.9e+29)) {
tmp = -t;
} else {
tmp = y * (1.0 - 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 <= (-2.15d-19)) .or. (.not. (t <= 4.9d+29))) then
tmp = -t
else
tmp = y * (1.0d0 - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.15e-19) || !(t <= 4.9e+29)) {
tmp = -t;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.15e-19) or not (t <= 4.9e+29): tmp = -t else: tmp = y * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.15e-19) || !(t <= 4.9e+29)) tmp = Float64(-t); else tmp = Float64(y * Float64(1.0 - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.15e-19) || ~((t <= 4.9e+29))) tmp = -t; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.15e-19], N[Not[LessEqual[t, 4.9e+29]], $MachinePrecision]], (-t), N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{-19} \lor \neg \left(t \leq 4.9 \cdot 10^{+29}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if t < -2.15e-19 or 4.9000000000000001e29 < t Initial program 97.8%
Taylor expanded in t around inf 68.4%
neg-mul-168.4%
Simplified68.4%
if -2.15e-19 < t < 4.9000000000000001e29Initial program 84.1%
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%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in y around 0 98.7%
fma-def98.7%
sub-neg98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in y around inf 17.6%
Final simplification42.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2.5e-19) (- (* z y) t) (if (<= t 4.7e+29) (* y (- 1.0 z)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.5e-19) {
tmp = (z * y) - t;
} else if (t <= 4.7e+29) {
tmp = y * (1.0 - 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 <= (-2.5d-19)) then
tmp = (z * y) - t
else if (t <= 4.7d+29) then
tmp = y * (1.0d0 - 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 <= -2.5e-19) {
tmp = (z * y) - t;
} else if (t <= 4.7e+29) {
tmp = y * (1.0 - z);
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.5e-19: tmp = (z * y) - t elif t <= 4.7e+29: tmp = y * (1.0 - z) else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.5e-19) tmp = Float64(Float64(z * y) - t); elseif (t <= 4.7e+29) tmp = Float64(y * Float64(1.0 - z)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.5e-19) tmp = (z * y) - t; elseif (t <= 4.7e+29) tmp = y * (1.0 - z); else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.5e-19], N[(N[(z * y), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t, 4.7e+29], N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{-19}:\\
\;\;\;\;z \cdot y - t\\
\mathbf{elif}\;t \leq 4.7 \cdot 10^{+29}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -2.5000000000000002e-19Initial program 98.3%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
*-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
*-commutative99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 70.4%
mul-1-neg70.4%
distribute-rgt-neg-in70.4%
Simplified70.4%
sub-neg70.4%
add-sqr-sqrt41.9%
add-sqr-sqrt70.4%
add-sqr-sqrt34.4%
sqrt-unprod54.1%
sqr-neg54.1%
sqrt-unprod34.6%
add-sqr-sqrt69.0%
Applied egg-rr69.0%
sub-neg69.0%
Simplified69.0%
if -2.5000000000000002e-19 < t < 4.7000000000000002e29Initial program 84.1%
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%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in y around 0 98.7%
fma-def98.7%
sub-neg98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in y around inf 17.6%
if 4.7000000000000002e29 < t Initial program 97.2%
Taylor expanded in t around inf 67.6%
neg-mul-167.6%
Simplified67.6%
Final simplification42.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.7e-19) (not (<= t 4.7e+29))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.7e-19) || !(t <= 4.7e+29)) {
tmp = -t;
} else {
tmp = 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 ((t <= (-1.7d-19)) .or. (.not. (t <= 4.7d+29))) then
tmp = -t
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.7e-19) || !(t <= 4.7e+29)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.7e-19) or not (t <= 4.7e+29): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.7e-19) || !(t <= 4.7e+29)) tmp = Float64(-t); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.7e-19) || ~((t <= 4.7e+29))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.7e-19], N[Not[LessEqual[t, 4.7e+29]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{-19} \lor \neg \left(t \leq 4.7 \cdot 10^{+29}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -1.7000000000000001e-19 or 4.7000000000000002e29 < t Initial program 97.8%
Taylor expanded in t around inf 68.4%
neg-mul-168.4%
Simplified68.4%
if -1.7000000000000001e-19 < t < 4.7000000000000002e29Initial program 84.1%
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%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in y around 0 98.7%
fma-def98.7%
sub-neg98.7%
metadata-eval98.7%
Simplified98.7%
Taylor expanded in z around inf 17.0%
associate-*r*17.0%
neg-mul-117.0%
Simplified17.0%
Final simplification41.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 90.7%
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%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around inf 43.2%
Final simplification43.2%
(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 90.7%
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%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in z around inf 43.1%
mul-1-neg43.1%
distribute-rgt-neg-in43.1%
Simplified43.1%
Final simplification43.1%
(FPCore (x y z t) :precision binary64 (- t))
double code(double x, double y, double z, double t) {
return -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = -t
end function
public static double code(double x, double y, double z, double t) {
return -t;
}
def code(x, y, z, t): return -t
function code(x, y, z, t) return Float64(-t) end
function tmp = code(x, y, z, t) tmp = -t; end
code[x_, y_, z_, t_] := (-t)
\begin{array}{l}
\\
-t
\end{array}
Initial program 90.7%
Taylor expanded in t around inf 34.7%
neg-mul-134.7%
Simplified34.7%
Final simplification34.7%
herbie shell --seed 2023320
(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))