
(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 9 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 (* (log y) (+ 0.5 y))) y) z))
double code(double x, double y, double z) {
return ((x - (log(y) * (0.5 + 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 - (log(y) * (0.5d0 + y))) + y) - z
end function
public static double code(double x, double y, double z) {
return ((x - (Math.log(y) * (0.5 + y))) + y) - z;
}
def code(x, y, z): return ((x - (math.log(y) * (0.5 + y))) + y) - z
function code(x, y, z) return Float64(Float64(Float64(x - Float64(log(y) * Float64(0.5 + y))) + y) - z) end
function tmp = code(x, y, z) tmp = ((x - (log(y) * (0.5 + y))) + y) - z; end
code[x_, y_, z_] := N[(N[(N[(x - N[(N[Log[y], $MachinePrecision] * N[(0.5 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x - \log y \cdot \left(0.5 + y\right)\right) + y\right) - z
\end{array}
Initial program 99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (* 1.0 x) (- y z))) (t_1 (+ (- x (* (log y) (+ 0.5 y))) y)))
(if (<= t_1 -5e+122)
(* (- 1.0 (log y)) y)
(if (<= t_1 -1000000.0)
t_0
(if (<= t_1 345.0) (- (* -0.5 (log y)) z) t_0)))))
double code(double x, double y, double z) {
double t_0 = (1.0 * x) + (y - z);
double t_1 = (x - (log(y) * (0.5 + y))) + y;
double tmp;
if (t_1 <= -5e+122) {
tmp = (1.0 - log(y)) * y;
} else if (t_1 <= -1000000.0) {
tmp = t_0;
} else if (t_1 <= 345.0) {
tmp = (-0.5 * log(y)) - z;
} else {
tmp = t_0;
}
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) :: t_1
real(8) :: tmp
t_0 = (1.0d0 * x) + (y - z)
t_1 = (x - (log(y) * (0.5d0 + y))) + y
if (t_1 <= (-5d+122)) then
tmp = (1.0d0 - log(y)) * y
else if (t_1 <= (-1000000.0d0)) then
tmp = t_0
else if (t_1 <= 345.0d0) then
tmp = ((-0.5d0) * log(y)) - z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (1.0 * x) + (y - z);
double t_1 = (x - (Math.log(y) * (0.5 + y))) + y;
double tmp;
if (t_1 <= -5e+122) {
tmp = (1.0 - Math.log(y)) * y;
} else if (t_1 <= -1000000.0) {
tmp = t_0;
} else if (t_1 <= 345.0) {
tmp = (-0.5 * Math.log(y)) - z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 * x) + (y - z) t_1 = (x - (math.log(y) * (0.5 + y))) + y tmp = 0 if t_1 <= -5e+122: tmp = (1.0 - math.log(y)) * y elif t_1 <= -1000000.0: tmp = t_0 elif t_1 <= 345.0: tmp = (-0.5 * math.log(y)) - z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 * x) + Float64(y - z)) t_1 = Float64(Float64(x - Float64(log(y) * Float64(0.5 + y))) + y) tmp = 0.0 if (t_1 <= -5e+122) tmp = Float64(Float64(1.0 - log(y)) * y); elseif (t_1 <= -1000000.0) tmp = t_0; elseif (t_1 <= 345.0) tmp = Float64(Float64(-0.5 * log(y)) - z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 * x) + (y - z); t_1 = (x - (log(y) * (0.5 + y))) + y; tmp = 0.0; if (t_1 <= -5e+122) tmp = (1.0 - log(y)) * y; elseif (t_1 <= -1000000.0) tmp = t_0; elseif (t_1 <= 345.0) tmp = (-0.5 * log(y)) - z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 * x), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x - N[(N[Log[y], $MachinePrecision] * N[(0.5 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+122], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, -1000000.0], t$95$0, If[LessEqual[t$95$1, 345.0], N[(N[(-0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 \cdot x + \left(y - z\right)\\
t_1 := \left(x - \log y \cdot \left(0.5 + y\right)\right) + y\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+122}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\mathbf{elif}\;t\_1 \leq -1000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 345:\\
\;\;\;\;-0.5 \cdot \log y - z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -4.99999999999999989e122Initial 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.f6465.0
Applied rewrites65.0%
if -4.99999999999999989e122 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < -1e6 or 345 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/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-evalN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f6496.3
Applied rewrites96.3%
Taylor expanded in x around inf
Applied rewrites86.1%
if -1e6 < (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) < 345Initial program 100.0%
Taylor expanded in x around 0
lower--.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-log.f64100.0
Applied rewrites100.0%
Taylor expanded in y around 0
Applied rewrites98.7%
Final simplification80.1%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (* 1.0 x) (- y z)))) (if (<= x -11000.0) t_0 (if (<= x 3.5e+17) (- (* -0.5 (log y)) z) t_0))))
double code(double x, double y, double z) {
double t_0 = (1.0 * x) + (y - z);
double tmp;
if (x <= -11000.0) {
tmp = t_0;
} else if (x <= 3.5e+17) {
tmp = (-0.5 * log(y)) - z;
} else {
tmp = t_0;
}
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 = (1.0d0 * x) + (y - z)
if (x <= (-11000.0d0)) then
tmp = t_0
else if (x <= 3.5d+17) then
tmp = ((-0.5d0) * log(y)) - z
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (1.0 * x) + (y - z);
double tmp;
if (x <= -11000.0) {
tmp = t_0;
} else if (x <= 3.5e+17) {
tmp = (-0.5 * Math.log(y)) - z;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = (1.0 * x) + (y - z) tmp = 0 if x <= -11000.0: tmp = t_0 elif x <= 3.5e+17: tmp = (-0.5 * math.log(y)) - z else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(1.0 * x) + Float64(y - z)) tmp = 0.0 if (x <= -11000.0) tmp = t_0; elseif (x <= 3.5e+17) tmp = Float64(Float64(-0.5 * log(y)) - z); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = (1.0 * x) + (y - z); tmp = 0.0; if (x <= -11000.0) tmp = t_0; elseif (x <= 3.5e+17) tmp = (-0.5 * log(y)) - z; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(1.0 * x), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -11000.0], t$95$0, If[LessEqual[x, 3.5e+17], N[(N[(-0.5 * N[Log[y], $MachinePrecision]), $MachinePrecision] - z), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 \cdot x + \left(y - z\right)\\
\mathbf{if}\;x \leq -11000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{+17}:\\
\;\;\;\;-0.5 \cdot \log y - z\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -11000 or 3.5e17 < x Initial program 99.9%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/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-evalN/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
Applied rewrites72.5%
if -11000 < x < 3.5e17Initial 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.f6499.8
Applied rewrites99.8%
Taylor expanded in y around 0
Applied rewrites62.1%
(FPCore (x y z) :precision binary64 (if (<= y 0.205) (- (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 <= 0.205) {
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 <= 0.205) 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, 0.205], 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 0.205:\\
\;\;\;\;\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 < 0.204999999999999988Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6499.3
Applied rewrites99.3%
if 0.204999999999999988 < 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.f6499.4
Applied rewrites99.4%
(FPCore (x y z) :precision binary64 (if (<= y 7.5e+81) (- (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 <= 7.5e+81) {
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 <= 7.5e+81) 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, 7.5e+81], 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 7.5 \cdot 10^{+81}:\\
\;\;\;\;\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.49999999999999973e81Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6495.3
Applied rewrites95.3%
if 7.49999999999999973e81 < 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
mul-1-negN/A
lower-fma.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f6491.2
Applied rewrites91.2%
Taylor expanded in y around inf
Applied rewrites91.2%
(FPCore (x y z) :precision binary64 (if (<= y 2.2e+125) (- (fma -0.5 (log y) x) z) (* (- 1.0 (log y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 2.2e+125) {
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 <= 2.2e+125) 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, 2.2e+125], 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 2.2 \cdot 10^{+125}:\\
\;\;\;\;\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 < 2.19999999999999991e125Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
associate--r+N/A
lower--.f64N/A
sub-negN/A
+-commutativeN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-log.f6493.3
Applied rewrites93.3%
if 2.19999999999999991e125 < 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.f6481.9
Applied rewrites81.9%
(FPCore (x y z) :precision binary64 (+ (- y z) (fma (- -0.5 y) (log y) x)))
double code(double x, double y, double z) {
return (y - z) + fma((-0.5 - y), log(y), x);
}
function code(x, y, z) return Float64(Float64(y - z) + fma(Float64(-0.5 - y), log(y), x)) end
code[x_, y_, z_] := N[(N[(y - z), $MachinePrecision] + N[(N[(-0.5 - y), $MachinePrecision] * N[Log[y], $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y - z\right) + \mathsf{fma}\left(-0.5 - y, \log y, x\right)
\end{array}
Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/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-evalN/A
lower--.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (+ (* 1.0 x) (- y z)))
double code(double x, double y, double z) {
return (1.0 * x) + (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 = (1.0d0 * x) + (y - z)
end function
public static double code(double x, double y, double z) {
return (1.0 * x) + (y - z);
}
def code(x, y, z): return (1.0 * x) + (y - z)
function code(x, y, z) return Float64(Float64(1.0 * x) + Float64(y - z)) end
function tmp = code(x, y, z) tmp = (1.0 * x) + (y - z); end
code[x_, y_, z_] := N[(N[(1.0 * x), $MachinePrecision] + N[(y - z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot x + \left(y - z\right)
\end{array}
Initial program 99.8%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lower-+.f64N/A
lift--.f64N/A
sub-negN/A
+-commutativeN/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-evalN/A
lower--.f6499.8
Applied rewrites99.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-log.f6486.6
Applied rewrites86.6%
Taylor expanded in x around inf
Applied rewrites49.8%
(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.f6425.2
Applied rewrites25.2%
(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 2024327
(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))