
(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 19 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)) (* (+ -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 89.9%
+-commutative89.9%
fma-define89.9%
sub-neg89.9%
metadata-eval89.9%
sub-neg89.9%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 x) (log y) (* (+ z -1.0) (log1p (- y)))) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + x), log(y), ((z + -1.0) * log1p(-y))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + x), log(y), Float64(Float64(z + -1.0) * log1p(Float64(-y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + x, \log y, \left(z + -1\right) \cdot \mathsf{log1p}\left(-y\right)\right) - t
\end{array}
Initial program 89.9%
fma-define89.9%
sub-neg89.9%
metadata-eval89.9%
sub-neg89.9%
metadata-eval89.9%
sub-neg89.9%
log1p-define99.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 89.9%
Taylor expanded in y around 0 99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (if (or (<= (+ -1.0 x) -1.000001) (not (<= (+ -1.0 x) 2e+32))) (- (* (+ -1.0 x) (log y)) t) (- (- (* y (- 1.0 z)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -1.000001) || !((-1.0 + x) <= 2e+32)) {
tmp = ((-1.0 + x) * 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 ((((-1.0d0) + x) <= (-1.000001d0)) .or. (.not. (((-1.0d0) + x) <= 2d+32))) then
tmp = (((-1.0d0) + x) * 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 (((-1.0 + x) <= -1.000001) || !((-1.0 + x) <= 2e+32)) {
tmp = ((-1.0 + x) * 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 ((-1.0 + x) <= -1.000001) or not ((-1.0 + x) <= 2e+32): tmp = ((-1.0 + x) * 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(-1.0 + x) <= -1.000001) || !(Float64(-1.0 + x) <= 2e+32)) tmp = Float64(Float64(Float64(-1.0 + x) * 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 (((-1.0 + x) <= -1.000001) || ~(((-1.0 + x) <= 2e+32))) tmp = ((-1.0 + x) * 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[(-1.0 + x), $MachinePrecision], -1.000001], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], 2e+32]], $MachinePrecision]], N[(N[(N[(-1.0 + x), $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}\;-1 + x \leq -1.000001 \lor \neg \left(-1 + x \leq 2 \cdot 10^{+32}\right):\\
\;\;\;\;\left(-1 + x\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)) < -1.00000099999999992 or 2.00000000000000011e32 < (-.f64 x #s(literal 1 binary64)) Initial program 93.7%
Taylor expanded in y around 0 93.6%
if -1.00000099999999992 < (-.f64 x #s(literal 1 binary64)) < 2.00000000000000011e32Initial program 85.9%
Taylor expanded in y around 0 98.1%
associate--l+98.1%
associate-*r*98.1%
mul-1-neg98.1%
fma-neg98.1%
sub-neg98.1%
metadata-eval98.1%
fma-define98.1%
*-commutative98.1%
fma-define98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
sub-neg98.1%
*-commutative98.1%
+-commutative98.1%
Simplified98.1%
Taylor expanded in x around 0 97.2%
+-commutative97.2%
mul-1-neg97.2%
unsub-neg97.2%
mul-1-neg97.2%
sub-neg97.2%
metadata-eval97.2%
distribute-rgt-neg-in97.2%
+-commutative97.2%
distribute-neg-in97.2%
metadata-eval97.2%
Simplified97.2%
Final simplification95.4%
(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 89.9%
Taylor expanded in y around 0 99.0%
Final simplification99.0%
(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 89.9%
Taylor expanded in y around 0 99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.1) (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 <= -1.1) || !(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 <= (-1.1d0)) .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 <= -1.1) || !(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 <= -1.1) 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 <= -1.1) || !(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 <= -1.1) || ~((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, -1.1], 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 -1.1 \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 < -1.1000000000000001 or 1 < x Initial program 93.1%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around inf 93.0%
*-commutative93.0%
Simplified93.0%
if -1.1000000000000001 < x < 1Initial program 86.4%
Taylor expanded in y around 0 98.1%
associate--l+98.1%
associate-*r*98.1%
mul-1-neg98.1%
fma-neg98.1%
sub-neg98.1%
metadata-eval98.1%
fma-define98.1%
*-commutative98.1%
fma-define98.1%
sub-neg98.1%
metadata-eval98.1%
+-commutative98.1%
sub-neg98.1%
*-commutative98.1%
+-commutative98.1%
Simplified98.1%
Taylor expanded in z around 0 84.3%
Taylor expanded in x around 0 82.7%
neg-mul-182.7%
unsub-neg82.7%
Simplified82.7%
Final simplification88.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -5.4e+30) (not (<= x 2.7e+34))) (- (* x (log y)) t) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -5.4e+30) || !(x <= 2.7e+34)) {
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 <= (-5.4d+30)) .or. (.not. (x <= 2.7d+34))) 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 <= -5.4e+30) || !(x <= 2.7e+34)) {
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 <= -5.4e+30) or not (x <= 2.7e+34): 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 <= -5.4e+30) || !(x <= 2.7e+34)) 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 <= -5.4e+30) || ~((x <= 2.7e+34))) 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, -5.4e+30], N[Not[LessEqual[x, 2.7e+34]], $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 -5.4 \cdot 10^{+30} \lor \neg \left(x \leq 2.7 \cdot 10^{+34}\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if x < -5.3999999999999997e30 or 2.7e34 < x Initial program 94.3%
Taylor expanded in y around 0 99.7%
Taylor expanded in x around inf 94.2%
*-commutative94.2%
Simplified94.2%
if -5.3999999999999997e30 < x < 2.7e34Initial program 85.9%
Taylor expanded in y around 0 98.2%
+-commutative98.2%
sub-neg98.2%
metadata-eval98.2%
fma-define98.3%
mul-1-neg98.3%
fma-neg98.2%
+-commutative98.2%
sub-neg98.2%
metadata-eval98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in y around inf 64.6%
Final simplification78.7%
(FPCore (x y z t) :precision binary64 (if (<= z 7e+277) (- (+ y (* (+ -1.0 x) (log y))) t) (* y (- 1.0 (+ z (/ (log y) y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7e+277) {
tmp = (y + ((-1.0 + x) * log(y))) - t;
} else {
tmp = y * (1.0 - (z + (log(y) / 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 (z <= 7d+277) then
tmp = (y + (((-1.0d0) + x) * log(y))) - t
else
tmp = y * (1.0d0 - (z + (log(y) / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7e+277) {
tmp = (y + ((-1.0 + x) * Math.log(y))) - t;
} else {
tmp = y * (1.0 - (z + (Math.log(y) / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 7e+277: tmp = (y + ((-1.0 + x) * math.log(y))) - t else: tmp = y * (1.0 - (z + (math.log(y) / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 7e+277) tmp = Float64(Float64(y + Float64(Float64(-1.0 + x) * log(y))) - t); else tmp = Float64(y * Float64(1.0 - Float64(z + Float64(log(y) / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 7e+277) tmp = (y + ((-1.0 + x) * log(y))) - t; else tmp = y * (1.0 - (z + (log(y) / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 7e+277], N[(N[(y + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(y * N[(1.0 - N[(z + N[(N[Log[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7 \cdot 10^{+277}:\\
\;\;\;\;\left(y + \left(-1 + x\right) \cdot \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \left(z + \frac{\log y}{y}\right)\right)\\
\end{array}
\end{array}
if z < 7.0000000000000002e277Initial program 91.6%
Taylor expanded in y around 0 98.9%
associate--l+98.9%
associate-*r*98.9%
mul-1-neg98.9%
fma-neg98.9%
sub-neg98.9%
metadata-eval98.9%
fma-define98.9%
*-commutative98.9%
fma-define98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
sub-neg98.9%
*-commutative98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in z around 0 90.6%
if 7.0000000000000002e277 < z Initial program 17.3%
Taylor expanded in y around 0 99.7%
associate--l+99.7%
associate-*r*99.7%
mul-1-neg99.7%
fma-neg99.7%
sub-neg99.7%
metadata-eval99.7%
fma-define99.7%
*-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
sub-neg99.7%
*-commutative99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 100.0%
Taylor expanded in t around 0 100.0%
distribute-lft-out100.0%
sub-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-*r/99.7%
log-rec99.7%
mul-1-neg99.7%
+-commutative99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 87.2%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (if (<= z 7.5e+275) (- (* (+ -1.0 x) (log y)) t) (* y (- 1.0 (+ z (/ (log y) y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.5e+275) {
tmp = ((-1.0 + x) * log(y)) - t;
} else {
tmp = y * (1.0 - (z + (log(y) / 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 (z <= 7.5d+275) then
tmp = (((-1.0d0) + x) * log(y)) - t
else
tmp = y * (1.0d0 - (z + (log(y) / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 7.5e+275) {
tmp = ((-1.0 + x) * Math.log(y)) - t;
} else {
tmp = y * (1.0 - (z + (Math.log(y) / y)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 7.5e+275: tmp = ((-1.0 + x) * math.log(y)) - t else: tmp = y * (1.0 - (z + (math.log(y) / y))) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 7.5e+275) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(y * Float64(1.0 - Float64(z + Float64(log(y) / y)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= 7.5e+275) tmp = ((-1.0 + x) * log(y)) - t; else tmp = y * (1.0 - (z + (log(y) / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, 7.5e+275], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(y * N[(1.0 - N[(z + N[(N[Log[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 7.5 \cdot 10^{+275}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - \left(z + \frac{\log y}{y}\right)\right)\\
\end{array}
\end{array}
if z < 7.49999999999999978e275Initial program 91.6%
Taylor expanded in y around 0 90.5%
if 7.49999999999999978e275 < z Initial program 17.3%
Taylor expanded in y around 0 99.7%
associate--l+99.7%
associate-*r*99.7%
mul-1-neg99.7%
fma-neg99.7%
sub-neg99.7%
metadata-eval99.7%
fma-define99.7%
*-commutative99.7%
fma-define99.7%
sub-neg99.7%
metadata-eval99.7%
+-commutative99.7%
sub-neg99.7%
*-commutative99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 100.0%
Taylor expanded in t around 0 100.0%
distribute-lft-out100.0%
sub-neg100.0%
metadata-eval100.0%
sub-neg100.0%
metadata-eval100.0%
associate-*r/99.7%
log-rec99.7%
mul-1-neg99.7%
+-commutative99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around 0 87.2%
Final simplification90.5%
(FPCore (x y z t) :precision binary64 (- (- (* (+ -1.0 x) (log y)) (* (+ z -1.0) y)) t))
double code(double x, double y, double z, double t) {
return (((-1.0 + x) * log(y)) - ((z + -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 = ((((-1.0d0) + x) * log(y)) - ((z + (-1.0d0)) * y)) - 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)) - t;
}
def code(x, y, z, t): return (((-1.0 + x) * math.log(y)) - ((z + -1.0) * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(-1.0 + x) * log(y)) - Float64(Float64(z + -1.0) * y)) - t) end
function tmp = code(x, y, z, t) tmp = (((-1.0 + x) * log(y)) - ((z + -1.0) * y)) - 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] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-1 + x\right) \cdot \log y - \left(z + -1\right) \cdot y\right) - t
\end{array}
Initial program 89.9%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
fma-define98.9%
mul-1-neg98.9%
fma-neg98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (<= z 5.1e+177) (- (* (+ -1.0 x) (log y)) t) (- (* z (log1p (- y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= 5.1e+177) {
tmp = ((-1.0 + x) * log(y)) - t;
} else {
tmp = (z * log1p(-y)) - t;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= 5.1e+177) {
tmp = ((-1.0 + x) * Math.log(y)) - t;
} else {
tmp = (z * Math.log1p(-y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= 5.1e+177: tmp = ((-1.0 + x) * math.log(y)) - t else: tmp = (z * math.log1p(-y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= 5.1e+177) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(Float64(z * log1p(Float64(-y))) - t); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, 5.1e+177], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 5.1 \cdot 10^{+177}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \mathsf{log1p}\left(-y\right) - t\\
\end{array}
\end{array}
if z < 5.1000000000000004e177Initial program 93.9%
Taylor expanded in y around 0 93.2%
if 5.1000000000000004e177 < z Initial program 52.6%
Taylor expanded in z around inf 19.2%
*-commutative19.2%
sub-neg19.2%
log1p-define65.1%
Simplified65.1%
Final simplification90.4%
(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 89.9%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
fma-define98.9%
mul-1-neg98.9%
fma-neg98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in z around inf 98.9%
Final simplification98.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -37000.0) (not (<= t 2.65e+16))) (- t) (* y (- 1.0 z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -37000.0) || !(t <= 2.65e+16)) {
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 <= (-37000.0d0)) .or. (.not. (t <= 2.65d+16))) 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 <= -37000.0) || !(t <= 2.65e+16)) {
tmp = -t;
} else {
tmp = y * (1.0 - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -37000.0) or not (t <= 2.65e+16): tmp = -t else: tmp = y * (1.0 - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -37000.0) || !(t <= 2.65e+16)) 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 <= -37000.0) || ~((t <= 2.65e+16))) tmp = -t; else tmp = y * (1.0 - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -37000.0], N[Not[LessEqual[t, 2.65e+16]], $MachinePrecision]], (-t), N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -37000 \lor \neg \left(t \leq 2.65 \cdot 10^{+16}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right)\\
\end{array}
\end{array}
if t < -37000 or 2.65e16 < t Initial program 94.7%
Taylor expanded in t around inf 73.6%
neg-mul-173.6%
Simplified73.6%
if -37000 < t < 2.65e16Initial program 85.3%
Taylor expanded in y around 0 98.0%
associate--l+98.0%
associate-*r*98.0%
mul-1-neg98.0%
fma-neg98.0%
sub-neg98.0%
metadata-eval98.0%
fma-define98.0%
*-commutative98.0%
fma-define98.0%
sub-neg98.0%
metadata-eval98.0%
+-commutative98.0%
sub-neg98.0%
*-commutative98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in y around inf 68.5%
Taylor expanded in y around inf 17.2%
mul-1-neg17.2%
distribute-rgt-neg-in17.2%
sub-neg17.2%
metadata-eval17.2%
+-commutative17.2%
distribute-neg-in17.2%
metadata-eval17.2%
unsub-neg17.2%
Simplified17.2%
Final simplification44.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -246.0) (not (<= t 2.5e+16))) (- t) (* y (- z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -246.0) || !(t <= 2.5e+16)) {
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 <= (-246.0d0)) .or. (.not. (t <= 2.5d+16))) 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 <= -246.0) || !(t <= 2.5e+16)) {
tmp = -t;
} else {
tmp = y * -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -246.0) or not (t <= 2.5e+16): tmp = -t else: tmp = y * -z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -246.0) || !(t <= 2.5e+16)) 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 <= -246.0) || ~((t <= 2.5e+16))) tmp = -t; else tmp = y * -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -246.0], N[Not[LessEqual[t, 2.5e+16]], $MachinePrecision]], (-t), N[(y * (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -246 \lor \neg \left(t \leq 2.5 \cdot 10^{+16}\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(-z\right)\\
\end{array}
\end{array}
if t < -246 or 2.5e16 < t Initial program 94.7%
Taylor expanded in t around inf 73.6%
neg-mul-173.6%
Simplified73.6%
if -246 < t < 2.5e16Initial program 85.3%
Taylor expanded in y around 0 98.0%
associate--l+98.0%
associate-*r*98.0%
mul-1-neg98.0%
fma-neg98.0%
sub-neg98.0%
metadata-eval98.0%
fma-define98.0%
*-commutative98.0%
fma-define98.0%
sub-neg98.0%
metadata-eval98.0%
+-commutative98.0%
sub-neg98.0%
*-commutative98.0%
+-commutative98.0%
Simplified98.0%
Taylor expanded in z around inf 16.6%
associate-*r*16.6%
neg-mul-116.6%
Simplified16.6%
Final simplification44.5%
(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 89.9%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
fma-define98.9%
mul-1-neg98.9%
fma-neg98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in y around inf 47.4%
(FPCore (x y z t) :precision binary64 (- (- t) (* z y)))
double code(double x, double y, double z, double t) {
return -t - (z * y);
}
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 - (z * y)
end function
public static double code(double x, double y, double z, double t) {
return -t - (z * y);
}
def code(x, y, z, t): return -t - (z * y)
function code(x, y, z, t) return Float64(Float64(-t) - Float64(z * y)) end
function tmp = code(x, y, z, t) tmp = -t - (z * y); end
code[x_, y_, z_, t_] := N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-t\right) - z \cdot y
\end{array}
Initial program 89.9%
Taylor expanded in y around 0 98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
fma-define98.9%
mul-1-neg98.9%
fma-neg98.9%
+-commutative98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in z around inf 47.2%
mul-1-neg47.2%
distribute-rgt-neg-in47.2%
Simplified47.2%
Final simplification47.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 89.9%
Taylor expanded in t around inf 37.4%
neg-mul-137.4%
Simplified37.4%
(FPCore (x y z t) :precision binary64 y)
double code(double x, double y, double z, double t) {
return y;
}
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
end function
public static double code(double x, double y, double z, double t) {
return y;
}
def code(x, y, z, t): return y
function code(x, y, z, t) return y end
function tmp = code(x, y, z, t) tmp = y; end
code[x_, y_, z_, t_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 89.9%
Taylor expanded in y around 0 98.9%
associate--l+98.9%
associate-*r*98.9%
mul-1-neg98.9%
fma-neg98.9%
sub-neg98.9%
metadata-eval98.9%
fma-define98.9%
*-commutative98.9%
fma-define98.9%
sub-neg98.9%
metadata-eval98.9%
+-commutative98.9%
sub-neg98.9%
*-commutative98.9%
+-commutative98.9%
Simplified98.9%
Taylor expanded in z around 0 88.8%
Taylor expanded in y around inf 2.9%
herbie shell --seed 2024100
(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))