
(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 11 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(Float64(x + fma(log(y), Float64(-0.5 - y), y)) - z) end
code[x_, y_, z_] := N[(N[(x + N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \mathsf{fma}\left(\log y, -0.5 - y, y\right)\right) - z
\end{array}
Initial program 99.8%
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-eval99.9
Applied egg-rr99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))))
(if (<= t_0 -2e+106)
(fma (log y) (- y) y)
(if (<= t_0 -400000.0)
(- x z)
(if (<= t_0 325.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 <= -2e+106) {
tmp = fma(log(y), -y, y);
} else if (t_0 <= -400000.0) {
tmp = x - z;
} else if (t_0 <= 325.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 <= -2e+106) tmp = fma(log(y), Float64(-y), y); elseif (t_0 <= -400000.0) tmp = Float64(x - z); elseif (t_0 <= 325.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, -2e+106], N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision], If[LessEqual[t$95$0, -400000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 325.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 -2 \cdot 10^{+106}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -y, y\right)\\
\mathbf{elif}\;t\_0 \leq -400000:\\
\;\;\;\;x - z\\
\mathbf{elif}\;t\_0 \leq 325:\\
\;\;\;\;\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) < -2.00000000000000018e106Initial 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.6
Simplified63.6%
if -2.00000000000000018e106 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -4e5 or 325 < (+.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
Simplified85.8%
if -4e5 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 325Initial 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--.f64100.0
Simplified100.0%
Taylor expanded in y around 0
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6497.5
Simplified97.5%
Final simplification79.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))))
(if (<= t_0 -2e+106)
(- y (* y (log y)))
(if (<= t_0 -400000.0)
(- x z)
(if (<= t_0 325.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 <= -2e+106) {
tmp = y - (y * log(y));
} else if (t_0 <= -400000.0) {
tmp = x - z;
} else if (t_0 <= 325.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 <= (-2d+106)) then
tmp = y - (y * log(y))
else if (t_0 <= (-400000.0d0)) then
tmp = x - z
else if (t_0 <= 325.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 <= -2e+106) {
tmp = y - (y * Math.log(y));
} else if (t_0 <= -400000.0) {
tmp = x - z;
} else if (t_0 <= 325.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 <= -2e+106: tmp = y - (y * math.log(y)) elif t_0 <= -400000.0: tmp = x - z elif t_0 <= 325.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 <= -2e+106) tmp = Float64(y - Float64(y * log(y))); elseif (t_0 <= -400000.0) tmp = Float64(x - z); elseif (t_0 <= 325.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 <= -2e+106) tmp = y - (y * log(y)); elseif (t_0 <= -400000.0) tmp = x - z; elseif (t_0 <= 325.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, -2e+106], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -400000.0], N[(x - z), $MachinePrecision], If[LessEqual[t$95$0, 325.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 -2 \cdot 10^{+106}:\\
\;\;\;\;y - y \cdot \log y\\
\mathbf{elif}\;t\_0 \leq -400000:\\
\;\;\;\;x - z\\
\mathbf{elif}\;t\_0 \leq 325:\\
\;\;\;\;\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) < -2.00000000000000018e106Initial 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.6
Simplified63.6%
+-commutativeN/A
distribute-rgt-neg-outN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6463.5
Applied egg-rr63.5%
if -2.00000000000000018e106 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -4e5 or 325 < (+.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
Simplified85.8%
if -4e5 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 325Initial 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--.f64100.0
Simplified100.0%
Taylor expanded in y around 0
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6497.5
Simplified97.5%
Final simplification79.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ y (- x (* (log y) (+ y 0.5))))) (t_1 (fma (log y) (- y) y)))
(if (<= t_0 -5e+218)
(+ x t_1)
(if (<= t_0 -1e+50) (- t_1 z) (- (fma (log y) -0.5 x) z)))))
double code(double x, double y, double z) {
double t_0 = y + (x - (log(y) * (y + 0.5)));
double t_1 = fma(log(y), -y, y);
double tmp;
if (t_0 <= -5e+218) {
tmp = x + t_1;
} else if (t_0 <= -1e+50) {
tmp = t_1 - z;
} else {
tmp = fma(log(y), -0.5, x) - z;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(y + Float64(x - Float64(log(y) * Float64(y + 0.5)))) t_1 = fma(log(y), Float64(-y), y) tmp = 0.0 if (t_0 <= -5e+218) tmp = Float64(x + t_1); elseif (t_0 <= -1e+50) tmp = Float64(t_1 - z); else tmp = Float64(fma(log(y), -0.5, 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]}, Block[{t$95$1 = N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+218], N[(x + t$95$1), $MachinePrecision], If[LessEqual[t$95$0, -1e+50], N[(t$95$1 - z), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision] - z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + \left(x - \log y \cdot \left(y + 0.5\right)\right)\\
t_1 := \mathsf{fma}\left(\log y, -y, y\right)\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+218}:\\
\;\;\;\;x + t\_1\\
\mathbf{elif}\;t\_0 \leq -1 \cdot 10^{+50}:\\
\;\;\;\;t\_1 - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -4.99999999999999983e218Initial program 99.6%
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-eval99.7
Applied egg-rr99.7%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-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.4
Simplified96.4%
Taylor expanded in y around inf
+-commutativeN/A
distribute-rgt-inN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
mul-1-negN/A
neg-lowering-neg.f6496.4
Simplified96.4%
if -4.99999999999999983e218 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1.0000000000000001e50Initial program 99.7%
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.f6488.8
Simplified88.8%
if -1.0000000000000001e50 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial 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.f6496.8
Simplified96.8%
Final simplification94.7%
(FPCore (x y z) :precision binary64 (if (<= z -16600000000000.0) (- x z) (if (<= z 210.0) (fma (log y) -0.5 x) (- x z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -16600000000000.0) {
tmp = x - z;
} else if (z <= 210.0) {
tmp = fma(log(y), -0.5, x);
} else {
tmp = x - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -16600000000000.0) tmp = Float64(x - z); elseif (z <= 210.0) tmp = fma(log(y), -0.5, x); else tmp = Float64(x - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -16600000000000.0], N[(x - z), $MachinePrecision], If[LessEqual[z, 210.0], N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision], N[(x - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -16600000000000:\\
\;\;\;\;x - z\\
\mathbf{elif}\;z \leq 210:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - z\\
\end{array}
\end{array}
if z < -1.66e13 or 210 < z Initial program 99.9%
Taylor expanded in x around inf
Simplified82.7%
if -1.66e13 < z < 210Initial program 99.7%
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-eval99.8
Applied egg-rr99.8%
Taylor expanded in y around 0
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
--lowering--.f6456.7
Simplified56.7%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f6456.7
Simplified56.7%
(FPCore (x y z) :precision binary64 (if (<= y 1.7e+56) (- (fma (log y) -0.5 x) z) (+ x (fma (log y) (- y) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.7e+56) {
tmp = fma(log(y), -0.5, x) - z;
} else {
tmp = x + fma(log(y), -y, y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 1.7e+56) tmp = Float64(fma(log(y), -0.5, x) - z); else tmp = Float64(x + fma(log(y), Float64(-y), y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 1.7e+56], N[(N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision] - z), $MachinePrecision], N[(x + N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.7 \cdot 10^{+56}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;x + \mathsf{fma}\left(\log y, -y, y\right)\\
\end{array}
\end{array}
if y < 1.7e56Initial 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.f6496.8
Simplified96.8%
if 1.7e56 < y Initial program 99.6%
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-eval99.7
Applied egg-rr99.7%
Taylor expanded in z around 0
+-commutativeN/A
+-lowering-+.f64N/A
mul-1-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--.f6484.8
Simplified84.8%
Taylor expanded in y around inf
+-commutativeN/A
distribute-rgt-inN/A
log-recN/A
mul-1-negN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
accelerator-lowering-fma.f64N/A
log-lowering-log.f64N/A
mul-1-negN/A
neg-lowering-neg.f6484.8
Simplified84.8%
Final simplification91.6%
(FPCore (x y z) :precision binary64 (if (<= y 1.1e+91) (- (fma (log y) -0.5 x) z) (fma (log y) (- y) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.1e+91) {
tmp = fma(log(y), -0.5, x) - z;
} else {
tmp = fma(log(y), -y, y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 1.1e+91) tmp = Float64(fma(log(y), -0.5, x) - z); else tmp = fma(log(y), Float64(-y), y); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 1.1e+91], N[(N[(N[Log[y], $MachinePrecision] * -0.5 + x), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.1 \cdot 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -y, y\right)\\
\end{array}
\end{array}
if y < 1.1e91Initial 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.f6493.0
Simplified93.0%
if 1.1e91 < y Initial 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.f6467.1
Simplified67.1%
(FPCore (x y z) :precision binary64 (if (<= y 4.8e+69) (- (+ x y) z) (- y (* y (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.8e+69) {
tmp = (x + y) - 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 <= 4.8d+69) then
tmp = (x + y) - 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 <= 4.8e+69) {
tmp = (x + y) - z;
} else {
tmp = y - (y * Math.log(y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.8e+69: tmp = (x + y) - z else: tmp = y - (y * math.log(y)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.8e+69) tmp = Float64(Float64(x + y) - 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 <= 4.8e+69) tmp = (x + y) - z; else tmp = y - (y * log(y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.8e+69], N[(N[(x + y), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(y * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.8 \cdot 10^{+69}:\\
\;\;\;\;\left(x + y\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - y \cdot \log y\\
\end{array}
\end{array}
if y < 4.8000000000000003e69Initial program 100.0%
Taylor expanded in x around inf
Simplified80.7%
if 4.8000000000000003e69 < y Initial 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.f6465.6
Simplified65.6%
+-commutativeN/A
distribute-rgt-neg-outN/A
unsub-negN/A
--lowering--.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
log-lowering-log.f6465.5
Applied egg-rr65.5%
(FPCore (x y z) :precision binary64 (if (<= z -8.2e+80) (- z) (if (<= z 3.7e+80) x (- z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.2e+80) {
tmp = -z;
} else if (z <= 3.7e+80) {
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 <= (-8.2d+80)) then
tmp = -z
else if (z <= 3.7d+80) 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 <= -8.2e+80) {
tmp = -z;
} else if (z <= 3.7e+80) {
tmp = x;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.2e+80: tmp = -z elif z <= 3.7e+80: tmp = x else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.2e+80) tmp = Float64(-z); elseif (z <= 3.7e+80) tmp = x; else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.2e+80) tmp = -z; elseif (z <= 3.7e+80) tmp = x; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.2e+80], (-z), If[LessEqual[z, 3.7e+80], x, (-z)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+80}:\\
\;\;\;\;-z\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+80}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if z < -8.20000000000000003e80 or 3.69999999999999996e80 < z Initial program 99.9%
Taylor expanded in z around inf
mul-1-negN/A
neg-lowering-neg.f6470.1
Simplified70.1%
if -8.20000000000000003e80 < z < 3.69999999999999996e80Initial program 99.8%
Taylor expanded in x around inf
Simplified39.1%
(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
Simplified61.3%
(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
Simplified29.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 2024199
(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))