
(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 (- -0.5 y) (log y) y)) z))
double code(double x, double y, double z) {
return (x + fma((-0.5 - y), log(y), y)) - z;
}
function code(x, y, z) return Float64(Float64(x + fma(Float64(-0.5 - y), log(y), y)) - z) end
code[x_, y_, z_] := N[(N[(x + N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(x + \mathsf{fma}\left(-0.5 - y, \log y, y\right)\right) - z
\end{array}
Initial program 99.8%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
associate-+l+N/A
lower-+.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
lower--.f64N/A
metadata-eval99.8
Applied rewrites99.8%
(FPCore (x y z)
:precision binary64
(if (<= z -0.00045)
(- y (fma (+ 0.5 y) (log y) z))
(if (<= z 2e+110)
(fma (- -0.5 y) (log y) (+ x y))
(- (fma -0.5 (log y) x) z))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.00045) {
tmp = y - fma((0.5 + y), log(y), z);
} else if (z <= 2e+110) {
tmp = fma((-0.5 - y), log(y), (x + y));
} else {
tmp = fma(-0.5, log(y), x) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (z <= -0.00045) tmp = Float64(y - fma(Float64(0.5 + y), log(y), z)); elseif (z <= 2e+110) tmp = fma(Float64(-0.5 - y), log(y), Float64(x + y)); else tmp = Float64(fma(-0.5, log(y), x) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[z, -0.00045], N[(y - N[(N[(0.5 + y), $MachinePrecision] * N[Log[y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+110], N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00045:\\
\;\;\;\;y - \mathsf{fma}\left(0.5 + y, \log y, z\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+110}:\\
\;\;\;\;\mathsf{fma}\left(-0.5 - y, \log y, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\end{array}
\end{array}
if z < -4.4999999999999999e-4Initial program 99.8%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-log.f6493.8
Applied rewrites93.8%
if -4.4999999999999999e-4 < z < 2e110Initial program 99.7%
lift--.f64N/A
flip--N/A
clear-numN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6499.5
lift--.f64N/A
lift-+.f64N/A
Applied rewrites99.5%
Taylor expanded in z around 0
mul-1-negN/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
distribute-neg-inN/A
mul-1-negN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f64N/A
lower-+.f6496.9
Applied rewrites96.9%
if 2e110 < z Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
*-commutativeN/A
cancel-sign-sub-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6495.8
Applied rewrites95.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -57000000.0) (not (<= x 21000.0))) (- (+ (* (- x) -1.0) y) z) (fma -0.5 (log y) (- z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -57000000.0) || !(x <= 21000.0)) {
tmp = ((-x * -1.0) + y) - z;
} else {
tmp = fma(-0.5, log(y), -z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -57000000.0) || !(x <= 21000.0)) tmp = Float64(Float64(Float64(Float64(-x) * -1.0) + y) - z); else tmp = fma(-0.5, log(y), Float64(-z)); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -57000000.0], N[Not[LessEqual[x, 21000.0]], $MachinePrecision]], N[(N[(N[((-x) * -1.0), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision], N[(-0.5 * N[Log[y], $MachinePrecision] + (-z)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -57000000 \lor \neg \left(x \leq 21000\right):\\
\;\;\;\;\left(\left(-x\right) \cdot -1 + y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, -z\right)\\
\end{array}
\end{array}
if x < -5.7e7 or 21000 < x Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip3-+N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
lift-+.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-log.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites73.6%
if -5.7e7 < x < 21000Initial program 99.7%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-log.f6499.7
Applied rewrites99.7%
Taylor expanded in y around 0
Applied rewrites58.2%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (if (<= y 2.85e-8) (- (fma -0.5 (log y) x) z) (- (+ x (fma (- y) (log y) y)) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.85e-8) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = (x + fma(-y, log(y), y)) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 2.85e-8) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = Float64(Float64(x + fma(Float64(-y), log(y), y)) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 2.85e-8], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(N[(x + N[((-y) * N[Log[y], $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.85 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(x + \mathsf{fma}\left(-y, \log y, y\right)\right) - z\\
\end{array}
\end{array}
if y < 2.85000000000000004e-8Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
*-commutativeN/A
cancel-sign-sub-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6499.5
Applied rewrites99.5%
if 2.85000000000000004e-8 < y Initial program 99.6%
lift-+.f64N/A
lift--.f64N/A
sub-negN/A
associate-+l+N/A
lower-+.f64N/A
lift-*.f64N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
unsub-negN/A
lower--.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in y around inf
mul-1-negN/A
lower-neg.f6499.1
Applied rewrites99.1%
(FPCore (x y z) :precision binary64 (if (<= y 10000000000.0) (- (fma -0.5 (log y) x) z) (- y (fma (+ 0.5 y) (log y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 10000000000.0) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = y - fma((0.5 + y), log(y), z);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 10000000000.0) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = Float64(y - fma(Float64(0.5 + y), log(y), z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 10000000000.0], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(N[(0.5 + y), $MachinePrecision] * N[Log[y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10000000000:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - \mathsf{fma}\left(0.5 + y, \log y, z\right)\\
\end{array}
\end{array}
if y < 1e10Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
*-commutativeN/A
cancel-sign-sub-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6498.6
Applied rewrites98.6%
if 1e10 < y Initial program 99.6%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-log.f6488.7
Applied rewrites88.7%
(FPCore (x y z) :precision binary64 (if (<= y 74000000000.0) (- (fma -0.5 (log y) x) z) (- (fma (- y) (log y) y) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 74000000000.0) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = fma(-y, log(y), y) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 74000000000.0) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = Float64(fma(Float64(-y), log(y), y) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 74000000000.0], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(N[((-y) * N[Log[y], $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 74000000000:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-y, \log y, y\right) - z\\
\end{array}
\end{array}
if y < 7.4e10Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
*-commutativeN/A
cancel-sign-sub-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6498.6
Applied rewrites98.6%
if 7.4e10 < y Initial program 99.6%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip3-+N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
lift-+.f64N/A
lower-/.f6499.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.5
Applied rewrites99.5%
Taylor expanded in x around 0
sub-negN/A
+-commutativeN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
unsub-negN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f6488.7
Applied rewrites88.7%
Taylor expanded in y around inf
Applied rewrites88.6%
(FPCore (x y z) :precision binary64 (if (<= y 1.6e+112) (- (fma -0.5 (log y) x) z) (- y (* (+ 0.5 y) (log y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.6e+112) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = y - ((0.5 + y) * log(y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 1.6e+112) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = Float64(y - Float64(Float64(0.5 + y) * log(y))); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 1.6e+112], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(N[(0.5 + y), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.6 \cdot 10^{+112}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - \left(0.5 + y\right) \cdot \log y\\
\end{array}
\end{array}
if y < 1.59999999999999993e112Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
*-commutativeN/A
cancel-sign-sub-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6488.7
Applied rewrites88.7%
if 1.59999999999999993e112 < y Initial program 99.6%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-log.f6491.5
Applied rewrites91.5%
Taylor expanded in z around 0
Applied rewrites75.9%
(FPCore (x y z) :precision binary64 (if (<= y 1.6e+112) (- (fma -0.5 (log y) x) z) (- y (* (log y) y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.6e+112) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = y - (log(y) * y);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 1.6e+112) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = Float64(y - Float64(log(y) * y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 1.6e+112], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(y - N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.6 \cdot 10^{+112}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;y - \log y \cdot y\\
\end{array}
\end{array}
if y < 1.59999999999999993e112Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
*-commutativeN/A
cancel-sign-sub-invN/A
+-commutativeN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6488.7
Applied rewrites88.7%
if 1.59999999999999993e112 < y Initial program 99.6%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-log.f6491.5
Applied rewrites91.5%
Taylor expanded in y around inf
Applied rewrites75.9%
(FPCore (x y z) :precision binary64 (if (<= y 9e+77) (- (+ (* (- x) -1.0) y) z) (* (- 1.0 (log y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 9e+77) {
tmp = ((-x * -1.0) + y) - z;
} else {
tmp = (1.0 - log(y)) * 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 <= 9d+77) then
tmp = ((-x * (-1.0d0)) + y) - z
else
tmp = (1.0d0 - log(y)) * y
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= 9e+77) {
tmp = ((-x * -1.0) + y) - z;
} else {
tmp = (1.0 - Math.log(y)) * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 9e+77: tmp = ((-x * -1.0) + y) - z else: tmp = (1.0 - math.log(y)) * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 9e+77) tmp = Float64(Float64(Float64(Float64(-x) * -1.0) + y) - z); else tmp = Float64(Float64(1.0 - log(y)) * y); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= 9e+77) tmp = ((-x * -1.0) + y) - z; else tmp = (1.0 - log(y)) * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 9e+77], N[(N[(N[((-x) * -1.0), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 9 \cdot 10^{+77}:\\
\;\;\;\;\left(\left(-x\right) \cdot -1 + y\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\end{array}
\end{array}
if y < 9.00000000000000049e77Initial program 99.9%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip3-+N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
lift-+.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-log.f6499.2
Applied rewrites99.2%
Taylor expanded in x around inf
Applied rewrites77.2%
if 9.00000000000000049e77 < y Initial program 99.6%
Taylor expanded in y around inf
*-commutativeN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6471.7
Applied rewrites71.7%
(FPCore (x y z) :precision binary64 (- (+ (* (- x) -1.0) y) z))
double code(double x, double y, double z) {
return ((-x * -1.0) + 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 * (-1.0d0)) + y) - z
end function
public static double code(double x, double y, double z) {
return ((-x * -1.0) + y) - z;
}
def code(x, y, z): return ((-x * -1.0) + y) - z
function code(x, y, z) return Float64(Float64(Float64(Float64(-x) * -1.0) + y) - z) end
function tmp = code(x, y, z) tmp = ((-x * -1.0) + y) - z; end
code[x_, y_, z_] := N[(N[(N[((-x) * -1.0), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(-x\right) \cdot -1 + y\right) - z
\end{array}
Initial program 99.8%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip3-+N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip3-+N/A
lift-+.f64N/A
lower-/.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
Taylor expanded in x around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
sub-negN/A
associate-/l*N/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-log.f6486.1
Applied rewrites86.1%
Taylor expanded in x around inf
Applied rewrites56.2%
(FPCore (x y z) :precision binary64 (- z))
double code(double x, double y, double z) {
return -z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -z
end function
public static double code(double x, double y, double z) {
return -z;
}
def code(x, y, z): return -z
function code(x, y, z) return Float64(-z) end
function tmp = code(x, y, z) tmp = -z; end
code[x_, y_, z_] := (-z)
\begin{array}{l}
\\
-z
\end{array}
Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6431.9
Applied rewrites31.9%
(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 2024324
(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))