
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + y) - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (- (+ (- x (* (+ y 0.5) (log y))) y) z))
double code(double x, double y, double z) {
return ((x - ((y + 0.5) * log(y))) + y) - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((x - ((y + 0.5d0) * log(y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - ((y + 0.5) * Math.log(y))) + y) - z;
}
def code(x, y, z): return ((x - ((y + 0.5) * math.log(y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - ((y + 0.5) * log(y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
\end{array}
(FPCore (x y z) :precision binary64 (+ x (fma (log y) (- -0.5 y) (- y z))))
double code(double x, double y, double z) {
return x + fma(log(y), (-0.5 - y), (y - z));
}
function code(x, y, z) return Float64(x + fma(log(y), Float64(-0.5 - y), Float64(y - z))) end
code[x_, y_, z_] := N[(x + N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(\log y, -0.5 - y, y - z\right)
\end{array}
Initial program 99.8%
associate--l+N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
--lowering--.f64N/A
metadata-evalN/A
--lowering--.f6499.9
Applied egg-rr99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))))
(if (<= t_0 -1e+75)
(fma (log y) (- y) y)
(if (<= t_0 -1e+14)
(- x z)
(if (<= t_0 500.0) (- (* (log y) -0.5) z) (- x z))))))
double code(double x, double y, double z) {
double t_0 = y + (x - (log(y) * (y + 0.5)));
double tmp;
if (t_0 <= -1e+75) {
tmp = fma(log(y), -y, y);
} else if (t_0 <= -1e+14) {
tmp = x - z;
} else if (t_0 <= 500.0) {
tmp = (log(y) * -0.5) - z;
} else {
tmp = x - z;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) tmp = 0.0 if (t_0 <= -1e+75) tmp = fma(log(y), Float64(-y), y); elseif (t_0 <= -1e+14) tmp = Float64(x - z); elseif (t_0 <= 500.0) tmp = Float64(Float64(log(y) * -0.5) - z); else tmp = Float64(x - z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+75], N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision], If[LessEqual[t$95$0, -1e+14], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], N[(x - z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -y, y\right)\\
\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+14}:\\
\;\;\;\;x - z\\
\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -9.99999999999999927e74Initial program 99.6%
Taylor expanded in y around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-inN/A
log-recN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
mul-1-negN/A
neg-lowering-neg.f6463.5
Simplified63.5%
if -9.99999999999999927e74 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1e14 or 500 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial program 99.9%
Taylor expanded in x around inf
Simplified89.0%
if -1e14 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 500Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f6498.2
Simplified98.2%
Taylor expanded in y around 0
metadata-evalN/A
distribute-lft-neg-inN/A
--lowering--.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6494.5
Simplified94.5%
Final simplification77.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))))
(if (<= t_0 -1e+75)
(- y (* y (log y)))
(if (<= t_0 -1e+14)
(- x z)
(if (<= t_0 500.0) (- (* (log y) -0.5) z) (- x z))))))
double code(double x, double y, double z) {
double t_0 = y + (x - (log(y) * (y + 0.5)));
double tmp;
if (t_0 <= -1e+75) {
tmp = y - (y * log(y));
} else if (t_0 <= -1e+14) {
tmp = x - z;
} else if (t_0 <= 500.0) {
tmp = (log(y) * -0.5) - z;
} else {
tmp = x - z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = y + (x - (log(y) * (y + 0.5d0)))
if (t_0 <= (-1d+75)) then
tmp = y - (y * log(y))
else if (t_0 <= (-1d+14)) then
tmp = x - z
else if (t_0 <= 500.0d0) then
tmp = (log(y) * (-0.5d0)) - z
else
tmp = x - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y + (x - (Math.log(y) * (y + 0.5)));
double tmp;
if (t_0 <= -1e+75) {
tmp = y - (y * Math.log(y));
} else if (t_0 <= -1e+14) {
tmp = x - z;
} else if (t_0 <= 500.0) {
tmp = (Math.log(y) * -0.5) - z;
} else {
tmp = x - z;
}
return tmp;
}
def code(x, y, z): t_0 = y + (x - (math.log(y) * (y + 0.5))) tmp = 0 if t_0 <= -1e+75: tmp = y - (y * math.log(y)) elif t_0 <= -1e+14: tmp = x - z elif t_0 <= 500.0: tmp = (math.log(y) * -0.5) - z else: tmp = x - z return tmp
function code(x, y, z) t_0 = Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) tmp = 0.0 if (t_0 <= -1e+75) tmp = Float64(y - Float64(y * log(y))); elseif (t_0 <= -1e+14) tmp = Float64(x - z); elseif (t_0 <= 500.0) tmp = Float64(Float64(log(y) * -0.5) - z); else tmp = Float64(x - z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y + (x - (log(y) * (y + 0.5))); tmp = 0.0; if (t_0 <= -1e+75) tmp = y - (y * log(y)); elseif (t_0 <= -1e+14) tmp = x - z; elseif (t_0 <= 500.0) tmp = (log(y) * -0.5) - z; else tmp = x - z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+75], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -1e+14], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], N[(x - z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+75}:\\
\;\;\;\;y - y \cdot \log y\\
\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+14}:\\
\;\;\;\;x - z\\
\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -9.99999999999999927e74Initial program 99.6%
Taylor expanded in y around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-inN/A
log-recN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
mul-1-negN/A
neg-lowering-neg.f6463.5
Simplified63.5%
+-commutativeN/A
distribute-rgt-neg-outN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6463.4
Applied egg-rr63.4%
if -9.99999999999999927e74 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1e14 or 500 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial program 99.9%
Taylor expanded in x around inf
Simplified89.0%
if -1e14 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 500Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f6498.2
Simplified98.2%
Taylor expanded in y around 0
metadata-evalN/A
distribute-lft-neg-inN/A
--lowering--.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6494.5
Simplified94.5%
Final simplification77.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (- (+ y (- x (* (log y) (+ y 0.5)))) z))) (if (<= t_0 -1e+14) (- x z) (if (<= t_0 500.0) (* (log y) -0.5) (- x z)))))
double code(double x, double y, double z) {
double t_0 = (y + (x - (log(y) * (y + 0.5)))) - z;
double tmp;
if (t_0 <= -1e+14) {
tmp = x - z;
} else if (t_0 <= 500.0) {
tmp = log(y) * -0.5;
} else {
tmp = x - z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (y + (x - (log(y) * (y + 0.5d0)))) - z
if (t_0 <= (-1d+14)) then
tmp = x - z
else if (t_0 <= 500.0d0) then
tmp = log(y) * (-0.5d0)
else
tmp = x - z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y + (x - (Math.log(y) * (y + 0.5)))) - z;
double tmp;
if (t_0 <= -1e+14) {
tmp = x - z;
} else if (t_0 <= 500.0) {
tmp = Math.log(y) * -0.5;
} else {
tmp = x - z;
}
return tmp;
}
def code(x, y, z): t_0 = (y + (x - (math.log(y) * (y + 0.5)))) - z tmp = 0 if t_0 <= -1e+14: tmp = x - z elif t_0 <= 500.0: tmp = math.log(y) * -0.5 else: tmp = x - z return tmp
function code(x, y, z) t_0 = Float64(Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) - z) tmp = 0.0 if (t_0 <= -1e+14) tmp = Float64(x - z); elseif (t_0 <= 500.0) tmp = Float64(log(y) * -0.5); else tmp = Float64(x - z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y + (x - (log(y) * (y + 0.5)))) - z; tmp = 0.0; if (t_0 <= -1e+14) tmp = x - z; elseif (t_0 <= 500.0) tmp = log(y) * -0.5; else tmp = x - z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+14], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision], N[(x - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\right) - z\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+14}:\\
\;\;\;\;x - z\\
\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;\log y \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -1e14 or 500 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) Initial program 99.8%
Taylor expanded in x around inf
Simplified61.4%
if -1e14 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < 500Initial program 99.9%
Taylor expanded in x around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f6496.5
Simplified96.5%
Taylor expanded in y around 0
metadata-evalN/A
distribute-lft-neg-inN/A
--lowering--.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6489.2
Simplified89.2%
Taylor expanded in z around 0
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6486.6
Simplified86.6%
Final simplification64.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))))
(if (<= t_0 -2000000000.0)
(- y (fma y (log y) z))
(if (<= t_0 500.0) (- (* (log y) -0.5) z) (- x z)))))
double code(double x, double y, double z) {
double t_0 = y + (x - (log(y) * (y + 0.5)));
double tmp;
if (t_0 <= -2000000000.0) {
tmp = y - fma(y, log(y), z);
} else if (t_0 <= 500.0) {
tmp = (log(y) * -0.5) - z;
} else {
tmp = x - z;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) tmp = 0.0 if (t_0 <= -2000000000.0) tmp = Float64(y - fma(y, log(y), z)); elseif (t_0 <= 500.0) tmp = Float64(Float64(log(y) * -0.5) - z); else tmp = Float64(x - z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(y + N[(x - N[(N[Log[y], $MachinePrecision] * N[(y + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2000000000.0], N[(y - N[(y * N[Log[y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(N[(N[Log[y], $MachinePrecision] * -0.5), $MachinePrecision] - z), $MachinePrecision], N[(x - z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\\
\mathbf{if}\;t\_0 \leq -2000000000:\\
\;\;\;\;y - \mathsf{fma}\left(y, \log y, z\right)\\
\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;\log y \cdot -0.5 - z\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -2e9Initial program 99.6%
Taylor expanded in y around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-inN/A
log-recN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
mul-1-negN/A
neg-lowering-neg.f6475.0
Simplified75.0%
Taylor expanded in y around 0
mul-1-negN/A
log-recN/A
log-recN/A
sub-negN/A
distribute-lft-out--N/A
*-rgt-identityN/A
associate--l-N/A
+-commutativeN/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6474.9
Simplified74.9%
if -2e9 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 500Initial program 100.0%
Taylor expanded in x around 0
sub-negN/A
+-commutativeN/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
--lowering--.f6498.2
Simplified98.2%
Taylor expanded in y around 0
metadata-evalN/A
distribute-lft-neg-inN/A
--lowering--.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6496.1
Simplified96.1%
if 500 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial program 100.0%
Taylor expanded in x around inf
Simplified98.4%
Final simplification84.0%
(FPCore (x y z) :precision binary64 (if (<= y 0.28) (- (fma (log y) -0.5 x) z) (- (+ y (- x (* y (log y)))) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 0.28) {
tmp = fma(log(y), -0.5, x) - z;
} else {
tmp = (y + (x - (y * log(y)))) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 0.28) tmp = Float64(fma(log(y), -0.5, x) - z); else tmp = Float64(Float64(y + Float64(x - Float64(y * log(y)))) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 0.28], N[(N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision] - z), $MachinePrecision], N[(N[(y + N[(x - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.28:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(y + \left(x - y \cdot \log y\right)\right) - z\\
\end{array}
\end{array}
if y < 0.28000000000000003Initial program 100.0%
Taylor expanded in y around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6498.9
Simplified98.9%
if 0.28000000000000003 < y Initial program 99.6%
Taylor expanded in y around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
log-recN/A
remove-double-negN/A
*-lowering-*.f64N/A
log-lowering-log.f6499.4
Simplified99.4%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= y 2.6e+66) (- (fma (log y) -0.5 x) z) (fma y (- 1.0 (log y)) x)))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.6e+66) {
tmp = fma(log(y), -0.5, x) - z;
} else {
tmp = fma(y, (1.0 - log(y)), x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 2.6e+66) tmp = Float64(fma(log(y), -0.5, x) - z); else tmp = fma(y, Float64(1.0 - log(y)), x); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 2.6e+66], N[(N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision] - z), $MachinePrecision], N[(y * N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.6 \cdot 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \log y, x\right)\\
\end{array}
\end{array}
if y < 2.60000000000000012e66Initial program 99.9%
Taylor expanded in y around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6494.1
Simplified94.1%
if 2.60000000000000012e66 < y Initial program 99.6%
*-commutativeN/A
flip-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
log-lowering-log.f64N/A
clear-numN/A
flip-+N/A
/-lowering-/.f64N/A
+-lowering-+.f6499.5
Applied egg-rr99.5%
Taylor expanded in y around inf
/-lowering-/.f6499.5
Simplified99.5%
Taylor expanded in z around 0
associate--l+N/A
+-commutativeN/A
sub-negN/A
+-commutativeN/A
+-commutativeN/A
sub-negN/A
*-rgt-identityN/A
distribute-lft-out--N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
log-lowering-log.f6491.6
Simplified91.6%
(FPCore (x y z) :precision binary64 (if (<= y 9.5e+104) (- (fma (log y) -0.5 x) z) (- y (fma y (log y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 9.5e+104) {
tmp = fma(log(y), -0.5, x) - z;
} else {
tmp = y - fma(y, log(y), z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 9.5e+104) tmp = Float64(fma(log(y), -0.5, x) - z); else tmp = Float64(y - fma(y, log(y), z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 9.5e+104], N[(N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(y * N[Log[y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9.5 \cdot 10^{+104}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - \mathsf{fma}\left(y, \log y, z\right)\\
\end{array}
\end{array}
if y < 9.5e104Initial program 99.9%
Taylor expanded in y around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6489.0
Simplified89.0%
if 9.5e104 < y Initial program 99.5%
Taylor expanded in y around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-inN/A
log-recN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
mul-1-negN/A
neg-lowering-neg.f6483.2
Simplified83.2%
Taylor expanded in y around 0
mul-1-negN/A
log-recN/A
log-recN/A
sub-negN/A
distribute-lft-out--N/A
*-rgt-identityN/A
associate--l-N/A
+-commutativeN/A
--lowering--.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6483.1
Simplified83.1%
(FPCore (x y z) :precision binary64 (if (<= y 1.15e+132) (- x z) (- y (* y (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.15e+132) {
tmp = x - z;
} else {
tmp = y - (y * log(y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= 1.15d+132) then
tmp = x - z
else
tmp = y - (y * log(y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 1.15e+132) {
tmp = x - z;
} else {
tmp = y - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 1.15e+132: tmp = x - z else: tmp = y - (y * math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 1.15e+132) tmp = Float64(x - z); else tmp = Float64(y - Float64(y * log(y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 1.15e+132) tmp = x - z; else tmp = y - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 1.15e+132], N[(x - z), $MachinePrecision], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{+132}:\\
\;\;\;\;x - z\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \log y\\
\end{array}
\end{array}
if y < 1.1500000000000001e132Initial program 99.9%
Taylor expanded in x around inf
Simplified71.7%
if 1.1500000000000001e132 < y Initial program 99.5%
Taylor expanded in y around inf
sub-negN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
distribute-rgt-inN/A
log-recN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
mul-1-negN/A
neg-lowering-neg.f6477.6
Simplified77.6%
+-commutativeN/A
distribute-rgt-neg-outN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6477.5
Applied egg-rr77.5%
(FPCore (x y z) :precision binary64 (if (<= z -1.05e+121) (- z) (if (<= z 1e+144) x (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e+121) {
tmp = -z;
} else if (z <= 1e+144) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1.05d+121)) then
tmp = -z
else if (z <= 1d+144) then
tmp = x
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.05e+121) {
tmp = -z;
} else if (z <= 1e+144) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.05e+121: tmp = -z elif z <= 1e+144: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.05e+121) tmp = Float64(-z); elseif (z <= 1e+144) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.05e+121) tmp = -z; elseif (z <= 1e+144) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.05e+121], (-z), If[LessEqual[z, 1e+144], x, (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+121}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 10^{+144}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -1.0500000000000001e121 or 1.00000000000000002e144 < z Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f6467.2
Simplified67.2%
if -1.0500000000000001e121 < z < 1.00000000000000002e144Initial program 99.8%
Taylor expanded in x around inf
Simplified40.2%
(FPCore (x y z) :precision binary64 (- x z))
double code(double x, double y, double z) {
return x - z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - z
end function
public static double code(double x, double y, double z) {
return x - z;
}
def code(x, y, z): return x - z
function code(x, y, z) return Float64(x - z) end
function tmp = code(x, y, z) tmp = x - z; end
code[x_, y_, z_] := N[(x - z), $MachinePrecision]
\begin{array}{l}
\\
x - z
\end{array}
Initial program 99.8%
Taylor expanded in x around inf
Simplified55.2%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
Taylor expanded in x around inf
Simplified32.7%
(FPCore (x y z) :precision binary64 (- (- (+ y x) z) (* (+ y 0.5) (log y))))
double code(double x, double y, double z) {
return ((y + x) - z) - ((y + 0.5) * log(y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((y + x) - z) - ((y + 0.5d0) * log(y))
end function
public static double code(double x, double y, double z) {
return ((y + x) - z) - ((y + 0.5) * Math.log(y));
}
def code(x, y, z): return ((y + x) - z) - ((y + 0.5) * math.log(y))
function code(x, y, z) return Float64(Float64(Float64(y + x) - z) - Float64(Float64(y + 0.5) * log(y))) end
function tmp = code(x, y, z) tmp = ((y + x) - z) - ((y + 0.5) * log(y)); end
code[x_, y_, z_] := N[(N[(N[(y + x), $MachinePrecision] - z), $MachinePrecision] - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(y + x\right) - z\right) - \left(y + 0.5\right) \cdot \log y
\end{array}
herbie shell --seed 2024204
(FPCore (x y z)
:name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
:precision binary64
:alt
(! :herbie-platform default (- (- (+ y x) z) (* (+ y 1/2) (log y))))
(- (+ (- x (* (+ y 0.5) (log y))) y) z))