
(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 (+ x -1.0) (log y) (* (log1p (- y)) (+ -1.0 z))) t))
double code(double x, double y, double z, double t) {
return fma((x + -1.0), log(y), (log1p(-y) * (-1.0 + z))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(x + -1.0), log(y), Float64(log1p(Float64(-y)) * Float64(-1.0 + z))) - 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[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x + -1, \log y, \mathsf{log1p}\left(-y\right) \cdot \left(-1 + z\right)\right) - t
\end{array}
Initial program 90.4%
fma-define90.4%
sub-neg90.4%
metadata-eval90.4%
sub-neg90.4%
metadata-eval90.4%
sub-neg90.4%
log1p-define99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (+ x -1.0) (log y))
(*
y
(+
(*
y
(+
(* (+ -1.0 z) -0.5)
(*
y
(+ (* (+ -1.0 z) -0.3333333333333333) (* -0.25 (* y (+ -1.0 z)))))))
(- 1.0 z))))
t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + (y * ((y * (((-1.0 + z) * -0.5) + (y * (((-1.0 + z) * -0.3333333333333333) + (-0.25 * (y * (-1.0 + z))))))) + (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 = (((x + (-1.0d0)) * log(y)) + (y * ((y * ((((-1.0d0) + z) * (-0.5d0)) + (y * ((((-1.0d0) + z) * (-0.3333333333333333d0)) + ((-0.25d0) * (y * ((-1.0d0) + z))))))) + (1.0d0 - z)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + (y * ((y * (((-1.0 + z) * -0.5) + (y * (((-1.0 + z) * -0.3333333333333333) + (-0.25 * (y * (-1.0 + z))))))) + (1.0 - z)))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + (y * ((y * (((-1.0 + z) * -0.5) + (y * (((-1.0 + z) * -0.3333333333333333) + (-0.25 * (y * (-1.0 + z))))))) + (1.0 - z)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(y * Float64(Float64(y * Float64(Float64(Float64(-1.0 + z) * -0.5) + Float64(y * Float64(Float64(Float64(-1.0 + z) * -0.3333333333333333) + Float64(-0.25 * Float64(y * Float64(-1.0 + z))))))) + Float64(1.0 - z)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + (y * ((y * (((-1.0 + z) * -0.5) + (y * (((-1.0 + z) * -0.3333333333333333) + (-0.25 * (y * (-1.0 + z))))))) + (1.0 - z)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(y * N[(N[(y * N[(N[(N[(-1.0 + z), $MachinePrecision] * -0.5), $MachinePrecision] + N[(y * N[(N[(N[(-1.0 + z), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] + N[(-0.25 * N[(y * N[(-1.0 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + y \cdot \left(y \cdot \left(\left(-1 + z\right) \cdot -0.5 + y \cdot \left(\left(-1 + z\right) \cdot -0.3333333333333333 + -0.25 \cdot \left(y \cdot \left(-1 + z\right)\right)\right)\right) + \left(1 - z\right)\right)\right) - t
\end{array}
Initial program 90.4%
Taylor expanded in y around 0 99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (+ x -1.0) (log y))
(*
(+ -1.0 z)
(* y (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5))))))
t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((-1.0 + z) * (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 = (((x + (-1.0d0)) * log(y)) + (((-1.0d0) + z) * (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 (((x + -1.0) * Math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(-1.0 + z) * 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 = (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 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] * 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(x + -1\right) \cdot \log y + \left(-1 + z\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 90.4%
Taylor expanded in y around 0 99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ x -1.0) -200000.0) (not (<= (+ x -1.0) -1.0))) (- (* (+ x -1.0) (log y)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x + -1.0) <= -200000.0) || !((x + -1.0) <= -1.0)) {
tmp = ((x + -1.0) * log(y)) - 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 (((x + (-1.0d0)) <= (-200000.0d0)) .or. (.not. ((x + (-1.0d0)) <= (-1.0d0)))) then
tmp = ((x + (-1.0d0)) * log(y)) - 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 (((x + -1.0) <= -200000.0) || !((x + -1.0) <= -1.0)) {
tmp = ((x + -1.0) * Math.log(y)) - t;
} else {
tmp = ((y * (1.0 - z)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x + -1.0) <= -200000.0) or not ((x + -1.0) <= -1.0): tmp = ((x + -1.0) * math.log(y)) - t else: tmp = ((y * (1.0 - z)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x + -1.0) <= -200000.0) || !(Float64(x + -1.0) <= -1.0)) tmp = Float64(Float64(Float64(x + -1.0) * log(y)) - t); else tmp = Float64(Float64(Float64(y * Float64(1.0 - z)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x + -1.0) <= -200000.0) || ~(((x + -1.0) <= -1.0))) tmp = ((x + -1.0) * log(y)) - t; else tmp = ((y * (1.0 - z)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x + -1.0), $MachinePrecision], -200000.0], N[Not[LessEqual[N[(x + -1.0), $MachinePrecision], -1.0]], $MachinePrecision]], N[(N[(N[(x + -1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x + -1 \leq -200000 \lor \neg \left(x + -1 \leq -1\right):\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot \left(1 - z\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -2e5 or -1 < (-.f64 x #s(literal 1 binary64)) Initial program 92.4%
fma-define92.4%
sub-neg92.4%
metadata-eval92.4%
sub-neg92.4%
metadata-eval92.4%
sub-neg92.4%
log1p-define99.7%
Simplified99.7%
Taylor expanded in y around 0 91.1%
if -2e5 < (-.f64 x #s(literal 1 binary64)) < -1Initial program 88.5%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
fma-define99.7%
mul-1-neg99.7%
fma-neg99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 99.4%
mul-1-neg99.4%
Simplified99.4%
Final simplification95.5%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* (+ -1.0 z) (* y (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5)))))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((-1.0 + z) * (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 = (((x + (-1.0d0)) * log(y)) + (((-1.0d0) + z) * (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 (((x + -1.0) * Math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5)))))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 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] * 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(x + -1\right) \cdot \log y + \left(-1 + z\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 90.4%
Taylor expanded in y around 0 99.6%
Final simplification99.6%
(FPCore (x y z t) :precision binary64 (- (+ (* (+ x -1.0) (log y)) (* (+ -1.0 z) (* y (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return (((x + -1.0) * log(y)) + ((-1.0 + z) * (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 = (((x + (-1.0d0)) * log(y)) + (((-1.0d0) + z) * (y * ((-1.0d0) + (y * (-0.5d0)))))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x + -1.0) * Math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return (((x + -1.0) * math.log(y)) + ((-1.0 + z) * (y * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x + -1.0) * log(y)) + Float64(Float64(-1.0 + z) * Float64(y * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = (((x + -1.0) * log(y)) + ((-1.0 + z) * (y * (-1.0 + (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] * N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x + -1\right) \cdot \log y + \left(-1 + z\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 90.4%
Taylor expanded in y around 0 99.4%
Final simplification99.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2700.0) (not (<= x 1.85e+28))) (- (* x (log y)) t) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2700.0) || !(x <= 1.85e+28)) {
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 <= (-2700.0d0)) .or. (.not. (x <= 1.85d+28))) 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 <= -2700.0) || !(x <= 1.85e+28)) {
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 <= -2700.0) or not (x <= 1.85e+28): 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 <= -2700.0) || !(x <= 1.85e+28)) 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 <= -2700.0) || ~((x <= 1.85e+28))) 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, -2700.0], N[Not[LessEqual[x, 1.85e+28]], $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 -2700 \lor \neg \left(x \leq 1.85 \cdot 10^{+28}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if x < -2700 or 1.85e28 < x Initial program 93.0%
fma-define93.0%
sub-neg93.0%
metadata-eval93.0%
sub-neg93.0%
metadata-eval93.0%
sub-neg93.0%
log1p-define99.6%
Simplified99.6%
Taylor expanded in t around inf 72.1%
Taylor expanded in x around inf 71.4%
associate-/l*71.4%
Simplified71.4%
Taylor expanded in y around 0 70.0%
Taylor expanded in t around 0 90.9%
neg-mul-190.9%
+-commutative90.9%
unsub-neg90.9%
*-commutative90.9%
Simplified90.9%
if -2700 < x < 1.85e28Initial program 88.2%
Taylor expanded in y around 0 99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
fma-define99.7%
mul-1-neg99.7%
fma-neg99.7%
+-commutative99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 62.3%
Final simplification75.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.15e+19) (not (<= x 4.7e+105))) (* x (log y)) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.15e+19) || !(x <= 4.7e+105)) {
tmp = x * log(y);
} 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.15d+19)) .or. (.not. (x <= 4.7d+105))) then
tmp = x * log(y)
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.15e+19) || !(x <= 4.7e+105)) {
tmp = x * Math.log(y);
} else {
tmp = (y * (1.0 - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.15e+19) or not (x <= 4.7e+105): tmp = x * math.log(y) else: tmp = (y * (1.0 - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.15e+19) || !(x <= 4.7e+105)) tmp = Float64(x * log(y)); 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.15e+19) || ~((x <= 4.7e+105))) tmp = x * log(y); else tmp = (y * (1.0 - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.15e+19], N[Not[LessEqual[x, 4.7e+105]], $MachinePrecision]], N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+19} \lor \neg \left(x \leq 4.7 \cdot 10^{+105}\right):\\
\;\;\;\;x \cdot \log y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if x < -1.15e19 or 4.70000000000000004e105 < x Initial program 93.9%
fma-define93.9%
sub-neg93.9%
metadata-eval93.9%
sub-neg93.9%
metadata-eval93.9%
sub-neg93.9%
log1p-define99.6%
Simplified99.6%
Taylor expanded in t around inf 69.9%
Taylor expanded in x around inf 75.5%
*-commutative75.5%
Simplified75.5%
if -1.15e19 < x < 4.70000000000000004e105Initial program 88.2%
Taylor expanded in y around 0 99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
fma-define99.3%
mul-1-neg99.3%
fma-neg99.3%
+-commutative99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
Taylor expanded in y around inf 62.3%
Final simplification67.3%
(FPCore (x y z t) :precision binary64 (if (<= y 8e-37) (- (* (+ x -1.0) (log y)) t) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= 8e-37) {
tmp = ((x + -1.0) * 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 (y <= 8d-37) then
tmp = ((x + (-1.0d0)) * 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 (y <= 8e-37) {
tmp = ((x + -1.0) * Math.log(y)) - t;
} else {
tmp = (y * (1.0 - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= 8e-37: tmp = ((x + -1.0) * math.log(y)) - t else: tmp = (y * (1.0 - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= 8e-37) tmp = Float64(Float64(Float64(x + -1.0) * 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 (y <= 8e-37) tmp = ((x + -1.0) * log(y)) - t; else tmp = (y * (1.0 - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, 8e-37], N[(N[(N[(x + -1.0), $MachinePrecision] * 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}\;y \leq 8 \cdot 10^{-37}:\\
\;\;\;\;\left(x + -1\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if y < 8.00000000000000053e-37Initial program 93.3%
fma-define93.3%
sub-neg93.3%
metadata-eval93.3%
sub-neg93.3%
metadata-eval93.3%
sub-neg93.3%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 93.3%
if 8.00000000000000053e-37 < y Initial program 64.4%
Taylor expanded in y around 0 93.3%
+-commutative93.3%
sub-neg93.3%
metadata-eval93.3%
fma-define93.3%
mul-1-neg93.3%
fma-neg93.3%
+-commutative93.3%
sub-neg93.3%
metadata-eval93.3%
+-commutative93.3%
Simplified93.3%
Taylor expanded in y around inf 73.7%
Final simplification91.3%
(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 90.4%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
fma-define99.2%
mul-1-neg99.2%
fma-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in z around inf 99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6600000.0) (not (<= t 2100000.0))) (- t) (* y (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6600000.0) || !(t <= 2100000.0)) {
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 <= (-6600000.0d0)) .or. (.not. (t <= 2100000.0d0))) 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 <= -6600000.0) || !(t <= 2100000.0)) {
tmp = -t;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6600000.0) or not (t <= 2100000.0): tmp = -t else: tmp = y * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6600000.0) || !(t <= 2100000.0)) 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 <= -6600000.0) || ~((t <= 2100000.0))) tmp = -t; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6600000.0], N[Not[LessEqual[t, 2100000.0]], $MachinePrecision]], (-t), N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6600000 \lor \neg \left(t \leq 2100000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if t < -6.6e6 or 2.1e6 < t Initial program 95.8%
fma-define95.8%
sub-neg95.8%
metadata-eval95.8%
sub-neg95.8%
metadata-eval95.8%
sub-neg95.8%
log1p-define99.9%
Simplified99.9%
Taylor expanded in t around inf 75.2%
neg-mul-175.2%
Simplified75.2%
if -6.6e6 < t < 2.1e6Initial program 85.0%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
fma-define99.4%
mul-1-neg99.4%
fma-neg99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around 0 99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around inf 17.6%
Final simplification46.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -22000000.0) (not (<= t 1600000000.0))) (- t) (* y (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -22000000.0) || !(t <= 1600000000.0)) {
tmp = -t;
} else {
tmp = y * -z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-22000000.0d0)) .or. (.not. (t <= 1600000000.0d0))) then
tmp = -t
else
tmp = y * -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -22000000.0) || !(t <= 1600000000.0)) {
tmp = -t;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -22000000.0) or not (t <= 1600000000.0): tmp = -t else: tmp = y * -z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -22000000.0) || !(t <= 1600000000.0)) tmp = Float64(-t); else tmp = Float64(y * Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -22000000.0) || ~((t <= 1600000000.0))) tmp = -t; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -22000000.0], N[Not[LessEqual[t, 1600000000.0]], $MachinePrecision]], (-t), N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -22000000 \lor \neg \left(t \leq 1600000000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if t < -2.2e7 or 1.6e9 < t Initial program 95.8%
fma-define95.8%
sub-neg95.8%
metadata-eval95.8%
sub-neg95.8%
metadata-eval95.8%
sub-neg95.8%
log1p-define99.9%
Simplified99.9%
Taylor expanded in t around inf 75.2%
neg-mul-175.2%
Simplified75.2%
if -2.2e7 < t < 1.6e9Initial program 85.0%
Taylor expanded in y around 0 99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
fma-define99.4%
mul-1-neg99.4%
fma-neg99.4%
+-commutative99.4%
sub-neg99.4%
metadata-eval99.4%
+-commutative99.4%
Simplified99.4%
Taylor expanded in y around 0 99.4%
fma-define99.4%
sub-neg99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around inf 17.0%
mul-1-neg17.0%
distribute-rgt-neg-out17.0%
Simplified17.0%
Final simplification45.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.4%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
fma-define99.2%
mul-1-neg99.2%
fma-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around inf 48.4%
Final simplification48.4%
(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\right) - y \cdot z
\end{array}
Initial program 90.4%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
fma-define99.2%
mul-1-neg99.2%
fma-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in z around inf 48.2%
mul-1-neg48.2%
distribute-rgt-neg-in48.2%
Simplified48.2%
Final simplification48.2%
(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.4%
fma-define90.4%
sub-neg90.4%
metadata-eval90.4%
sub-neg90.4%
metadata-eval90.4%
sub-neg90.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in t around inf 38.7%
neg-mul-138.7%
Simplified38.7%
Final simplification38.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 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.4%
fma-define90.4%
sub-neg90.4%
metadata-eval90.4%
sub-neg90.4%
metadata-eval90.4%
sub-neg90.4%
log1p-define99.8%
Simplified99.8%
Taylor expanded in x around inf 77.9%
Taylor expanded in t around inf 26.3%
neg-mul-126.3%
distribute-frac-neg226.3%
Simplified26.3%
associate-*r/33.4%
add-sqr-sqrt18.7%
sqrt-unprod13.6%
sqr-neg13.6%
sqrt-unprod1.1%
add-sqr-sqrt2.4%
Applied egg-rr2.4%
associate-*r/2.3%
Simplified2.3%
Taylor expanded in x around 0 2.4%
Final simplification2.4%
herbie shell --seed 2024059
(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))