
(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 18 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) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
return fma((z - 1.0), log1p(-y), ((log(y) * (x - 1.0)) - t));
}
function code(x, y, z, t) return fma(Float64(z - 1.0), log1p(Float64(-y)), Float64(Float64(log(y) * Float64(x - 1.0)) - t)) end
code[x_, y_, z_, t_] := N[(N[(z - 1.0), $MachinePrecision] * N[Log[1 + (-y)], $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z - 1, \mathsf{log1p}\left(-y\right), \log y \cdot \left(x - 1\right) - t\right)
\end{array}
Initial program 86.2%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower--.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -0.136) (not (<= x 34000000000.0)))
(* (log y) x)
(-
(* (fma (- (* -0.5 y) 1.0) y (/ (* (* (+ (pow y -1.0) 0.5) y) y) z)) z)
t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -0.136) || !(x <= 34000000000.0)) {
tmp = log(y) * x;
} else {
tmp = (fma(((-0.5 * y) - 1.0), y, ((((pow(y, -1.0) + 0.5) * y) * y) / z)) * z) - t;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((x <= -0.136) || !(x <= 34000000000.0)) tmp = Float64(log(y) * x); else tmp = Float64(Float64(fma(Float64(Float64(-0.5 * y) - 1.0), y, Float64(Float64(Float64(Float64((y ^ -1.0) + 0.5) * y) * y) / z)) * z) - t); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -0.136], N[Not[LessEqual[x, 34000000000.0]], $MachinePrecision]], N[(N[Log[y], $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y + N[(N[(N[(N[(N[Power[y, -1.0], $MachinePrecision] + 0.5), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.136 \lor \neg \left(x \leq 34000000000\right):\\
\;\;\;\;\log y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - 1, y, \frac{\left(\left({y}^{-1} + 0.5\right) \cdot y\right) \cdot y}{z}\right) \cdot z - t\\
\end{array}
\end{array}
if x < -0.13600000000000001 or 3.4e10 < x Initial program 92.5%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower--.f6499.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6474.9
Applied rewrites74.9%
if -0.13600000000000001 < x < 3.4e10Initial program 80.1%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites98.8%
Taylor expanded in z around inf
Applied rewrites98.7%
Taylor expanded in y around inf
Applied rewrites59.7%
Final simplification67.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* (log y) x) t)))
(if (<= x -0.136)
t_1
(if (<= x -1.22e-173)
(-
(* (fma (- (* -0.5 y) 1.0) y (/ (* (* (+ (pow y -1.0) 0.5) y) y) z)) z)
t)
(if (<= x 1.0) (- (- (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 <= -0.136) {
tmp = t_1;
} else if (x <= -1.22e-173) {
tmp = (fma(((-0.5 * y) - 1.0), y, ((((pow(y, -1.0) + 0.5) * y) * y) / z)) * z) - t;
} else if (x <= 1.0) {
tmp = -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 <= -0.136) tmp = t_1; elseif (x <= -1.22e-173) tmp = Float64(Float64(fma(Float64(Float64(-0.5 * y) - 1.0), y, Float64(Float64(Float64(Float64((y ^ -1.0) + 0.5) * y) * y) / z)) * z) - t); elseif (x <= 1.0) tmp = Float64(Float64(-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] * x), $MachinePrecision] - t), $MachinePrecision]}, If[LessEqual[x, -0.136], t$95$1, If[LessEqual[x, -1.22e-173], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y + N[(N[(N[(N[(N[Power[y, -1.0], $MachinePrecision] + 0.5), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 1.0], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x - t\\
\mathbf{if}\;x \leq -0.136:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.22 \cdot 10^{-173}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - 1, y, \frac{\left(\left({y}^{-1} + 0.5\right) \cdot y\right) \cdot y}{z}\right) \cdot z - t\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -0.13600000000000001 or 1 < x Initial program 92.5%
Taylor expanded in x around inf
*-commutativeN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f6490.3
Applied rewrites90.3%
if -0.13600000000000001 < x < -1.21999999999999993e-173Initial program 66.5%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites96.7%
Taylor expanded in z around inf
Applied rewrites96.6%
Taylor expanded in y around inf
Applied rewrites73.6%
if -1.21999999999999993e-173 < x < 1Initial program 84.9%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
mul-1-negN/A
distribute-rgt-out--N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-outN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
mul-1-negN/A
log-recN/A
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites84.3%
Final simplification85.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (log y) x)))
(if (<= x -0.136)
t_1
(if (<= x -1.22e-173)
(-
(* (fma (- (* -0.5 y) 1.0) y (/ (* (* (+ (pow y -1.0) 0.5) y) y) z)) z)
t)
(if (<= x 215000.0) (- (- (log y)) t) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = log(y) * x;
double tmp;
if (x <= -0.136) {
tmp = t_1;
} else if (x <= -1.22e-173) {
tmp = (fma(((-0.5 * y) - 1.0), y, ((((pow(y, -1.0) + 0.5) * y) * y) / z)) * z) - t;
} else if (x <= 215000.0) {
tmp = -log(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 <= -0.136) tmp = t_1; elseif (x <= -1.22e-173) tmp = Float64(Float64(fma(Float64(Float64(-0.5 * y) - 1.0), y, Float64(Float64(Float64(Float64((y ^ -1.0) + 0.5) * y) * y) / z)) * z) - t); elseif (x <= 215000.0) tmp = Float64(Float64(-log(y)) - 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, -0.136], t$95$1, If[LessEqual[x, -1.22e-173], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y + N[(N[(N[(N[(N[Power[y, -1.0], $MachinePrecision] + 0.5), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision], If[LessEqual[x, 215000.0], N[((-N[Log[y], $MachinePrecision]) - t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \log y \cdot x\\
\mathbf{if}\;x \leq -0.136:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.22 \cdot 10^{-173}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 \cdot y - 1, y, \frac{\left(\left({y}^{-1} + 0.5\right) \cdot y\right) \cdot y}{z}\right) \cdot z - t\\
\mathbf{elif}\;x \leq 215000:\\
\;\;\;\;\left(-\log y\right) - t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -0.13600000000000001 or 215000 < x Initial program 92.5%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower--.f6499.6
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f6474.3
Applied rewrites74.3%
if -0.13600000000000001 < x < -1.21999999999999993e-173Initial program 66.5%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites96.7%
Taylor expanded in z around inf
Applied rewrites96.6%
Taylor expanded in y around inf
Applied rewrites73.6%
if -1.21999999999999993e-173 < x < 215000Initial program 84.9%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
mul-1-negN/A
distribute-rgt-out--N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-outN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
mul-1-negN/A
log-recN/A
Applied rewrites84.4%
Taylor expanded in x around 0
Applied rewrites84.3%
Final simplification77.9%
(FPCore (x y z t) :precision binary64 (fma (- z 1.0) (* (- (* (- (* (- (* -0.25 y) 0.3333333333333333) y) 0.5) y) 1.0) y) (- (* (log y) (- x 1.0)) t)))
double code(double x, double y, double z, double t) {
return fma((z - 1.0), (((((((-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) - 1.0) * y), ((log(y) * (x - 1.0)) - t));
}
function code(x, y, z, t) return fma(Float64(z - 1.0), Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.25 * y) - 0.3333333333333333) * y) - 0.5) * y) - 1.0) * y), Float64(Float64(log(y) * Float64(x - 1.0)) - t)) end
code[x_, y_, z_, t_] := N[(N[(z - 1.0), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(-0.25 * y), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * y), $MachinePrecision] - 0.5), $MachinePrecision] * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] + N[(N[(N[Log[y], $MachinePrecision] * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z - 1, \left(\left(\left(-0.25 \cdot y - 0.3333333333333333\right) \cdot y - 0.5\right) \cdot y - 1\right) \cdot y, \log y \cdot \left(x - 1\right) - t\right)
\end{array}
Initial program 86.2%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower--.f6499.8
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
(FPCore (x y z t) :precision binary64 (- (* (fma (- (* -0.5 y) 1.0) y (/ (* (* (+ (pow y -1.0) 0.5) y) y) z)) z) t))
double code(double x, double y, double z, double t) {
return (fma(((-0.5 * y) - 1.0), y, ((((pow(y, -1.0) + 0.5) * y) * y) / z)) * z) - t;
}
function code(x, y, z, t) return Float64(Float64(fma(Float64(Float64(-0.5 * y) - 1.0), y, Float64(Float64(Float64(Float64((y ^ -1.0) + 0.5) * y) * y) / z)) * z) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y + N[(N[(N[(N[(N[Power[y, -1.0], $MachinePrecision] + 0.5), $MachinePrecision] * y), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.5 \cdot y - 1, y, \frac{\left(\left({y}^{-1} + 0.5\right) \cdot y\right) \cdot y}{z}\right) \cdot z - t
\end{array}
Initial program 86.2%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.2%
Taylor expanded in z around inf
Applied rewrites90.0%
Taylor expanded in y around inf
Applied rewrites42.1%
Final simplification42.1%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 x) (log y) (* (fma (* (- z 1.0) (fma -0.3333333333333333 y -0.5)) y (- (- z 1.0))) y)) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + x), log(y), (fma(((z - 1.0) * fma(-0.3333333333333333, y, -0.5)), y, -(z - 1.0)) * y)) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + x), log(y), Float64(fma(Float64(Float64(z - 1.0) * fma(-0.3333333333333333, y, -0.5)), y, Float64(-Float64(z - 1.0))) * y)) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(N[(z - 1.0), $MachinePrecision] * N[(-0.3333333333333333 * y + -0.5), $MachinePrecision]), $MachinePrecision] * y + (-N[(z - 1.0), $MachinePrecision])), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + x, \log y, \mathsf{fma}\left(\left(z - 1\right) \cdot \mathsf{fma}\left(-0.3333333333333333, y, -0.5\right), y, -\left(z - 1\right)\right) \cdot y\right) - t
\end{array}
Initial program 86.2%
Taylor expanded in y around 0
+-commutativeN/A
Applied rewrites99.4%
(FPCore (x y z t) :precision binary64 (- (+ (* (- x 1.0) (log y)) (* (- z 1.0) (* (- (* -0.5 y) 1.0) y))) t))
double code(double x, double y, double z, double t) {
return (((x - 1.0) * log(y)) + ((z - 1.0) * (((-0.5 * y) - 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) * ((((-0.5d0) * y) - 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) * (((-0.5 * y) - 1.0) * y))) - t;
}
def code(x, y, z, t): return (((x - 1.0) * math.log(y)) + ((z - 1.0) * (((-0.5 * y) - 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) * Float64(Float64(Float64(-0.5 * y) - 1.0) * y))) - t) end
function tmp = code(x, y, z, t) tmp = (((x - 1.0) * log(y)) + ((z - 1.0) * (((-0.5 * y) - 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[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - 1\right) \cdot \log y + \left(z - 1\right) \cdot \left(\left(-0.5 \cdot y - 1\right) \cdot y\right)\right) - t
\end{array}
Initial program 86.2%
Taylor expanded in y around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-*.f6499.2
Applied rewrites99.2%
Final simplification99.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (- x 1.0) -1.1) (not (<= (- x 1.0) 200000000.0))) (- (* (+ -1.0 x) (log y)) t) (- (- (* (- y) (- z 1.0)) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x - 1.0) <= -1.1) || !((x - 1.0) <= 200000000.0)) {
tmp = ((-1.0 + x) * log(y)) - t;
} else {
tmp = ((-y * (z - 1.0)) - 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) <= (-1.1d0)) .or. (.not. ((x - 1.0d0) <= 200000000.0d0))) then
tmp = (((-1.0d0) + x) * log(y)) - t
else
tmp = ((-y * (z - 1.0d0)) - 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) <= -1.1) || !((x - 1.0) <= 200000000.0)) {
tmp = ((-1.0 + x) * Math.log(y)) - t;
} else {
tmp = ((-y * (z - 1.0)) - Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x - 1.0) <= -1.1) or not ((x - 1.0) <= 200000000.0): tmp = ((-1.0 + x) * math.log(y)) - t else: tmp = ((-y * (z - 1.0)) - math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x - 1.0) <= -1.1) || !(Float64(x - 1.0) <= 200000000.0)) tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); else tmp = Float64(Float64(Float64(Float64(-y) * Float64(z - 1.0)) - log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x - 1.0) <= -1.1) || ~(((x - 1.0) <= 200000000.0))) tmp = ((-1.0 + x) * log(y)) - t; else tmp = ((-y * (z - 1.0)) - log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x - 1.0), $MachinePrecision], -1.1], N[Not[LessEqual[N[(x - 1.0), $MachinePrecision], 200000000.0]], $MachinePrecision]], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[((-y) * N[(z - 1.0), $MachinePrecision]), $MachinePrecision] - N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x - 1 \leq -1.1 \lor \neg \left(x - 1 \leq 200000000\right):\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-y\right) \cdot \left(z - 1\right) - \log y\right) - t\\
\end{array}
\end{array}
if (-.f64 x #s(literal 1 binary64)) < -1.1000000000000001 or 2e8 < (-.f64 x #s(literal 1 binary64)) Initial program 92.5%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
mul-1-negN/A
distribute-rgt-out--N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-outN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
mul-1-negN/A
log-recN/A
Applied rewrites92.1%
if -1.1000000000000001 < (-.f64 x #s(literal 1 binary64)) < 2e8Initial program 80.1%
Taylor expanded in x around 0
+-commutativeN/A
distribute-rgt-out--N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
distribute-rgt-outN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-log.f64N/A
lower--.f64N/A
remove-double-negN/A
distribute-rgt-neg-inN/A
log-recN/A
lower-neg.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f6480.0
Applied rewrites80.0%
Taylor expanded in y around 0
Applied rewrites98.2%
Final simplification95.2%
(FPCore (x y z t) :precision binary64 (- (fma (+ -1.0 x) (log y) (* (* (- z 1.0) y) (fma -0.5 y -1.0))) t))
double code(double x, double y, double z, double t) {
return fma((-1.0 + x), log(y), (((z - 1.0) * y) * fma(-0.5, y, -1.0))) - t;
}
function code(x, y, z, t) return Float64(fma(Float64(-1.0 + x), log(y), Float64(Float64(Float64(z - 1.0) * y) * fma(-0.5, y, -1.0))) - t) end
code[x_, y_, z_, t_] := N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(N[(N[(z - 1.0), $MachinePrecision] * y), $MachinePrecision] * N[(-0.5 * y + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-1 + x, \log y, \left(\left(z - 1\right) \cdot y\right) \cdot \mathsf{fma}\left(-0.5, y, -1\right)\right) - t
\end{array}
Initial program 86.2%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.2%
(FPCore (x y z t) :precision binary64 (fma (- y) (- z 1.0) (fma (+ -1.0 x) (log y) (- t))))
double code(double x, double y, double z, double t) {
return fma(-y, (z - 1.0), fma((-1.0 + x), log(y), -t));
}
function code(x, y, z, t) return fma(Float64(-y), Float64(z - 1.0), fma(Float64(-1.0 + x), log(y), Float64(-t))) end
code[x_, y_, z_, t_] := N[((-y) * N[(z - 1.0), $MachinePrecision] + N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision] + (-t)), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-y, z - 1, \mathsf{fma}\left(-1 + x, \log y, -t\right)\right)
\end{array}
Initial program 86.2%
Taylor expanded in y around 0
associate--l+N/A
associate-*r*N/A
mul-1-negN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower--.f64N/A
*-rgt-identityN/A
fp-cancel-sub-sign-invN/A
Applied rewrites98.9%
(FPCore (x y z t) :precision binary64 (if (<= (- z 1.0) -2e+250) (- (* (* (- (* -0.5 y) 1.0) y) z) t) (- (* (+ -1.0 x) (log y)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z - 1.0) <= -2e+250) {
tmp = ((((-0.5 * y) - 1.0) * y) * z) - t;
} else {
tmp = ((-1.0 + 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 ((z - 1.0d0) <= (-2d+250)) then
tmp = (((((-0.5d0) * y) - 1.0d0) * y) * z) - t
else
tmp = (((-1.0d0) + 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 ((z - 1.0) <= -2e+250) {
tmp = ((((-0.5 * y) - 1.0) * y) * z) - t;
} else {
tmp = ((-1.0 + x) * Math.log(y)) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z - 1.0) <= -2e+250: tmp = ((((-0.5 * y) - 1.0) * y) * z) - t else: tmp = ((-1.0 + x) * math.log(y)) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z - 1.0) <= -2e+250) tmp = Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * y) * z) - t); else tmp = Float64(Float64(Float64(-1.0 + x) * log(y)) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z - 1.0) <= -2e+250) tmp = ((((-0.5 * y) - 1.0) * y) * z) - t; else tmp = ((-1.0 + x) * log(y)) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z - 1.0), $MachinePrecision], -2e+250], N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision], N[(N[(N[(-1.0 + x), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision] - t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z - 1 \leq -2 \cdot 10^{+250}:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot y\right) \cdot z - t\\
\mathbf{else}:\\
\;\;\;\;\left(-1 + x\right) \cdot \log y - t\\
\end{array}
\end{array}
if (-.f64 z #s(literal 1 binary64)) < -1.9999999999999998e250Initial program 34.2%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.9%
Taylor expanded in y around inf
Applied rewrites28.6%
Taylor expanded in z around inf
Applied rewrites86.8%
if -1.9999999999999998e250 < (-.f64 z #s(literal 1 binary64)) Initial program 88.8%
Taylor expanded in y around 0
remove-double-negN/A
log-recN/A
mul-1-negN/A
distribute-rgt-out--N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-outN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
mul-1-negN/A
log-recN/A
Applied rewrites87.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3e+52) (not (<= t 14200.0))) (- t) (* (* (- (* -0.5 y) 1.0) y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e+52) || !(t <= 14200.0)) {
tmp = -t;
} else {
tmp = (((-0.5 * y) - 1.0) * y) * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-3d+52)) .or. (.not. (t <= 14200.0d0))) then
tmp = -t
else
tmp = ((((-0.5d0) * y) - 1.0d0) * y) * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e+52) || !(t <= 14200.0)) {
tmp = -t;
} else {
tmp = (((-0.5 * y) - 1.0) * y) * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3e+52) or not (t <= 14200.0): tmp = -t else: tmp = (((-0.5 * y) - 1.0) * y) * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3e+52) || !(t <= 14200.0)) tmp = Float64(-t); else tmp = Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * y) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3e+52) || ~((t <= 14200.0))) tmp = -t; else tmp = (((-0.5 * y) - 1.0) * y) * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3e+52], N[Not[LessEqual[t, 14200.0]], $MachinePrecision]], (-t), N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+52} \lor \neg \left(t \leq 14200\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot y\right) \cdot z\\
\end{array}
\end{array}
if t < -3e52 or 14200 < t Initial program 94.8%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
if -3e52 < t < 14200Initial program 80.8%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower--.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f643.7
Applied rewrites3.7%
Taylor expanded in y around 0
Applied rewrites20.7%
Final simplification39.1%
(FPCore (x y z t)
:precision binary64
(if (<= t -3e+52)
(- t)
(if (<= t 14200.0)
(* (* (- (* -0.5 y) 1.0) y) z)
(- (* (* (* y y) z) -0.5) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3e+52) {
tmp = -t;
} else if (t <= 14200.0) {
tmp = (((-0.5 * y) - 1.0) * y) * z;
} else {
tmp = (((y * y) * z) * -0.5) - 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 <= (-3d+52)) then
tmp = -t
else if (t <= 14200.0d0) then
tmp = ((((-0.5d0) * y) - 1.0d0) * y) * z
else
tmp = (((y * y) * z) * (-0.5d0)) - t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3e+52) {
tmp = -t;
} else if (t <= 14200.0) {
tmp = (((-0.5 * y) - 1.0) * y) * z;
} else {
tmp = (((y * y) * z) * -0.5) - t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3e+52: tmp = -t elif t <= 14200.0: tmp = (((-0.5 * y) - 1.0) * y) * z else: tmp = (((y * y) * z) * -0.5) - t return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3e+52) tmp = Float64(-t); elseif (t <= 14200.0) tmp = Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * y) * z); else tmp = Float64(Float64(Float64(Float64(y * y) * z) * -0.5) - t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3e+52) tmp = -t; elseif (t <= 14200.0) tmp = (((-0.5 * y) - 1.0) * y) * z; else tmp = (((y * y) * z) * -0.5) - t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3e+52], (-t), If[LessEqual[t, 14200.0], N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision], N[(N[(N[(N[(y * y), $MachinePrecision] * z), $MachinePrecision] * -0.5), $MachinePrecision] - t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+52}:\\
\;\;\;\;-t\\
\mathbf{elif}\;t \leq 14200:\\
\;\;\;\;\left(\left(-0.5 \cdot y - 1\right) \cdot y\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y \cdot y\right) \cdot z\right) \cdot -0.5 - t\\
\end{array}
\end{array}
if t < -3e52Initial program 97.7%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6473.7
Applied rewrites73.7%
if -3e52 < t < 14200Initial program 80.8%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower--.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f643.7
Applied rewrites3.7%
Taylor expanded in y around 0
Applied rewrites20.7%
if 14200 < t Initial program 92.9%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.1%
Taylor expanded in y around inf
Applied rewrites65.8%
Taylor expanded in z around inf
Applied rewrites65.8%
Final simplification39.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3e+52) (not (<= t 14200.0))) (- t) (* (* z (fma -0.5 y -1.0)) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e+52) || !(t <= 14200.0)) {
tmp = -t;
} else {
tmp = (z * fma(-0.5, y, -1.0)) * y;
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if ((t <= -3e+52) || !(t <= 14200.0)) tmp = Float64(-t); else tmp = Float64(Float64(z * fma(-0.5, y, -1.0)) * y); end return tmp end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3e+52], N[Not[LessEqual[t, 14200.0]], $MachinePrecision]], (-t), N[(N[(z * N[(-0.5 * y + -1.0), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+52} \lor \neg \left(t \leq 14200\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \mathsf{fma}\left(-0.5, y, -1\right)\right) \cdot y\\
\end{array}
\end{array}
if t < -3e52 or 14200 < t Initial program 94.8%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
if -3e52 < t < 14200Initial program 80.8%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower--.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f643.7
Applied rewrites3.7%
Taylor expanded in y around 0
Applied rewrites20.7%
Final simplification39.1%
(FPCore (x y z t) :precision binary64 (- (* (* (- (* -0.5 y) 1.0) y) z) t))
double code(double x, double y, double z, double t) {
return ((((-0.5 * y) - 1.0) * y) * z) - t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = (((((-0.5d0) * y) - 1.0d0) * y) * z) - t
end function
public static double code(double x, double y, double z, double t) {
return ((((-0.5 * y) - 1.0) * y) * z) - t;
}
def code(x, y, z, t): return ((((-0.5 * y) - 1.0) * y) * z) - t
function code(x, y, z, t) return Float64(Float64(Float64(Float64(Float64(-0.5 * y) - 1.0) * y) * z) - t) end
function tmp = code(x, y, z, t) tmp = ((((-0.5 * y) - 1.0) * y) * z) - t; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(N[(-0.5 * y), $MachinePrecision] - 1.0), $MachinePrecision] * y), $MachinePrecision] * z), $MachinePrecision] - t), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-0.5 \cdot y - 1\right) \cdot y\right) \cdot z - t
\end{array}
Initial program 86.2%
Taylor expanded in y around 0
+-commutativeN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
mul-1-negN/A
Applied rewrites99.2%
Taylor expanded in y around inf
Applied rewrites29.7%
Taylor expanded in z around inf
Applied rewrites41.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3e+52) (not (<= t 14200.0))) (- t) (* (- y) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e+52) || !(t <= 14200.0)) {
tmp = -t;
} else {
tmp = -y * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-3d+52)) .or. (.not. (t <= 14200.0d0))) then
tmp = -t
else
tmp = -y * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3e+52) || !(t <= 14200.0)) {
tmp = -t;
} else {
tmp = -y * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3e+52) or not (t <= 14200.0): tmp = -t else: tmp = -y * z return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3e+52) || !(t <= 14200.0)) tmp = Float64(-t); else tmp = Float64(Float64(-y) * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3e+52) || ~((t <= 14200.0))) tmp = -t; else tmp = -y * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3e+52], N[Not[LessEqual[t, 14200.0]], $MachinePrecision]], (-t), N[((-y) * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{+52} \lor \neg \left(t \leq 14200\right):\\
\;\;\;\;-t\\
\mathbf{else}:\\
\;\;\;\;\left(-y\right) \cdot z\\
\end{array}
\end{array}
if t < -3e52 or 14200 < t Initial program 94.8%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6468.8
Applied rewrites68.8%
if -3e52 < t < 14200Initial program 80.8%
lift--.f64N/A
lift-+.f64N/A
+-commutativeN/A
associate--l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-log.f64N/A
lift--.f64N/A
*-lft-identityN/A
fp-cancel-sub-sign-invN/A
distribute-lft-neg-inN/A
*-lft-identityN/A
lower-log1p.f64N/A
lower-neg.f64N/A
lower--.f6499.7
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-log.f64N/A
lower--.f643.7
Applied rewrites3.7%
Taylor expanded in y around 0
Applied rewrites20.5%
Final simplification39.0%
(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 86.2%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6428.9
Applied rewrites28.9%
herbie shell --seed 2024329
(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))