
(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 10 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 (* (+ 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}
Initial program 99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (- x (* (+ y 0.5) (log y))) y)))
(if (<= t_0 -5e+58)
(* (- 1.0 (log y)) y)
(if (<= t_0 500.0) (- (* -0.5 (log y)) z) (fma (/ (- z) x) x x)))))
double code(double x, double y, double z) {
double t_0 = (x - ((y + 0.5) * log(y))) + y;
double tmp;
if (t_0 <= -5e+58) {
tmp = (1.0 - log(y)) * y;
} else if (t_0 <= 500.0) {
tmp = (-0.5 * log(y)) - z;
} else {
tmp = fma((-z / x), x, x);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) tmp = 0.0 if (t_0 <= -5e+58) tmp = Float64(Float64(1.0 - log(y)) * y); elseif (t_0 <= 500.0) tmp = Float64(Float64(-0.5 * log(y)) - z); else tmp = fma(Float64(Float64(-z) / x), x, x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+58], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 500.0], N[(N[(-0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], N[(N[((-z) / x), $MachinePrecision] * x + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x - \left(y + 0.5\right) \cdot \log y\right) + y\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+58}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;-0.5 \cdot \log y - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -4.99999999999999986e58Initial program 99.7%
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.f6454.9
Applied rewrites54.9%
if -4.99999999999999986e58 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 500Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6490.8
Applied rewrites90.8%
Taylor expanded in x around 0
Applied rewrites85.7%
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
associate--l+N/A
div-add-revN/A
div-subN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites100.0%
(FPCore (x y z)
:precision binary64
(if (<= x -4.5e+129)
(+ (* (/ (- z) x) x) x)
(if (<= x 8e+104)
(- y (fma (+ 0.5 y) (log y) z))
(- (fma -0.5 (log y) x) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= -4.5e+129) {
tmp = ((-z / x) * x) + x;
} else if (x <= 8e+104) {
tmp = y - fma((0.5 + y), log(y), z);
} else {
tmp = fma(-0.5, log(y), x) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= -4.5e+129) tmp = Float64(Float64(Float64(Float64(-z) / x) * x) + x); elseif (x <= 8e+104) tmp = Float64(y - fma(Float64(0.5 + y), log(y), z)); else tmp = Float64(fma(-0.5, log(y), x) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, -4.5e+129], N[(N[(N[((-z) / x), $MachinePrecision] * x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[x, 8e+104], N[(y - N[(N[(0.5 + y), $MachinePrecision] * N[Log[y], $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{+129}:\\
\;\;\;\;\frac{-z}{x} \cdot x + x\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+104}:\\
\;\;\;\;y - \mathsf{fma}\left(0.5 + y, \log y, z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\end{array}
\end{array}
if x < -4.5000000000000001e129Initial program 100.0%
Taylor expanded in x around inf
associate--l+N/A
div-add-revN/A
div-subN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites99.9%
Taylor expanded in z around inf
Applied rewrites90.9%
Applied rewrites90.9%
if -4.5000000000000001e129 < x < 8e104Initial 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.3
Applied rewrites93.3%
if 8e104 < x Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6485.3
Applied rewrites85.3%
(FPCore (x y z) :precision binary64 (if (<= y 4.5e-9) (- (fma -0.5 (log y) x) z) (- (+ (- x (* (log y) y)) y) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.5e-9) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = ((x - (log(y) * y)) + y) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 4.5e-9) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = Float64(Float64(Float64(x - Float64(log(y) * y)) + y) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 4.5e-9], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[(x - N[(N[Log[y], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x - \log y \cdot y\right) + y\right) - z\\
\end{array}
\end{array}
if y < 4.49999999999999976e-9Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6499.5
Applied rewrites99.5%
if 4.49999999999999976e-9 < y Initial program 99.7%
Taylor expanded in y around inf
*-commutativeN/A
associate-*r*N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-*.f64N/A
lower-log.f6498.1
Applied rewrites98.1%
(FPCore (x y z) :precision binary64 (if (<= y 38.0) (- (fma -0.5 (log y) x) z) (fma (log y) (- -0.5 y) (+ x y))))
double code(double x, double y, double z) {
double tmp;
if (y <= 38.0) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = fma(log(y), (-0.5 - y), (x + y));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 38.0) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = fma(log(y), Float64(-0.5 - y), Float64(x + y)); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 38.0], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 38:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5 - y, x + y\right)\\
\end{array}
\end{array}
if y < 38Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6499.5
Applied rewrites99.5%
if 38 < y Initial program 99.7%
Taylor expanded in x around inf
associate--l+N/A
div-add-revN/A
div-subN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites75.8%
Applied rewrites75.6%
Taylor expanded in z around 0
fp-cancel-sub-sign-invN/A
+-commutativeN/A
log-recN/A
distribute-lft-inN/A
*-commutativeN/A
metadata-evalN/A
log-recN/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
log-recN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
metadata-evalN/A
*-commutativeN/A
distribute-lft-out--N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
lower-+.f6484.5
Applied rewrites84.5%
(FPCore (x y z) :precision binary64 (if (<= y 4.4e+56) (- (fma -0.5 (log y) x) z) (* (- 1.0 (log y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.4e+56) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = (1.0 - log(y)) * y;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 4.4e+56) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = Float64(Float64(1.0 - log(y)) * y); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 4.4e+56], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.4 \cdot 10^{+56}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\end{array}
\end{array}
if y < 4.40000000000000032e56Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
fp-cancel-sub-sign-invN/A
+-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6494.5
Applied rewrites94.5%
if 4.40000000000000032e56 < y Initial program 99.7%
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.f6468.8
Applied rewrites68.8%
(FPCore (x y z) :precision binary64 (if (<= y 4.2e+56) (+ (* (/ (- z) x) x) x) (* (- 1.0 (log y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 4.2e+56) {
tmp = ((-z / x) * x) + x;
} 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 <= 4.2d+56) then
tmp = ((-z / x) * x) + x
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 <= 4.2e+56) {
tmp = ((-z / x) * x) + x;
} else {
tmp = (1.0 - Math.log(y)) * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 4.2e+56: tmp = ((-z / x) * x) + x else: tmp = (1.0 - math.log(y)) * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 4.2e+56) tmp = Float64(Float64(Float64(Float64(-z) / x) * x) + x); 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 <= 4.2e+56) tmp = ((-z / x) * x) + x; else tmp = (1.0 - log(y)) * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 4.2e+56], N[(N[(N[((-z) / x), $MachinePrecision] * x), $MachinePrecision] + x), $MachinePrecision], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.2 \cdot 10^{+56}:\\
\;\;\;\;\frac{-z}{x} \cdot x + x\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\end{array}
\end{array}
if y < 4.20000000000000034e56Initial program 100.0%
Taylor expanded in x around inf
associate--l+N/A
div-add-revN/A
div-subN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites88.9%
Taylor expanded in z around inf
Applied rewrites59.2%
Applied rewrites59.2%
if 4.20000000000000034e56 < y Initial program 99.7%
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.f6468.8
Applied rewrites68.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -4e-69) (not (<= x 1.3e-50))) (fma (/ (- z) x) x x) (- z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4e-69) || !(x <= 1.3e-50)) {
tmp = fma((-z / x), x, x);
} else {
tmp = -z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if ((x <= -4e-69) || !(x <= 1.3e-50)) tmp = fma(Float64(Float64(-z) / x), x, x); else tmp = Float64(-z); end return tmp end
code[x_, y_, z_] := If[Or[LessEqual[x, -4e-69], N[Not[LessEqual[x, 1.3e-50]], $MachinePrecision]], N[(N[((-z) / x), $MachinePrecision] * x + x), $MachinePrecision], (-z)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-69} \lor \neg \left(x \leq 1.3 \cdot 10^{-50}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{-z}{x}, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if x < -3.9999999999999999e-69 or 1.3000000000000001e-50 < x Initial program 99.9%
Taylor expanded in x around inf
associate--l+N/A
div-add-revN/A
div-subN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites98.6%
Taylor expanded in z around inf
Applied rewrites68.7%
if -3.9999999999999999e-69 < x < 1.3000000000000001e-50Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6436.4
Applied rewrites36.4%
Final simplification55.5%
(FPCore (x y z) :precision binary64 (let* ((t_0 (/ (- z) x))) (if (<= x -4e-69) (+ (* t_0 x) x) (if (<= x 1.3e-50) (- z) (fma t_0 x x)))))
double code(double x, double y, double z) {
double t_0 = -z / x;
double tmp;
if (x <= -4e-69) {
tmp = (t_0 * x) + x;
} else if (x <= 1.3e-50) {
tmp = -z;
} else {
tmp = fma(t_0, x, x);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(-z) / x) tmp = 0.0 if (x <= -4e-69) tmp = Float64(Float64(t_0 * x) + x); elseif (x <= 1.3e-50) tmp = Float64(-z); else tmp = fma(t_0, x, x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[((-z) / x), $MachinePrecision]}, If[LessEqual[x, -4e-69], N[(N[(t$95$0 * x), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[x, 1.3e-50], (-z), N[(t$95$0 * x + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{-z}{x}\\
\mathbf{if}\;x \leq -4 \cdot 10^{-69}:\\
\;\;\;\;t\_0 \cdot x + x\\
\mathbf{elif}\;x \leq 1.3 \cdot 10^{-50}:\\
\;\;\;\;-z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, x, x\right)\\
\end{array}
\end{array}
if x < -3.9999999999999999e-69Initial program 99.9%
Taylor expanded in x around inf
associate--l+N/A
div-add-revN/A
div-subN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites98.7%
Taylor expanded in z around inf
Applied rewrites64.9%
Applied rewrites64.9%
if -3.9999999999999999e-69 < x < 1.3000000000000001e-50Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6436.4
Applied rewrites36.4%
if 1.3000000000000001e-50 < x Initial program 99.9%
Taylor expanded in x around inf
associate--l+N/A
div-add-revN/A
div-subN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
Applied rewrites98.4%
Taylor expanded in z around inf
Applied rewrites74.0%
(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.f6429.3
Applied rewrites29.3%
(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 2024329
(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))