
(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 23 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (log (- 1.0 y)))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((x - 1.0d0) * log(y)) + ((z - 1.0d0) * log((1.0d0 - y)))) - t
end function
public static double code(double x, double y, double z, double t) {
return (((x - 1.0) * Math.log(y)) + ((z - 1.0) * Math.log((1.0 - y)))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * math.log((1.0 - y)))) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(x - 1.0) * log(y)) + Float64(Float64(z - 1.0) * log(Float64(1.0 - y)))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * log((1.0 - y)))) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] + N[(N[(z - 1.0), $MachinePrecision] * N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \log \left(1 - y\right)\right) - t
\end{array}
(FPCore (x y z t) :precision binary64 (fma (- x 1.0) (log y) (fma (log1p (- y)) (- z 1.0) (- t))))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), fma(log1p(-y), (z - 1.0), -t));
}
function code(x, y, z, t) return fma(Float64(x - 1.0), log(y), fma(log1p(Float64(-y)), Float64(z - 1.0), Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[Log[1 + (-y)], $MachinePrecision] * N[(z - 1.0), $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, \mathsf{fma}\left(\mathsf{log1p}\left(-y\right), z - 1, -t\right)\right)
\end{array}
Initial program 91.7%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower-neg.f6499.8
Applied rewrites99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x))
(t_2 (+ (* (log (- 1.0 y)) (- z 1.0)) (* (log y) (- x 1.0)))))
(if (<= t_2 -8e+51) t_1 (if (<= t_2 2e+19) (- (- y (log y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double t_2 = (log((1.0 - y)) * (z - 1.0)) + (log(y) * (x - 1.0));
double tmp;
if (t_2 <= -8e+51) {
tmp = t_1;
} else if (t_2 <= 2e+19) {
tmp = (y - log(y)) - t;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = log(y) * x
t_2 = (log((1.0d0 - y)) * (z - 1.0d0)) + (log(y) * (x - 1.0d0))
if (t_2 <= (-8d+51)) then
tmp = t_1
else if (t_2 <= 2d+19) then
tmp = (y - log(y)) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double t_2 = (Math.log((1.0 - y)) * (z - 1.0)) + (Math.log(y) * (x - 1.0));
double tmp;
if (t_2 <= -8e+51) {
tmp = t_1;
} else if (t_2 <= 2e+19) {
tmp = (y - Math.log(y)) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x t_2 = (math.log((1.0 - y)) * (z - 1.0)) + (math.log(y) * (x - 1.0)) tmp = 0 if t_2 <= -8e+51: tmp = t_1 elif t_2 <= 2e+19: tmp = (y - math.log(y)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) t_2 = Float64(Float64(log(Float64(1.0 - y)) * Float64(z - 1.0)) + Float64(log(y) * Float64(x - 1.0))) tmp = 0.0 if (t_2 <= -8e+51) tmp = t_1; elseif (t_2 <= 2e+19) tmp = Float64(Float64(y - log(y)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; t_2 = (log((1.0 - y)) * (z - 1.0)) + (log(y) * (x - 1.0)); tmp = 0.0; if (t_2 <= -8e+51) tmp = t_1; elseif (t_2 <= 2e+19) tmp = (y - log(y)) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -8e+51], t$95$1, If[LessEqual[t$95$2, 2e+19], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := \log \left(1 - y\right) \cdot \left(z - 1\right) + \log y \cdot \left(x - 1\right)\\
\mathbf{if}\;t\_2 \leq -8 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+19}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -8e51 or 2e19 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) Initial program 94.3%
Taylor expanded in x around inf
lower-*.f64N/A
lower-log.f6475.6
Applied rewrites75.6%
if -8e51 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 2e19Initial program 89.3%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6498.9
Applied rewrites98.9%
Taylor expanded in z around 0
Applied rewrites88.0%
Taylor expanded in x around 0
Applied rewrites84.9%
Final simplification80.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x))
(t_2 (+ (* (log (- 1.0 y)) (- z 1.0)) (* (log y) (- x 1.0)))))
(if (<= t_2 -8e+51) t_1 (if (<= t_2 2e+19) (- (- (log y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double t_2 = (log((1.0 - y)) * (z - 1.0)) + (log(y) * (x - 1.0));
double tmp;
if (t_2 <= -8e+51) {
tmp = t_1;
} else if (t_2 <= 2e+19) {
tmp = -log(y) - t;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: tmp
t_1 = log(y) * x
t_2 = (log((1.0d0 - y)) * (z - 1.0d0)) + (log(y) * (x - 1.0d0))
if (t_2 <= (-8d+51)) then
tmp = t_1
else if (t_2 <= 2d+19) then
tmp = -log(y) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = Math.log(y) * x;
double t_2 = (Math.log((1.0 - y)) * (z - 1.0)) + (Math.log(y) * (x - 1.0));
double tmp;
if (t_2 <= -8e+51) {
tmp = t_1;
} else if (t_2 <= 2e+19) {
tmp = -Math.log(y) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = math.log(y) * x t_2 = (math.log((1.0 - y)) * (z - 1.0)) + (math.log(y) * (x - 1.0)) tmp = 0 if t_2 <= -8e+51: tmp = t_1 elif t_2 <= 2e+19: tmp = -math.log(y) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(log(y) * x) t_2 = Float64(Float64(log(Float64(1.0 - y)) * Float64(z - 1.0)) + Float64(log(y) * Float64(x - 1.0))) tmp = 0.0 if (t_2 <= -8e+51) tmp = t_1; elseif (t_2 <= 2e+19) tmp = Float64(Float64(-log(y)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = log(y) * x; t_2 = (log((1.0 - y)) * (z - 1.0)) + (log(y) * (x - 1.0)); tmp = 0.0; if (t_2 <= -8e+51) tmp = t_1; elseif (t_2 <= 2e+19) tmp = -log(y) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Log[N[(1.0 - y), $MachinePrecision]], $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -8e+51], t$95$1, If[LessEqual[t$95$2, 2e+19], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
t_2 := \log \left(1 - y\right) \cdot \left(z - 1\right) + \log y \cdot \left(x - 1\right)\\
\mathbf{if}\;t\_2 \leq -8 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+19}:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < -8e51 or 2e19 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) Initial program 94.3%
Taylor expanded in x around inf
lower-*.f64N/A
lower-log.f6475.6
Applied rewrites75.6%
if -8e51 < (+.f64 (*.f64 (-.f64 x #s(literal 1 binary64)) (log.f64 y)) (*.f64 (-.f64 z #s(literal 1 binary64)) (log.f64 (-.f64 #s(literal 1 binary64) y)))) < 2e19Initial program 89.3%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-log.f6496.0
Applied rewrites96.0%
Taylor expanded in y around 0
Applied rewrites84.1%
Final simplification80.1%
(FPCore (x y z t)
:precision binary64
(-
(+
(*
(* (fma (fma (fma -0.25 y -0.3333333333333333) y -0.5) y -1.0) y)
(- z 1.0))
(* (log y) (- x 1.0)))
t))
double code(double x, double y, double z, double t) {
return (((fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y) * (z - 1.0)) + (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(Float64(Float64(Float64(fma(fma(fma(-0.25, y, -0.3333333333333333), y, -0.5), y, -1.0) * y) * Float64(z - 1.0)) + Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(N[(N[(-0.25 * y + -0.3333333333333333), $MachinePrecision] * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.25, y, -0.3333333333333333\right), y, -0.5\right), y, -1\right) \cdot y\right) \cdot \left(z - 1\right) + \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 91.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6499.7
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (fma (- x 1.0) (log y) (fma (fma (* (fma -0.3333333333333333 y -0.5) (- z 1.0)) y (- 1.0 z)) y (- t))))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), fma(fma((fma(-0.3333333333333333, y, -0.5) * (z - 1.0)), y, (1.0 - z)), y, -t));
}
function code(x, y, z, t) return fma(Float64(x - 1.0), log(y), fma(fma(Float64(fma(-0.3333333333333333, y, -0.5) * Float64(z - 1.0)), y, Float64(1.0 - z)), y, Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * y + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * y + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot \left(z - 1\right), y, 1 - z\right), y, -t\right)\right)
\end{array}
Initial program 91.7%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower-neg.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (- (fma (fma (* (fma -0.3333333333333333 y -0.5) (- z 1.0)) y (- 1.0 z)) y (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma(fma((fma(-0.3333333333333333, y, -0.5) * (z - 1.0)), y, (1.0 - z)), y, (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(fma(Float64(fma(-0.3333333333333333, y, -0.5) * Float64(z - 1.0)), y, Float64(1.0 - z)), y, Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * y + N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * y + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right) \cdot \left(z - 1\right), y, 1 - z\right), y, \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 91.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.7%
Final simplification99.7%
(FPCore (x y z t) :precision binary64 (fma (- x 1.0) (log y) (fma (* (fma (fma -0.3333333333333333 y -0.5) y -1.0) y) (- z 1.0) (- t))))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), fma((fma(fma(-0.3333333333333333, y, -0.5), y, -1.0) * y), (z - 1.0), -t));
}
function code(x, y, z, t) return fma(Float64(x - 1.0), log(y), fma(Float64(fma(fma(-0.3333333333333333, y, -0.5), y, -1.0) * y), Float64(z - 1.0), Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(N[(-0.3333333333333333 * y + -0.5), $MachinePrecision] * y + -1.0), $MachinePrecision] * y), $MachinePrecision] * N[(z - 1.0), $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -1\right) \cdot y, z - 1, -t\right)\right)
\end{array}
Initial program 91.7%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower-neg.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6499.6
Applied rewrites99.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) (- x 1.0)) t)))
(if (<= (- x 1.0) -1.00000000005)
t_1
(if (<= (- x 1.0) -0.999999998)
(- (- (fma (- z 1.0) y (log y))) t)
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * (x - 1.0)) - t;
double tmp;
if ((x - 1.0) <= -1.00000000005) {
tmp = t_1;
} else if ((x - 1.0) <= -0.999999998) {
tmp = -fma((z - 1.0), y, log(y)) - t;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * Float64(x - 1.0)) - t) tmp = 0.0 if (Float64(x - 1.0) <= -1.00000000005) tmp = t_1; elseif (Float64(x - 1.0) <= -0.999999998) tmp = Float64(Float64(-fma(Float64(z - 1.0), y, log(y))) - t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[N[(x - 1.0), $MachinePrecision], -1.00000000005], t$95$1, If[LessEqual[N[(x - 1.0), $MachinePrecision], -0.999999998], N[((-N[(N[(z - 1.0), $MachinePrecision] * y + N[Log[y], $MachinePrecision]), $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot \left(x - 1\right) - t\\
\mathbf{if}\;x - 1 \leq -1.00000000005:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x - 1 \leq -0.999999998:\\
\;\;\;\;\left(-\mathsf{fma}\left(z - 1, y, \log y\right)\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.00000000005 or -0.999999997999999946 < (-.f64 x #s(literal 1 binary64)) Initial program 95.0%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6494.5
Applied rewrites94.5%
if -1.00000000005 < (-.f64 x #s(literal 1 binary64)) < -0.999999997999999946Initial program 88.0%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-log.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites98.9%
Final simplification96.6%
(FPCore (x y z t) :precision binary64 (fma (- x 1.0) (log y) (fma (* (fma -0.5 y -1.0) (- z 1.0)) y (- t))))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), fma((fma(-0.5, y, -1.0) * (z - 1.0)), y, -t));
}
function code(x, y, z, t) return fma(Float64(x - 1.0), log(y), fma(Float64(fma(-0.5, y, -1.0) * Float64(z - 1.0)), y, Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(-0.5 * y + -1.0), $MachinePrecision] * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * y + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, \mathsf{fma}\left(\mathsf{fma}\left(-0.5, y, -1\right) \cdot \left(z - 1\right), y, -t\right)\right)
\end{array}
Initial program 91.7%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower-neg.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-neg.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (- (fma (* (- z 1.0) y) (fma -0.5 y -1.0) (* (log y) (- x 1.0))) t))
double code(double x, double y, double z, double t) {
return fma(((z - 1.0) * y), fma(-0.5, y, -1.0), (log(y) * (x - 1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(Float64(z - 1.0) * y), fma(-0.5, y, -1.0), Float64(log(y) * Float64(x - 1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(z - 1.0), $MachinePrecision] * y), $MachinePrecision] * N[(-0.5 * y + -1.0), $MachinePrecision] + N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(z - 1\right) \cdot y, \mathsf{fma}\left(-0.5, y, -1\right), \log y \cdot \left(x - 1\right)\right) - t
\end{array}
Initial program 91.7%
Taylor expanded in y around 0
associate-*r*N/A
distribute-rgt-outN/A
+-commutativeN/A
metadata-evalN/A
sub-negN/A
associate-*r*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6499.5
Applied rewrites99.5%
Final simplification99.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) (- x 1.0))))
(if (<= t -1.75e-5)
(- (fma (- x 1.0) (log y) y) t)
(if (<= t 1e-37) (fma (- 1.0 z) y t_1) (- t_1 t)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * (x - 1.0);
double tmp;
if (t <= -1.75e-5) {
tmp = fma((x - 1.0), log(y), y) - t;
} else if (t <= 1e-37) {
tmp = fma((1.0 - z), y, t_1);
} else {
tmp = t_1 - t;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(log(y) * Float64(x - 1.0)) tmp = 0.0 if (t <= -1.75e-5) tmp = Float64(fma(Float64(x - 1.0), log(y), y) - t); elseif (t <= 1e-37) tmp = fma(Float64(1.0 - z), y, t_1); else tmp = Float64(t_1 - t); end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.75e-5], N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[t, 1e-37], N[(N[(1.0 - z), $MachinePrecision] * y + t$95$1), $MachinePrecision], N[(t$95$1 - t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot \left(x - 1\right)\\
\mathbf{if}\;t \leq -1.75 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(x - 1, \log y, y\right) - t\\
\mathbf{elif}\;t \leq 10^{-37}:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - t\\
\end{array}
\end{array}
if t < -1.7499999999999998e-5Initial program 96.8%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
Applied rewrites96.8%
if -1.7499999999999998e-5 < t < 1.00000000000000007e-37Initial program 86.3%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6498.2
Applied rewrites98.2%
Taylor expanded in t around 0
Applied rewrites98.2%
if 1.00000000000000007e-37 < t Initial program 95.6%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6495.6
Applied rewrites95.6%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (<= (- z 1.0) 1e+222) (- (fma (- x 1.0) (log y) y) t) (fma (- 1.0 z) y (* (log y) x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= 1e+222) {
tmp = fma((x - 1.0), log(y), y) - t;
} else {
tmp = fma((1.0 - z), y, (log(y) * x));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z - 1.0) <= 1e+222) tmp = Float64(fma(Float64(x - 1.0), log(y), y) - t); else tmp = fma(Float64(1.0 - z), y, Float64(log(y) * x)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z - 1.0), $MachinePrecision], 1e+222], N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision], N[(N[(1.0 - z), $MachinePrecision] * y + N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - 1 \leq 10^{+222}:\\
\;\;\;\;\mathsf{fma}\left(x - 1, \log y, y\right) - t\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, \log y \cdot x\right)\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < 1e222Initial program 94.3%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in z around 0
Applied rewrites93.2%
if 1e222 < (-.f64 z #s(literal 1 binary64)) Initial program 54.1%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites82.5%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (- (* (log y) x) t))) (if (<= x -1.0) t_1 (if (<= x 1.8e-15) (- (- y (log y)) t) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (log(y) * x) - t;
double tmp;
if (x <= -1.0) {
tmp = t_1;
} else if (x <= 1.8e-15) {
tmp = (y - log(y)) - t;
} else {
tmp = t_1;
}
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 = (log(y) * x) - t
if (x <= (-1.0d0)) then
tmp = t_1
else if (x <= 1.8d-15) then
tmp = (y - log(y)) - t
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (Math.log(y) * x) - t;
double tmp;
if (x <= -1.0) {
tmp = t_1;
} else if (x <= 1.8e-15) {
tmp = (y - Math.log(y)) - t;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (math.log(y) * x) - t tmp = 0 if x <= -1.0: tmp = t_1 elif x <= 1.8e-15: tmp = (y - math.log(y)) - t else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(log(y) * x) - t) tmp = 0.0 if (x <= -1.0) tmp = t_1; elseif (x <= 1.8e-15) tmp = Float64(Float64(y - log(y)) - t); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (log(y) * x) - t; tmp = 0.0; if (x <= -1.0) tmp = t_1; elseif (x <= 1.8e-15) tmp = (y - log(y)) - t; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -1.0], t$95$1, If[LessEqual[x, 1.8e-15], N[(N[(y - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;x \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-15}:\\
\;\;\;\;\left(y - \log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1 or 1.8000000000000001e-15 < x Initial program 94.4%
Taylor expanded in x around inf
lower-*.f64N/A
lower-log.f6492.7
Applied rewrites92.7%
if -1 < x < 1.8000000000000001e-15Initial program 88.7%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6498.9
Applied rewrites98.9%
Taylor expanded in z around 0
Applied rewrites87.1%
Taylor expanded in x around 0
Applied rewrites86.8%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (fma (- x 1.0) (log y) (fma (- 1.0 z) y (- t))))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), fma((1.0 - z), y, -t));
}
function code(x, y, z, t) return fma(Float64(x - 1.0), log(y), fma(Float64(1.0 - z), y, Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(1.0 - z), $MachinePrecision] * y + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, \mathsf{fma}\left(1 - z, y, -t\right)\right)
\end{array}
Initial program 91.7%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
sub-negN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower-neg.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
sub-negN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
distribute-lft-inN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
lower--.f64N/A
lower-neg.f6499.1
Applied rewrites99.1%
(FPCore (x y z t) :precision binary64 (fma (- 1.0 z) y (fma (- x 1.0) (log y) (- t))))
double code(double x, double y, double z, double t) {
return fma((1.0 - z), y, fma((x - 1.0), log(y), -t));
}
function code(x, y, z, t) return fma(Float64(1.0 - z), y, fma(Float64(x - 1.0), log(y), Float64(-t))) end
code[x_, y_, z_, t_] := N[(N[(1.0 - z), $MachinePrecision] * y + N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - z, y, \mathsf{fma}\left(x - 1, \log y, -t\right)\right)
\end{array}
Initial program 91.7%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6499.1
Applied rewrites99.1%
(FPCore (x y z t) :precision binary64 (fma (- z) y (fma (- x 1.0) (log y) (- t))))
double code(double x, double y, double z, double t) {
return fma(-z, y, fma((x - 1.0), log(y), -t));
}
function code(x, y, z, t) return fma(Float64(-z), y, fma(Float64(x - 1.0), log(y), Float64(-t))) end
code[x_, y_, z_, t_] := N[((-z) * y + N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-z, y, \mathsf{fma}\left(x - 1, \log y, -t\right)\right)
\end{array}
Initial program 91.7%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in z around inf
Applied rewrites98.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (log y) x))) (if (<= x -9.8e-11) t_1 (if (<= x 7.8e+133) (fma (- 1.0 z) y (- t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -9.8e-11) {
tmp = t_1;
} else if (x <= 7.8e+133) {
tmp = fma((1.0 - z), y, -t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(log(y) * x) tmp = 0.0 if (x <= -9.8e-11) tmp = t_1; elseif (x <= 7.8e+133) tmp = fma(Float64(1.0 - z), y, Float64(-t)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[x, -9.8e-11], t$95$1, If[LessEqual[x, 7.8e+133], N[(N[(1.0 - z), $MachinePrecision] * y + (-t)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -9.8 \cdot 10^{-11}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+133}:\\
\;\;\;\;\mathsf{fma}\left(1 - z, y, -t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -9.7999999999999998e-11 or 7.80000000000000028e133 < x Initial program 96.3%
Taylor expanded in x around inf
lower-*.f64N/A
lower-log.f6479.3
Applied rewrites79.3%
if -9.7999999999999998e-11 < x < 7.80000000000000028e133Initial program 88.3%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6498.7
Applied rewrites98.7%
Taylor expanded in t around inf
Applied rewrites64.6%
Final simplification70.8%
(FPCore (x y z t) :precision binary64 (- (fma (- x 1.0) (log y) y) t))
double code(double x, double y, double z, double t) {
return fma((x - 1.0), log(y), y) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(x - 1.0), log(y), y) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(x - 1.0), $MachinePrecision] * N[Log[y], $MachinePrecision] + y), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x - 1, \log y, y\right) - t
\end{array}
Initial program 91.7%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in z around 0
Applied rewrites90.6%
(FPCore (x y z t) :precision binary64 (- (* (log y) (- x 1.0)) t))
double code(double x, double y, double z, double t) {
return (log(y) * (x - 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) * (x - 1.0d0)) - t
end function
public static double code(double x, double y, double z, double t) {
return (Math.log(y) * (x - 1.0)) - t;
}
def code(x, y, z, t): return (math.log(y) * (x - 1.0)) - t
function code(x, y, z, t) return Float64(Float64(log(y) * Float64(x - 1.0)) - t) end
function tmp = code(x, y, z, t) tmp = (log(y) * (x - 1.0)) - t; end
code[x_, y_, z_, t_] := N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\log y \cdot \left(x - 1\right) - t
\end{array}
Initial program 91.7%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6490.2
Applied rewrites90.2%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2.3e-51) (- t) (if (<= t 1.75e-6) (* (- 1.0 z) y) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.3e-51) {
tmp = -t;
} else if (t <= 1.75e-6) {
tmp = (1.0 - 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 <= (-2.3d-51)) then
tmp = -t
else if (t <= 1.75d-6) then
tmp = (1.0d0 - 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 <= -2.3e-51) {
tmp = -t;
} else if (t <= 1.75e-6) {
tmp = (1.0 - z) * y;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.3e-51: tmp = -t elif t <= 1.75e-6: tmp = (1.0 - z) * y else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.3e-51) tmp = Float64(-t); elseif (t <= 1.75e-6) tmp = Float64(Float64(1.0 - z) * y); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.3e-51) tmp = -t; elseif (t <= 1.75e-6) tmp = (1.0 - z) * y; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.3e-51], (-t), If[LessEqual[t, 1.75e-6], N[(N[(1.0 - z), $MachinePrecision] * y), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-51}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\left(1 - z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -2.30000000000000002e-51 or 1.74999999999999997e-6 < t Initial program 96.0%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6466.8
Applied rewrites66.8%
if -2.30000000000000002e-51 < t < 1.74999999999999997e-6Initial program 86.4%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6498.2
Applied rewrites98.2%
Taylor expanded in z around inf
Applied rewrites15.8%
Taylor expanded in y around inf
Applied rewrites16.6%
(FPCore (x y z t) :precision binary64 (if (<= t -2.3e-51) (- t) (if (<= t 1.75e-6) (* (- z) y) (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.3e-51) {
tmp = -t;
} else if (t <= 1.75e-6) {
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 <= (-2.3d-51)) then
tmp = -t
else if (t <= 1.75d-6) 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 <= -2.3e-51) {
tmp = -t;
} else if (t <= 1.75e-6) {
tmp = -z * y;
} else {
tmp = -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.3e-51: tmp = -t elif t <= 1.75e-6: tmp = -z * y else: tmp = -t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.3e-51) tmp = Float64(-t); elseif (t <= 1.75e-6) tmp = Float64(Float64(-z) * y); else tmp = Float64(-t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.3e-51) tmp = -t; elseif (t <= 1.75e-6) tmp = -z * y; else tmp = -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.3e-51], (-t), If[LessEqual[t, 1.75e-6], N[((-z) * y), $MachinePrecision], (-t)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{-51}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\left(-z\right) \cdot y\\
\mathbf{else}:\\
\;\;\;\;-t\\
\end{array}
\end{array}
if t < -2.30000000000000002e-51 or 1.74999999999999997e-6 < t Initial program 96.0%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6466.8
Applied rewrites66.8%
if -2.30000000000000002e-51 < t < 1.74999999999999997e-6Initial program 86.4%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6498.2
Applied rewrites98.2%
Taylor expanded in z around inf
Applied rewrites15.8%
Final simplification43.7%
(FPCore (x y z t) :precision binary64 (fma (- 1.0 z) y (- t)))
double code(double x, double y, double z, double t) {
return fma((1.0 - z), y, -t);
}
function code(x, y, z, t) return fma(Float64(1.0 - z), y, Float64(-t)) end
code[x_, y_, z_, t_] := N[(N[(1.0 - z), $MachinePrecision] * y + (-t)), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(1 - z, y, -t\right)
\end{array}
Initial program 91.7%
Taylor expanded in y around 0
associate--l+N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
neg-sub0N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
associate--r+N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower-neg.f6499.1
Applied rewrites99.1%
Taylor expanded in t around inf
Applied rewrites45.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 91.7%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6437.7
Applied rewrites37.7%
herbie shell --seed 2024268
(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))