
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (- (fma (+ z -1.0) (log1p (- y)) (* (log y) (+ -1.0 x))) t))
double code(double x, double y, double z, double t) {
return fma((z + -1.0), log1p(-y), (log(y) * (-1.0 + x))) - t;
}
function code(x, y, z, t) return 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 90.0%
+-commutative90.0%
fma-define90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ -1.0 x)) (* z (log1p (- y)))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) + (z * log1p(-y))) - t;
}
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) + (z * Math.log1p(-y))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + (z * math.log1p(-y))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(z * log1p(Float64(-y)))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] + N[(z * N[Log[1 + (-y)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) + z \cdot \mathsf{log1p}\left(-y\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 90.0%
*-commutative90.0%
sub-neg90.0%
log1p-define99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (log y) (+ -1.0 x))
(*
y
(+
(- 1.0 z)
(*
y
(+
(* (+ z -1.0) -0.5)
(*
y
(+ (* (+ z -1.0) -0.3333333333333333) (* -0.25 (* y (+ z -1.0))))))))))
t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) + (y * ((1.0 - z) + (y * (((z + -1.0) * -0.5) + (y * (((z + -1.0) * -0.3333333333333333) + (-0.25 * (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 * ((1.0d0 - z) + (y * (((z + (-1.0d0)) * (-0.5d0)) + (y * (((z + (-1.0d0)) * (-0.3333333333333333d0)) + ((-0.25d0) * (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 * ((1.0 - z) + (y * (((z + -1.0) * -0.5) + (y * (((z + -1.0) * -0.3333333333333333) + (-0.25 * (y * (z + -1.0)))))))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + (y * ((1.0 - z) + (y * (((z + -1.0) * -0.5) + (y * (((z + -1.0) * -0.3333333333333333) + (-0.25 * (y * (z + -1.0)))))))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(y * Float64(Float64(1.0 - z) + Float64(y * Float64(Float64(Float64(z + -1.0) * -0.5) + Float64(y * Float64(Float64(Float64(z + -1.0) * -0.3333333333333333) + Float64(-0.25 * Float64(y * Float64(z + -1.0)))))))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) + (y * ((1.0 - z) + (y * (((z + -1.0) * -0.5) + (y * (((z + -1.0) * -0.3333333333333333) + (-0.25 * (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[(N[(1.0 - z), $MachinePrecision] + N[(y * N[(N[(N[(z + -1.0), $MachinePrecision] * -0.5), $MachinePrecision] + N[(y * N[(N[(N[(z + -1.0), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] + N[(-0.25 * N[(y * N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) + y \cdot \left(\left(1 - z\right) + y \cdot \left(\left(z + -1\right) \cdot -0.5 + y \cdot \left(\left(z + -1\right) \cdot -0.3333333333333333 + -0.25 \cdot \left(y \cdot \left(z + -1\right)\right)\right)\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t)
:precision binary64
(-
(+
(* (log y) (+ -1.0 x))
(*
(+ 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 ((log(y) * (-1.0 + x)) + ((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 = ((log(y) * ((-1.0d0) + x)) + ((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 ((Math.log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * ((y * -0.25) - 0.3333333333333333)) - 0.5)))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + ((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(log(y) * Float64(-1.0 + x)) + 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 = ((log(y) * (-1.0 + x)) + ((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[Log[y], $MachinePrecision] * N[(-1.0 + x), $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(\log y \cdot \left(-1 + x\right) + \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 90.0%
Taylor expanded in y around 0 99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ -1.0 x)) (* (+ z -1.0) (* y (+ -1.0 (* y (- (* y -0.3333333333333333) 0.5)))))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) + ((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 = ((log(y) * ((-1.0d0) + x)) + ((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 ((Math.log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + 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 = ((log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * ((y * -0.3333333333333333) - 0.5)))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $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(\log y \cdot \left(-1 + x\right) + \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 90.0%
Taylor expanded in y around 0 99.6%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(if (or (<= (+ -1.0 x) -5000000000000.0)
(not (<= (+ -1.0 x) -0.999999999995)))
(- (* (log y) (+ -1.0 x)) t)
(- (- (- (log y)) (* z y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -5000000000000.0) || !((-1.0 + x) <= -0.999999999995)) {
tmp = (log(y) * (-1.0 + x)) - t;
} else {
tmp = (-log(y) - (z * y)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((((-1.0d0) + x) <= (-5000000000000.0d0)) .or. (.not. (((-1.0d0) + x) <= (-0.999999999995d0)))) then
tmp = (log(y) * ((-1.0d0) + x)) - t
else
tmp = (-log(y) - (z * y)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((-1.0 + x) <= -5000000000000.0) || !((-1.0 + x) <= -0.999999999995)) {
tmp = (Math.log(y) * (-1.0 + x)) - t;
} else {
tmp = (-Math.log(y) - (z * y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((-1.0 + x) <= -5000000000000.0) or not ((-1.0 + x) <= -0.999999999995): tmp = (math.log(y) * (-1.0 + x)) - t else: tmp = (-math.log(y) - (z * y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(-1.0 + x) <= -5000000000000.0) || !(Float64(-1.0 + x) <= -0.999999999995)) tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); else tmp = Float64(Float64(Float64(-log(y)) - Float64(z * y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((-1.0 + x) <= -5000000000000.0) || ~(((-1.0 + x) <= -0.999999999995))) tmp = (log(y) * (-1.0 + x)) - t; else tmp = (-log(y) - (z * y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(-1.0 + x), $MachinePrecision], -5000000000000.0], N[Not[LessEqual[N[(-1.0 + x), $MachinePrecision], -0.999999999995]], $MachinePrecision]], N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[((-N[Log[y], $MachinePrecision]) - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;-1 + x \leq -5000000000000 \lor \neg \left(-1 + x \leq -0.999999999995\right):\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-\log y\right) - z \cdot y\right) - t\\
\end{array}
\end{array}
if (-.f64 x 1) < -5e12 or -0.999999999995 < (-.f64 x 1) Initial program 95.2%
+-commutative95.2%
fma-define95.2%
sub-neg95.2%
metadata-eval95.2%
sub-neg95.2%
log1p-define99.7%
sub-neg99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 93.6%
if -5e12 < (-.f64 x 1) < -0.999999999995Initial program 85.8%
Taylor expanded in z around inf 85.8%
*-commutative85.8%
sub-neg85.8%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
mul-1-neg99.8%
unsub-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 99.2%
mul-1-neg99.2%
Simplified99.2%
Final simplification96.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e+142) (not (<= z 5.8e+130))) (- (* z (- (* x (/ (log y) z)) y)) t) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e+142) || !(z <= 5.8e+130)) {
tmp = (z * ((x * (log(y) / z)) - y)) - t;
} else {
tmp = (log(y) * (-1.0 + x)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.6d+142)) .or. (.not. (z <= 5.8d+130))) then
tmp = (z * ((x * (log(y) / z)) - y)) - t
else
tmp = (log(y) * ((-1.0d0) + x)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e+142) || !(z <= 5.8e+130)) {
tmp = (z * ((x * (Math.log(y) / z)) - y)) - t;
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e+142) or not (z <= 5.8e+130): tmp = (z * ((x * (math.log(y) / z)) - y)) - t else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e+142) || !(z <= 5.8e+130)) tmp = Float64(Float64(z * Float64(Float64(x * Float64(log(y) / z)) - y)) - t); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.6e+142) || ~((z <= 5.8e+130))) tmp = (z * ((x * (log(y) / z)) - y)) - t; else tmp = (log(y) * (-1.0 + x)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e+142], N[Not[LessEqual[z, 5.8e+130]], $MachinePrecision]], N[(N[(z * N[(N[(x * N[(N[Log[y], $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision] - t), $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 -1.6 \cdot 10^{+142} \lor \neg \left(z \leq 5.8 \cdot 10^{+130}\right):\\
\;\;\;\;z \cdot \left(x \cdot \frac{\log y}{z} - y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if z < -1.60000000000000003e142 or 5.7999999999999998e130 < z Initial program 63.8%
Taylor expanded in z around inf 63.8%
*-commutative63.8%
sub-neg63.8%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 97.6%
+-commutative97.6%
sub-neg97.6%
metadata-eval97.6%
mul-1-neg97.6%
unsub-neg97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in z around inf 97.6%
Taylor expanded in x around inf 89.9%
associate-/l*89.8%
Simplified89.8%
if -1.60000000000000003e142 < z < 5.7999999999999998e130Initial program 99.6%
+-commutative99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
sub-neg99.6%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 99.6%
Final simplification97.0%
(FPCore (x y z t) :precision binary64 (- (+ (* (log y) (+ -1.0 x)) (* (+ z -1.0) (* y (+ -1.0 (* y -0.5))))) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) + ((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 = ((log(y) * ((-1.0d0) + x)) + ((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 ((Math.log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * -0.5))))) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * -0.5))))) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) + Float64(Float64(z + -1.0) * Float64(y * Float64(-1.0 + Float64(y * -0.5))))) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) + ((z + -1.0) * (y * (-1.0 + (y * -0.5))))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $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(\log y \cdot \left(-1 + x\right) + \left(z + -1\right) \cdot \left(y \cdot \left(-1 + y \cdot -0.5\right)\right)\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in y around 0 99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.12e+259) (not (<= z 6.5e+234))) (- (* z (- y)) t) (- (* (log y) (+ -1.0 x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.12e+259) || !(z <= 6.5e+234)) {
tmp = (z * -y) - t;
} else {
tmp = (log(y) * (-1.0 + x)) - t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.12d+259)) .or. (.not. (z <= 6.5d+234))) then
tmp = (z * -y) - t
else
tmp = (log(y) * ((-1.0d0) + x)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.12e+259) || !(z <= 6.5e+234)) {
tmp = (z * -y) - t;
} else {
tmp = (Math.log(y) * (-1.0 + x)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.12e+259) or not (z <= 6.5e+234): tmp = (z * -y) - t else: tmp = (math.log(y) * (-1.0 + x)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.12e+259) || !(z <= 6.5e+234)) tmp = Float64(Float64(z * Float64(-y)) - t); else tmp = Float64(Float64(log(y) * Float64(-1.0 + x)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.12e+259) || ~((z <= 6.5e+234))) tmp = (z * -y) - t; else tmp = (log(y) * (-1.0 + x)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.12e+259], N[Not[LessEqual[z, 6.5e+234]], $MachinePrecision]], N[(N[(z * (-y)), $MachinePrecision] - t), $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 -1.12 \cdot 10^{+259} \lor \neg \left(z \leq 6.5 \cdot 10^{+234}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\log y \cdot \left(-1 + x\right) - t\\
\end{array}
\end{array}
if z < -1.11999999999999993e259 or 6.4999999999999995e234 < z Initial program 36.9%
Taylor expanded in z around inf 36.9%
*-commutative36.9%
sub-neg36.9%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
mul-1-neg99.9%
unsub-neg99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 84.3%
neg-mul-184.3%
distribute-rgt-neg-in84.3%
Simplified84.3%
if -1.11999999999999993e259 < z < 6.4999999999999995e234Initial program 95.9%
+-commutative95.9%
fma-define95.9%
sub-neg95.9%
metadata-eval95.9%
sub-neg95.9%
log1p-define99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 95.0%
Final simplification93.9%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (- (* x (log y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = (x * log(y)) - t;
} else {
tmp = -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)) .or. (.not. (x <= 1.0d0))) then
tmp = (x * log(y)) - t
else
tmp = -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) || !(x <= 1.0)) {
tmp = (x * Math.log(y)) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = (x * math.log(y)) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(Float64(x * log(y)) - t); else tmp = Float64(Float64(-log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = (x * log(y)) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(N[(x * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;x \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 94.2%
Taylor expanded in z around inf 94.2%
*-commutative94.2%
sub-neg94.2%
log1p-define99.7%
Simplified99.7%
Taylor expanded in x around inf 92.3%
*-commutative92.3%
Simplified92.3%
if -1 < x < 1Initial program 86.7%
Taylor expanded in z around inf 86.7%
*-commutative86.7%
sub-neg86.7%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
mul-1-neg99.8%
unsub-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 98.8%
mul-1-neg98.8%
Simplified98.8%
Taylor expanded in y around 0 85.4%
mul-1-neg85.4%
Simplified85.4%
Final simplification88.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.5e+140) (not (<= z 7.2e+133))) (- (* z (- y)) t) (- (- (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.5e+140) || !(z <= 7.2e+133)) {
tmp = (z * -y) - t;
} else {
tmp = -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 ((z <= (-9.5d+140)) .or. (.not. (z <= 7.2d+133))) then
tmp = (z * -y) - t
else
tmp = -log(y) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.5e+140) || !(z <= 7.2e+133)) {
tmp = (z * -y) - t;
} else {
tmp = -Math.log(y) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.5e+140) or not (z <= 7.2e+133): tmp = (z * -y) - t else: tmp = -math.log(y) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.5e+140) || !(z <= 7.2e+133)) tmp = Float64(Float64(z * Float64(-y)) - t); else tmp = Float64(Float64(-log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.5e+140) || ~((z <= 7.2e+133))) tmp = (z * -y) - t; else tmp = -log(y) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.5e+140], N[Not[LessEqual[z, 7.2e+133]], $MachinePrecision]], N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+140} \lor \neg \left(z \leq 7.2 \cdot 10^{+133}\right):\\
\;\;\;\;z \cdot \left(-y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\left(-\log y\right) - t\\
\end{array}
\end{array}
if z < -9.4999999999999994e140 or 7.19999999999999956e133 < z Initial program 63.8%
Taylor expanded in z around inf 63.8%
*-commutative63.8%
sub-neg63.8%
log1p-define99.9%
Simplified99.9%
Taylor expanded in y around 0 97.6%
+-commutative97.6%
sub-neg97.6%
metadata-eval97.6%
mul-1-neg97.6%
unsub-neg97.6%
+-commutative97.6%
Simplified97.6%
Taylor expanded in y around inf 68.4%
neg-mul-168.4%
distribute-rgt-neg-in68.4%
Simplified68.4%
if -9.4999999999999994e140 < z < 7.19999999999999956e133Initial program 99.6%
Taylor expanded in z around inf 99.6%
*-commutative99.6%
sub-neg99.6%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
mul-1-neg99.8%
unsub-neg99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around 0 65.2%
mul-1-neg65.2%
Simplified65.2%
Taylor expanded in y around 0 65.0%
mul-1-neg65.0%
Simplified65.0%
Final simplification65.9%
(FPCore (x y z t) :precision binary64 (- (- (* (log y) (+ -1.0 x)) (* z y)) t))
double code(double x, double y, double z, double t) {
return ((log(y) * (-1.0 + x)) - (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 = ((log(y) * ((-1.0d0) + x)) - (z * y)) - t
end function
public static double code(double x, double y, double z, double t) {
return ((Math.log(y) * (-1.0 + x)) - (z * y)) - t;
}
def code(x, y, z, t): return ((math.log(y) * (-1.0 + x)) - (z * y)) - t
function code(x, y, z, t) return Float64(Float64(Float64(log(y) * Float64(-1.0 + x)) - Float64(z * y)) - t) end
function tmp = code(x, y, z, t) tmp = ((log(y) * (-1.0 + x)) - (z * y)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[Log[y], $MachinePrecision] * N[(-1.0 + x), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\log y \cdot \left(-1 + x\right) - z \cdot y\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 90.0%
*-commutative90.0%
sub-neg90.0%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
mul-1-neg99.2%
unsub-neg99.2%
+-commutative99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.8e+42) (not (<= t 64000.0))) (- t) (* z (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.8e+42) || !(t <= 64000.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 <= (-3.8d+42)) .or. (.not. (t <= 64000.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 <= -3.8e+42) || !(t <= 64000.0)) {
tmp = -t;
} else {
tmp = z * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.8e+42) or not (t <= 64000.0): tmp = -t else: tmp = z * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.8e+42) || !(t <= 64000.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 <= -3.8e+42) || ~((t <= 64000.0))) tmp = -t; else tmp = z * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.8e+42], N[Not[LessEqual[t, 64000.0]], $MachinePrecision]], (-t), N[(z * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+42} \lor \neg \left(t \leq 64000\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -3.7999999999999998e42 or 64000 < t Initial program 96.0%
+-commutative96.0%
fma-define96.0%
sub-neg96.0%
metadata-eval96.0%
sub-neg96.0%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 78.2%
neg-mul-178.2%
Simplified78.2%
if -3.7999999999999998e42 < t < 64000Initial program 85.5%
Taylor expanded in z around inf 85.5%
*-commutative85.5%
sub-neg85.5%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
mul-1-neg98.7%
unsub-neg98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in y around inf 76.0%
associate-*r/76.0%
sub-neg76.0%
metadata-eval76.0%
associate-*r*76.0%
mul-1-neg76.0%
log-rec76.0%
+-commutative76.0%
Simplified76.0%
Taylor expanded in y around inf 16.6%
mul-1-neg16.6%
Simplified16.6%
Final simplification42.6%
(FPCore (x y z t) :precision binary64 (if (<= t -3.8e+42) (- (* z y) t) (if (<= t 106000.0) (* z (- y)) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.8e+42) {
tmp = (z * y) - t;
} else if (t <= 106000.0) {
tmp = z * -y;
} else {
tmp = -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-3.8d+42)) then
tmp = (z * y) - t
else if (t <= 106000.0d0) then
tmp = z * -y
else
tmp = -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.8e+42) {
tmp = (z * y) - t;
} else if (t <= 106000.0) {
tmp = z * -y;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.8e+42: tmp = (z * y) - t elif t <= 106000.0: tmp = z * -y else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.8e+42) tmp = Float64(Float64(z * y) - t); elseif (t <= 106000.0) tmp = Float64(z * Float64(-y)); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.8e+42) tmp = (z * y) - t; elseif (t <= 106000.0) tmp = z * -y; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.8e+42], N[(N[(z * y), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t, 106000.0], N[(z * (-y)), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.8 \cdot 10^{+42}:\\
\;\;\;\;z \cdot y - t\\
\mathbf{elif}\;t \leq 106000:\\
\;\;\;\;z \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -3.7999999999999998e42Initial program 95.3%
Taylor expanded in z around inf 95.3%
*-commutative95.3%
sub-neg95.3%
log1p-define100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
+-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
mul-1-neg100.0%
unsub-neg100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 81.6%
neg-mul-181.6%
distribute-rgt-neg-in81.6%
Simplified81.6%
sub-neg81.6%
add-sqr-sqrt38.1%
sqrt-unprod60.7%
sqr-neg60.7%
sqrt-unprod38.6%
add-sqr-sqrt76.9%
*-commutative76.9%
Applied egg-rr76.9%
unsub-neg76.9%
*-commutative76.9%
Simplified76.9%
if -3.7999999999999998e42 < t < 106000Initial program 85.5%
Taylor expanded in z around inf 85.5%
*-commutative85.5%
sub-neg85.5%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
sub-neg98.7%
metadata-eval98.7%
mul-1-neg98.7%
unsub-neg98.7%
+-commutative98.7%
Simplified98.7%
Taylor expanded in y around inf 76.0%
associate-*r/76.0%
sub-neg76.0%
metadata-eval76.0%
associate-*r*76.0%
mul-1-neg76.0%
log-rec76.0%
+-commutative76.0%
Simplified76.0%
Taylor expanded in y around inf 16.6%
mul-1-neg16.6%
Simplified16.6%
if 106000 < t Initial program 96.6%
+-commutative96.6%
fma-define96.6%
sub-neg96.6%
metadata-eval96.6%
sub-neg96.6%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 79.4%
neg-mul-179.4%
Simplified79.4%
Final simplification42.6%
(FPCore (x y z t) :precision binary64 (- (* z (- y)) t))
double code(double x, double y, double z, double t) {
return (z * -y) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (z * -y) - t
end function
public static double code(double x, double y, double z, double t) {
return (z * -y) - t;
}
def code(x, y, z, t): return (z * -y) - t
function code(x, y, z, t) return Float64(Float64(z * Float64(-y)) - t) end
function tmp = code(x, y, z, t) tmp = (z * -y) - t; end
code[x_, y_, z_, t_] := N[(N[(z * (-y)), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
z \cdot \left(-y\right) - t
\end{array}
Initial program 90.0%
Taylor expanded in z around inf 90.0%
*-commutative90.0%
sub-neg90.0%
log1p-define99.8%
Simplified99.8%
Taylor expanded in y around 0 99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
mul-1-neg99.2%
unsub-neg99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around inf 44.6%
neg-mul-144.6%
distribute-rgt-neg-in44.6%
Simplified44.6%
Final simplification44.6%
(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.0%
+-commutative90.0%
fma-define90.0%
sub-neg90.0%
metadata-eval90.0%
sub-neg90.0%
log1p-define99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around inf 34.9%
neg-mul-134.9%
Simplified34.9%
Final simplification34.9%
herbie shell --seed 2024054
(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))