
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (+ z -1.0) (log1p (- y)) (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.4%
sub-neg87.4%
+-commutative87.4%
associate-+l+87.4%
fma-define87.4%
sub-neg87.4%
metadata-eval87.4%
sub-neg87.4%
log1p-define99.8%
fma-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (fma (+ z -1.0) (log1p (- y)) (* (+ -1.0 x) (log y))) t))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), ((-1.0 + x) * log(y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(Float64(-1.0 + x) * log(y))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \left(-1 + x\right) \cdot \log y\right) - t
\end{array}
Initial program 87.4%
+-commutative87.4%
fma-define87.4%
sub-neg87.4%
metadata-eval87.4%
sub-neg87.4%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (+ -1.0 x) (log y))
(*
(+ z -1.0)
(* y (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5))))))
t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * log(y)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((-1.0d0) + x) * log(y)) + ((z + (-1.0d0)) * (y * ((-1.0d0) + (y * ((y * ((y * (-0.25d0)) - 0.3333333333333333d0)) - 0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((-1.0 + x) * Math.log(y)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) + Float64(Float64(z + -1.0) * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * Float64(Float64(y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * N[(N[(y * N[(N[(y * -0.25), $MachinePrecision] - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y + \left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right)\right) - t
\end{array}
Initial program 87.4%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ -1.0 x) (log y)) (* (+ z -1.0) (* y (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5)))))) t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * log(y)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((-1.0d0) + x) * log(y)) + ((z + (-1.0d0)) * (y * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((-1.0 + x) * Math.log(y)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) + Float64(Float64(z + -1.0) * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5)))))) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y + \left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right)\right) - t
\end{array}
Initial program 87.4%
Taylor expanded in y around 0 99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ -1.0 x) (log y)) (* (+ z -1.0) (* y (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * log(y)) + ((z + -1.0) * (y * (-1.0 + (y * -0.5))))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((-1.0d0) + x) * log(y)) + ((z + (-1.0d0)) * (y * ((-1.0d0) + (y * (-0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((-1.0 + x) * Math.log(y)) + ((z + -1.0) * (y * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) + ((z + -1.0) * (y * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) + Float64(Float64(z + -1.0) * Float64(y * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) + ((z + -1.0) * (y * (-1.0 + (y * -0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y + \left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 87.4%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.5e+195)
(- (* z (log1p (- y))) t)
(if (<= z 1.2e+180)
(- (* (+ -1.0 x) (log y)) t)
(- (* y (* z (+ -1.0 (* y -0.5)))) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+195) {
tmp = (z * log1p(-y)) - t;
} else if (z <= 1.2e+180) {
tmp = ((-1.0 + x) * log(y)) - t;
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+195) {
tmp = (z * Math.log1p(-y)) - t;
} else if (z <= 1.2e+180) {
tmp = ((-1.0 + x) * Math.log(y)) - t;
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.5e+195: tmp = (z * math.log1p(-y)) - t elif z <= 1.2e+180: tmp = ((-1.0 + x) * math.log(y)) - t else: tmp = (y * (z * (-1.0 + (y * -0.5)))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e+195) tmp = Float64(Float64(z * log1p(Float64(-y))) - t); elseif (z <= 1.2e+180) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+195], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[z, 1.2e+180], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+195}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+180}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if z < -5.49999999999999994e195Initial program 58.6%
add-sqr-sqrt9.0%
pow29.0%
sub-neg9.0%
metadata-eval9.0%
Applied egg-rr9.0%
Taylor expanded in z around inf 44.9%
sub-neg44.9%
log1p-undefine86.9%
Simplified86.9%
if -5.49999999999999994e195 < z < 1.1999999999999999e180Initial program 95.3%
+-commutative95.3%
fma-define95.3%
sub-neg95.3%
metadata-eval95.3%
sub-neg95.3%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 94.4%
if 1.1999999999999999e180 < z Initial program 48.4%
Taylor expanded in y around 0 99.8%
Taylor expanded in z around inf 99.9%
Taylor expanded in z around inf 75.9%
Final simplification91.9%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ -1.0 x) (log y)) (* y (* z (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * log(y)) + (y * (z * (-1.0 + (y * -0.5))))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((-1.0d0) + x) * log(y)) + (y * (z * ((-1.0d0) + (y * (-0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((-1.0 + x) * Math.log(y)) + (y * (z * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) + (y * (z * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) + Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) + (y * (z * (-1.0 + (y * -0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y + y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 87.4%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around inf 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -250000000000.0) (not (<= t 1.52e+38))) (- (* y (* z (+ -1.0 (* y -0.5)))) t) (* (+ -1.0 x) (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -250000000000.0) || !(t <= 1.52e+38)) {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
} else {
tmp = (-1.0 + x) * 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 ((t <= (-250000000000.0d0)) .or. (.not. (t <= 1.52d+38))) then
tmp = (y * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
else
tmp = ((-1.0d0) + x) * log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -250000000000.0) || !(t <= 1.52e+38)) {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
} else {
tmp = (-1.0 + x) * Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -250000000000.0) or not (t <= 1.52e+38): tmp = (y * (z * (-1.0 + (y * -0.5)))) - t else: tmp = (-1.0 + x) * math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -250000000000.0) || !(t <= 1.52e+38)) tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t); else tmp = Float64(Float64(-1.0 + x) * log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -250000000000.0) || ~((t <= 1.52e+38))) tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; else tmp = (-1.0 + x) * log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -250000000000.0], N[Not[LessEqual[t, 1.52e+38]], $MachinePrecision]], N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -250000000000 \lor \neg \left(t \leq 1.52 \cdot 10^{+38}\right):\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y\\
\end{array}
\end{array}
if t < -2.5e11 or 1.51999999999999996e38 < t Initial program 95.0%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around inf 99.9%
Taylor expanded in z around inf 80.6%
if -2.5e11 < t < 1.51999999999999996e38Initial program 81.5%
+-commutative81.5%
fma-define81.5%
sub-neg81.5%
metadata-eval81.5%
sub-neg81.5%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 64.1%
associate--l+64.1%
sub-neg64.1%
metadata-eval64.1%
associate-/l*64.0%
+-commutative64.0%
sub-neg64.0%
metadata-eval64.0%
associate-/l*56.3%
+-commutative56.3%
Simplified56.3%
Taylor expanded in y around 0 62.4%
Taylor expanded in t around 0 78.4%
Final simplification79.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.28e+17) (not (<= x 100000000.0))) (* x (log y)) (- (* y (* z (+ -1.0 (* y -0.5)))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.28e+17) || !(x <= 100000000.0)) {
tmp = x * log(y);
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.28d+17)) .or. (.not. (x <= 100000000.0d0))) then
tmp = x * log(y)
else
tmp = (y * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.28e+17) || !(x <= 100000000.0)) {
tmp = x * Math.log(y);
} else {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.28e+17) or not (x <= 100000000.0): tmp = x * math.log(y) else: tmp = (y * (z * (-1.0 + (y * -0.5)))) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.28e+17) || !(x <= 100000000.0)) tmp = Float64(x * log(y)); else tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.28e+17) || ~((x <= 100000000.0))) tmp = x * log(y); else tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.28e+17], N[Not[LessEqual[x, 100000000.0]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.28 \cdot 10^{+17} \lor \neg \left(x \leq 100000000\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\end{array}
\end{array}
if x < -1.28e17 or 1e8 < x Initial program 95.3%
+-commutative95.3%
fma-define95.3%
sub-neg95.3%
metadata-eval95.3%
sub-neg95.3%
log1p-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in t around inf 72.3%
associate--l+72.3%
sub-neg72.3%
metadata-eval72.3%
associate-/l*72.2%
+-commutative72.2%
sub-neg72.2%
metadata-eval72.2%
associate-/l*68.9%
+-commutative68.9%
Simplified68.9%
Taylor expanded in y around 0 72.3%
Taylor expanded in x around inf 73.3%
*-commutative73.3%
Simplified73.3%
if -1.28e17 < x < 1e8Initial program 81.6%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 63.5%
Final simplification67.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.2e-14) (not (<= t 5.2e-58))) (- (* y (* z (+ -1.0 (* y -0.5)))) t) (- (log y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.2e-14) || !(t <= 5.2e-58)) {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
} else {
tmp = -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 ((t <= (-2.2d-14)) .or. (.not. (t <= 5.2d-58))) then
tmp = (y * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
else
tmp = -log(y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.2e-14) || !(t <= 5.2e-58)) {
tmp = (y * (z * (-1.0 + (y * -0.5)))) - t;
} else {
tmp = -Math.log(y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.2e-14) or not (t <= 5.2e-58): tmp = (y * (z * (-1.0 + (y * -0.5)))) - t else: tmp = -math.log(y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.2e-14) || !(t <= 5.2e-58)) tmp = Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t); else tmp = Float64(-log(y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.2e-14) || ~((t <= 5.2e-58))) tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; else tmp = -log(y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.2e-14], N[Not[LessEqual[t, 5.2e-58]], $MachinePrecision]], N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], (-N[Log[y], $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.2 \cdot 10^{-14} \lor \neg \left(t \leq 5.2 \cdot 10^{-58}\right):\\
\;\;\;\;y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;-\log y\\
\end{array}
\end{array}
if t < -2.2000000000000001e-14 or 5.20000000000000013e-58 < t Initial program 90.2%
Taylor expanded in y around 0 99.9%
Taylor expanded in z around inf 99.9%
Taylor expanded in z around inf 71.6%
if -2.2000000000000001e-14 < t < 5.20000000000000013e-58Initial program 84.0%
+-commutative84.0%
fma-define84.0%
sub-neg84.0%
metadata-eval84.0%
sub-neg84.0%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 63.1%
associate--l+63.1%
sub-neg63.1%
metadata-eval63.1%
associate-/l*63.0%
+-commutative63.0%
sub-neg63.0%
metadata-eval63.0%
associate-/l*53.5%
+-commutative53.5%
Simplified53.5%
Taylor expanded in y around 0 61.7%
Taylor expanded in t around 0 82.5%
Taylor expanded in x around 0 43.1%
mul-1-neg43.1%
Simplified43.1%
Final simplification58.7%
(FPCore (x y z t) :precision binary64 (- (- (* (+ -1.0 x) (log y)) (* z y)) t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * log(y)) - (z * y)) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((((-1.0d0) + x) * log(y)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return (((-1.0 + x) * Math.log(y)) - (z * y)) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y - z \cdot y\right) - t
\end{array}
Initial program 87.4%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around inf 99.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%
Simplified99.3%
Final simplification99.3%
(FPCore (x y z t) :precision binary64 (- (* y (* z (+ -1.0 (* y -0.5)))) t))
double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * -0.5)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (y * (z * ((-1.0d0) + (y * (-0.5d0))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (y * (z * (-1.0 + (y * -0.5)))) - t;
}
def code(x, y, z, t): return (y * (z * (-1.0 + (y * -0.5)))) - t
function code(x, y, z, t) return Float64(Float64(y * Float64(z * Float64(-1.0 + Float64(y * -0.5)))) - t) end
function tmp = code(x, y, z, t) tmp = (y * (z * (-1.0 + (y * -0.5)))) - t; end
code[x_, y_, z_, t_] := N[(N[(y * N[(z * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(z \cdot \left(-1 + y \cdot -0.5\right)\right) - t
\end{array}
Initial program 87.4%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around inf 99.7%
Taylor expanded in z around inf 48.0%
Final simplification48.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 87.4%
+-commutative87.4%
fma-define87.4%
sub-neg87.4%
metadata-eval87.4%
sub-neg87.4%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 35.1%
mul-1-neg35.1%
Simplified35.1%
(FPCore (x y z t) :precision binary64 0.0)
double code(double x, double y, double z, double t) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t) {
return 0.0;
}
def code(x, y, z, t): return 0.0
function code(x, y, z, t) return 0.0 end
function tmp = code(x, y, z, t) tmp = 0.0; end
code[x_, y_, z_, t_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 87.4%
+-commutative87.4%
fma-define87.4%
sub-neg87.4%
metadata-eval87.4%
sub-neg87.4%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around inf 35.1%
mul-1-neg35.1%
Simplified35.1%
expm1-log1p-u15.2%
expm1-undefine15.1%
Applied egg-rr15.1%
sub-neg15.1%
log1p-undefine15.1%
rem-exp-log35.0%
unsub-neg35.0%
metadata-eval35.0%
Simplified35.0%
Taylor expanded in t around 0 2.4%
metadata-eval2.4%
Applied egg-rr2.4%
herbie shell --seed 2024186
(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))