
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (- (fma (+ z -1.0) (log1p (- y)) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(z + -1.0), log1p(Float64(-y)), Float64(log(y) * Float64(-1.0 + x))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(z + -1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z + -1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(-1 + x\right)\right) - t
\end{array}
Initial program 89.6%
+-commutative89.6%
fma-define89.6%
sub-neg89.6%
metadata-eval89.6%
sub-neg89.6%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (log y) (+ -1.0 x))
(*
(* y (+ -1.0 (* y (- (* y (- (* y -0.25) 0.3333333333333333)) 0.5))))
(+ z -1.0)))
t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))) * (z + -1.0))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * ((-1.0d0) + x)) + ((y * ((-1.0d0) + (y * ((y * ((y * (-0.25d0)) - 0.3333333333333333d0)) - 0.5d0)))) * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))) * (z + -1.0))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))) * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * Float64(Float64(y * -0.25) - 0.3333333333333333)) - 0.5)))) * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))) * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] + N[(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] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) + \left(y \cdot \left(-1 + y \cdot \left(y \cdot \left(y \cdot -0.25 - 0.3333333333333333\right) - 0.5\right)\right)\right) \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 89.6%
Taylor expanded in y around 0 99.2%
Final simplification99.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (+ z -1.0))))
(if (or (<= (+ -1.0 x) -5000000000.0) (not (<= (+ -1.0 x) -1.0)))
(- (- (* x (log y)) t_1) t)
(- (- (- (log y)) t_1) t))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z + -1.0);
double tmp;
if (((-1.0 + x) <= -5000000000.0) || !((-1.0 + x) <= -1.0)) {
tmp = ((x * log(y)) - t_1) - t;
} else {
tmp = (-log(y) - t_1) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = y * (z + (-1.0d0))
if ((((-1.0d0) + x) <= (-5000000000.0d0)) .or. (.not. (((-1.0d0) + x) <= (-1.0d0)))) then
tmp = ((x * log(y)) - t_1) - t
else
tmp = (-log(y) - t_1) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = y * (z + -1.0);
double tmp;
if (((-1.0 + x) <= -5000000000.0) || !((-1.0 + x) <= -1.0)) {
tmp = ((x * Math.log(y)) - t_1) - t;
} else {
tmp = (-Math.log(y) - t_1) - t;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z + -1.0) tmp = 0 if ((-1.0 + x) <= -5000000000.0) or not ((-1.0 + x) <= -1.0): tmp = ((x * math.log(y)) - t_1) - t else: tmp = (-math.log(y) - t_1) - t return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z + -1.0)) tmp = 0.0 if ((Float64(-1.0 + x) <= -5000000000.0) || !(Float64(-1.0 + x) <= -1.0)) tmp = Float64(Float64(Float64(x * log(y)) - t_1) - t); else tmp = Float64(Float64(Float64(-log(y)) - t_1) - t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z + -1.0); tmp = 0.0; if (((-1.0 + x) <= -5000000000.0) || ~(((-1.0 + x) <= -1.0))) tmp = ((x * log(y)) - t_1) - t; else tmp = (-log(y) - t_1) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -5000000000.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -1.0]], $MachinePrecision]], N[(N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - t$95$1), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z + -1\right)\\
\mathbf{if}\;-1 + x \leq -5000000000 \lor \neg \left(-1 + x \leq -1\right):\\
\;\;\;\;\left(x \cdot \log y - t\_1\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - t\_1\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -5e9 or -1 < (-.f64 x #s(literal 1 binary64)) Initial program 93.0%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
fma-define99.1%
mul-1-neg99.1%
fma-neg99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in x around inf 98.7%
*-commutative98.7%
Simplified98.7%
if -5e9 < (-.f64 x #s(literal 1 binary64)) < -1Initial program 86.5%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
fma-define98.7%
mul-1-neg98.7%
fma-neg98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 98.5%
mul-1-neg98.5%
Simplified98.5%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(if (<= (+ -1.0 x) -5000000000.0)
(- (* (log y) (+ -1.0 x)) t)
(if (<= (+ -1.0 x) 4000000000.0)
(- (- (- (log y)) (* y (+ z -1.0))) t)
(- (* x (log y)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((-1.0 + x) <= -5000000000.0) {
tmp = (log(y) * (-1.0 + x)) - t;
} else if ((-1.0 + x) <= 4000000000.0) {
tmp = (-log(y) - (y * (z + -1.0))) - t;
} else {
tmp = (x * 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) <= (-5000000000.0d0)) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else if (((-1.0d0) + x) <= 4000000000.0d0) then
tmp = (-log(y) - (y * (z + (-1.0d0)))) - t
else
tmp = (x * 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) <= -5000000000.0) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else if ((-1.0 + x) <= 4000000000.0) {
tmp = (-Math.log(y) - (y * (z + -1.0))) - t;
} else {
tmp = (x * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (-1.0 + x) <= -5000000000.0: tmp = (math.log(y) * (-1.0 + x)) - t elif (-1.0 + x) <= 4000000000.0: tmp = (-math.log(y) - (y * (z + -1.0))) - t else: tmp = (x * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(-1.0 + x) <= -5000000000.0) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); elseif (Float64(-1.0 + x) <= 4000000000.0) tmp = Float64(Float64(Float64(-log(y)) - Float64(y * Float64(z + -1.0))) - t); else tmp = Float64(Float64(x * log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((-1.0 + x) <= -5000000000.0) tmp = (log(y) * (-1.0 + x)) - t; elseif ((-1.0 + x) <= 4000000000.0) tmp = (-log(y) - (y * (z + -1.0))) - t; else tmp = (x * log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(-1.0 + x), $MachinePrecision], -5000000000.0], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[N[(-1.0 + x), $MachinePrecision], 4000000000.0], N[(N[((-N[Log[y], $MachinePrecision]) - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5000000000:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{elif}\;-1 + x \leq 4000000000:\\
\;\;\;\;\left(\left(-\log y\right) - y \cdot \left(z + -1\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log y - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -5e9Initial program 95.7%
Taylor expanded in y around 0 98.2%
+-commutative98.2%
sub-neg98.2%
metadata-eval98.2%
fma-define98.2%
mul-1-neg98.2%
fma-neg98.2%
+-commutative98.2%
sub-neg98.2%
metadata-eval98.2%
+-commutative98.2%
Simplified98.2%
Taylor expanded in y around inf 43.8%
associate--l+43.8%
mul-1-neg43.8%
log-rec43.8%
mul-1-neg43.8%
associate-/l*43.9%
distribute-lft-neg-in43.9%
mul-1-neg43.9%
remove-double-neg43.9%
sub-neg43.9%
metadata-eval43.9%
+-commutative43.9%
Simplified43.9%
Taylor expanded in y around 0 94.2%
if -5e9 < (-.f64 x #s(literal 1 binary64)) < 4e9Initial program 85.4%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
fma-define98.7%
mul-1-neg98.7%
fma-neg98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in x around 0 98.1%
mul-1-neg98.1%
Simplified98.1%
if 4e9 < (-.f64 x #s(literal 1 binary64)) Initial program 93.2%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
fma-define99.8%
mul-1-neg99.8%
fma-neg99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 99.8%
distribute-lft-in99.8%
associate-*r/99.8%
associate-*l/99.8%
distribute-lft-in99.8%
distribute-rgt1-in99.8%
+-commutative99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 93.0%
*-commutative93.0%
Simplified93.0%
Final simplification95.9%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ -1.0 x)) (* (* y (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5)))) (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))) * (z + -1.0))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * ((-1.0d0) + x)) + ((y * ((-1.0d0) + (y * ((y * (-0.3333333333333333d0)) - 0.5d0)))) * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))) * (z + -1.0))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))) * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(Float64(y * Float64(-1.0 + Float64(y * Float64(Float64(y * -0.3333333333333333) - 0.5)))) * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))) * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] + N[(N[(y * N[(-1.0 + N[(y * N[(N[(y * -0.3333333333333333), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) + \left(y \cdot \left(-1 + y \cdot \left(y \cdot -0.3333333333333333 - 0.5\right)\right)\right) \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 89.6%
Taylor expanded in y around 0 99.1%
Final simplification99.1%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ -1.0 x)) (* (* y (+ -1.0 (* y -0.5))) (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * -0.5))) * (z + -1.0))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * ((-1.0d0) + x)) + ((y * ((-1.0d0) + (y * (-0.5d0)))) * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * -0.5))) * (z + -1.0))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * -0.5))) * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(Float64(y * Float64(-1.0 + Float64(y * -0.5))) * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) + ((y * (-1.0 + (y * -0.5))) * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] + N[(N[(y * N[(-1.0 + N[(y * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) + \left(y \cdot \left(-1 + y \cdot -0.5\right)\right) \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 89.6%
Taylor expanded in y around 0 99.0%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.15e+257) (not (<= z 4.9e+238))) (- (- t) (* z y)) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.15e+257) || !(z <= 4.9e+238)) {
tmp = -t - (z * y);
} else {
tmp = (log(y) * (-1.0 + x)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.15d+257)) .or. (.not. (z <= 4.9d+238))) then
tmp = -t - (z * y)
else
tmp = (log(y) * ((-1.0d0) + x)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.15e+257) || !(z <= 4.9e+238)) {
tmp = -t - (z * y);
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.15e+257) or not (z <= 4.9e+238): tmp = -t - (z * y) else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.15e+257) || !(z <= 4.9e+238)) tmp = Float64(Float64(-t) - Float64(z * y)); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.15e+257) || ~((z <= 4.9e+238))) tmp = -t - (z * y); else tmp = (log(y) * (-1.0 + x)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.15e+257], N[Not[LessEqual[z, 4.9e+238]], $MachinePrecision]], N[((-t) - N[(z * y), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.15 \cdot 10^{+257} \lor \neg \left(z \leq 4.9 \cdot 10^{+238}\right):\\
\;\;\;\;\left(-t\right) - z \cdot y\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if z < -2.1499999999999999e257 or 4.90000000000000027e238 < z Initial program 38.4%
Taylor expanded in y around 0 97.0%
+-commutative97.0%
sub-neg97.0%
metadata-eval97.0%
fma-define97.0%
mul-1-neg97.0%
fma-neg97.0%
+-commutative97.0%
sub-neg97.0%
metadata-eval97.0%
+-commutative97.0%
Simplified97.0%
Taylor expanded in z around inf 87.1%
associate-*r*87.1%
neg-mul-187.1%
Simplified87.1%
if -2.1499999999999999e257 < z < 4.90000000000000027e238Initial program 94.5%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
fma-define99.1%
mul-1-neg99.1%
fma-neg99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in y around inf 74.5%
associate--l+74.5%
mul-1-neg74.5%
log-rec74.5%
mul-1-neg74.5%
associate-/l*74.5%
distribute-lft-neg-in74.5%
mul-1-neg74.5%
remove-double-neg74.5%
sub-neg74.5%
metadata-eval74.5%
+-commutative74.5%
Simplified74.5%
Taylor expanded in y around 0 93.3%
Final simplification92.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1400000.0) (not (<= x 2300000000.0))) (- (* x (log y)) t) (- (* y (- 1.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1400000.0) || !(x <= 2300000000.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = (y * (1.0 - z)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1400000.0d0)) .or. (.not. (x <= 2300000000.0d0))) then
tmp = (x * log(y)) - t
else
tmp = (y * (1.0d0 - z)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1400000.0) || !(x <= 2300000000.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = (y * (1.0 - z)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1400000.0) or not (x <= 2300000000.0): tmp = (x * math.log(y)) - t else: tmp = (y * (1.0 - z)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1400000.0) || !(x <= 2300000000.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(y * Float64(1.0 - z)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1400000.0) || ~((x <= 2300000000.0))) tmp = (x * log(y)) - t; else tmp = (y * (1.0 - z)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1400000.0], N[Not[LessEqual[x, 2300000000.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1400000 \lor \neg \left(x \leq 2300000000\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(1 - z\right) - t\\
\end{array}
\end{array}
if x < -1.4e6 or 2.3e9 < x Initial program 94.4%
Taylor expanded in y around 0 99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
fma-define99.1%
mul-1-neg99.1%
fma-neg99.1%
+-commutative99.1%
sub-neg99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in x around inf 99.1%
distribute-lft-in99.1%
associate-*r/99.1%
associate-*l/99.1%
distribute-lft-in99.1%
distribute-rgt1-in99.1%
+-commutative99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in x around inf 93.3%
*-commutative93.3%
Simplified93.3%
if -1.4e6 < x < 2.3e9Initial program 85.4%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
fma-define98.7%
mul-1-neg98.7%
fma-neg98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in y around inf 60.3%
Final simplification75.9%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* y (+ z -1.0))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = ((log(y) * ((-1.0d0) + x)) - (y * (z + (-1.0d0)))) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(y * Float64(z + -1.0))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (y * (z + -1.0))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - y \cdot \left(z + -1\right)\right) - t
\end{array}
Initial program 89.6%
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 (or (<= t -6.8e-9) (not (<= t 4100000.0))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.8e-9) || !(t <= 4100000.0)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-6.8d-9)) .or. (.not. (t <= 4100000.0d0))) then
tmp = -t
else
tmp = z * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.8e-9) || !(t <= 4100000.0)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -6.8e-9) or not (t <= 4100000.0): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -6.8e-9) || !(t <= 4100000.0)) tmp = Float64(-t); else tmp = Float64(z * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -6.8e-9) || ~((t <= 4100000.0))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -6.8e-9], N[Not[LessEqual[t, 4100000.0]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{-9} \lor \neg \left(t \leq 4100000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -6.7999999999999997e-9 or 4.1e6 < t Initial program 95.2%
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 72.9%
associate-*r*72.9%
neg-mul-172.9%
Simplified72.9%
Taylor expanded in y around 0 68.2%
neg-mul-168.2%
Simplified68.2%
if -6.7999999999999997e-9 < t < 4.1e6Initial program 84.2%
Taylor expanded in y around 0 98.5%
+-commutative98.5%
sub-neg98.5%
metadata-eval98.5%
fma-define98.5%
mul-1-neg98.5%
fma-neg98.5%
+-commutative98.5%
sub-neg98.5%
metadata-eval98.5%
+-commutative98.5%
Simplified98.5%
Taylor expanded in z around inf 16.8%
associate-*r*16.8%
neg-mul-116.8%
Simplified16.8%
Taylor expanded in y around inf 16.7%
mul-1-neg16.7%
distribute-rgt-neg-in16.7%
Simplified16.7%
Final simplification42.0%
(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.6%
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 44.6%
Final simplification44.6%
(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.6%
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 44.4%
associate-*r*44.4%
neg-mul-144.4%
Simplified44.4%
Final simplification44.4%
(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.6%
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 44.4%
associate-*r*44.4%
neg-mul-144.4%
Simplified44.4%
Taylor expanded in y around 0 35.1%
neg-mul-135.1%
Simplified35.1%
Final simplification35.1%
herbie shell --seed 2024073
(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))