
(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) z)))
(if (<= t_0 -5e+28)
(* (- 1.0 (log y)) y)
(if (<= t_0 500.0) (- (* -0.5 (log y)) z) (* (- (/ x z) 1.0) z)))))
double code(double x, double y, double z) {
double t_0 = ((x - ((y + 0.5) * log(y))) + y) - z;
double tmp;
if (t_0 <= -5e+28) {
tmp = (1.0 - log(y)) * y;
} else if (t_0 <= 500.0) {
tmp = (-0.5 * log(y)) - z;
} else {
tmp = ((x / z) - 1.0) * 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 = ((x - ((y + 0.5d0) * log(y))) + y) - z
if (t_0 <= (-5d+28)) then
tmp = (1.0d0 - log(y)) * y
else if (t_0 <= 500.0d0) then
tmp = ((-0.5d0) * log(y)) - z
else
tmp = ((x / z) - 1.0d0) * z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((x - ((y + 0.5) * Math.log(y))) + y) - z;
double tmp;
if (t_0 <= -5e+28) {
tmp = (1.0 - Math.log(y)) * y;
} else if (t_0 <= 500.0) {
tmp = (-0.5 * Math.log(y)) - z;
} else {
tmp = ((x / z) - 1.0) * z;
}
return tmp;
}
def code(x, y, z): t_0 = ((x - ((y + 0.5) * math.log(y))) + y) - z tmp = 0 if t_0 <= -5e+28: tmp = (1.0 - math.log(y)) * y elif t_0 <= 500.0: tmp = (-0.5 * math.log(y)) - z else: tmp = ((x / z) - 1.0) * z return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(x - Float64(Float64(y + 0.5) * log(y))) + y) - z) tmp = 0.0 if (t_0 <= -5e+28) tmp = Float64(Float64(1.0 - log(y)) * y); elseif (t_0 <= 500.0) tmp = Float64(Float64(-0.5 * log(y)) - z); else tmp = Float64(Float64(Float64(x / z) - 1.0) * z); end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((x - ((y + 0.5) * log(y))) + y) - z; tmp = 0.0; if (t_0 <= -5e+28) tmp = (1.0 - log(y)) * y; elseif (t_0 <= 500.0) tmp = (-0.5 * log(y)) - z; else tmp = ((x / z) - 1.0) * z; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(x - N[(N[(y + 0.5), $MachinePrecision] * N[Log[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + y), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+28], 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[(N[(x / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{+28}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\mathbf{elif}\;t\_0 \leq 500:\\
\;\;\;\;-0.5 \cdot \log y - z\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{x}{z} - 1\right) \cdot z\\
\end{array}
\end{array}
if (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < -4.99999999999999957e28Initial 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.f6457.7
Applied rewrites57.7%
if -4.99999999999999957e28 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) < 500Initial 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.f6496.1
Applied rewrites96.1%
Taylor expanded in x around 0
Applied rewrites89.8%
if 500 < (-.f64 (+.f64 (-.f64 x (*.f64 (+.f64 y #s(literal 1/2 binary64)) (log.f64 y))) y) z) Initial program 100.0%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites86.0%
Applied rewrites55.4%
Taylor expanded in x around inf
Applied rewrites83.9%
(FPCore (x y z)
:precision binary64
(if (<= y 920000000000.0)
(- (fma -0.5 (log y) x) z)
(if (<= y 2.75e+84)
(fma (log y) (- -0.5 y) (+ x y))
(- (fma (log y) (- y) y) z))))
double code(double x, double y, double z) {
double tmp;
if (y <= 920000000000.0) {
tmp = fma(-0.5, log(y), x) - z;
} else if (y <= 2.75e+84) {
tmp = fma(log(y), (-0.5 - y), (x + y));
} else {
tmp = fma(log(y), -y, y) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 920000000000.0) tmp = Float64(fma(-0.5, log(y), x) - z); elseif (y <= 2.75e+84) tmp = fma(log(y), Float64(-0.5 - y), Float64(x + y)); else tmp = Float64(fma(log(y), Float64(-y), y) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 920000000000.0], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], If[LessEqual[y, 2.75e+84], N[(N[Log[y], $MachinePrecision] * N[(-0.5 - y), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision] - z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 920000000000:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{+84}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -0.5 - y, x + y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -y, y\right) - z\\
\end{array}
\end{array}
if y < 9.2e11Initial 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.4
Applied rewrites99.4%
if 9.2e11 < y < 2.7500000000000002e84Initial program 99.7%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.9%
Taylor expanded in x around inf
Applied rewrites36.8%
Taylor expanded in z around 0
Applied rewrites82.7%
if 2.7500000000000002e84 < y Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
log-recN/A
lower-fma.f64N/A
Applied rewrites66.5%
Applied rewrites80.9%
Taylor expanded in x around 0
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-inN/A
distribute-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
fp-cancel-sub-sign-invN/A
distribute-rgt-out--N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f6490.3
Applied rewrites90.3%
Taylor expanded in y around inf
Applied rewrites90.3%
(FPCore (x y z) :precision binary64 (if (<= y 0.28) (- (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.28) {
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.28) 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.28], 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.28:\\
\;\;\;\;\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.28000000000000003Initial 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.3
Applied rewrites99.3%
if 0.28000000000000003 < 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.7
Applied rewrites99.7%
(FPCore (x y z) :precision binary64 (if (<= y 1.4e+107) (- (fma -0.5 (log y) x) z) (- (fma (log y) (- y) y) z)))
double code(double x, double y, double z) {
double tmp;
if (y <= 1.4e+107) {
tmp = fma(-0.5, log(y), x) - z;
} else {
tmp = fma(log(y), -y, y) - z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (y <= 1.4e+107) tmp = Float64(fma(-0.5, log(y), x) - z); else tmp = Float64(fma(log(y), Float64(-y), y) - z); end return tmp end
code[x_, y_, z_] := If[LessEqual[y, 1.4e+107], N[(N[(-0.5 * N[Log[y], $MachinePrecision] + x), $MachinePrecision] - z), $MachinePrecision], N[(N[(N[Log[y], $MachinePrecision] * (-y) + y), $MachinePrecision] - z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.4 \cdot 10^{+107}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log y, x\right) - z\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log y, -y, y\right) - z\\
\end{array}
\end{array}
if y < 1.39999999999999992e107Initial 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.f6492.7
Applied rewrites92.7%
if 1.39999999999999992e107 < y Initial program 99.7%
Taylor expanded in x around inf
*-commutativeN/A
+-commutativeN/A
distribute-lft1-inN/A
mul-1-negN/A
distribute-lft-neg-outN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-neg-inN/A
log-recN/A
lower-fma.f64N/A
Applied rewrites65.3%
Applied rewrites79.1%
Taylor expanded in x around 0
*-lft-identityN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-inN/A
distribute-neg-inN/A
distribute-lft-neg-inN/A
metadata-evalN/A
distribute-lft-neg-inN/A
fp-cancel-sub-sign-invN/A
distribute-rgt-out--N/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f6492.5
Applied rewrites92.5%
Taylor expanded in y around inf
Applied rewrites92.5%
(FPCore (x y z) :precision binary64 (if (<= y 8.2e+108) (- (fma -0.5 (log y) x) z) (* (- 1.0 (log y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 8.2e+108) {
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 <= 8.2e+108) 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, 8.2e+108], 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 8.2 \cdot 10^{+108}:\\
\;\;\;\;\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 < 8.1999999999999998e108Initial 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.f6492.7
Applied rewrites92.7%
if 8.1999999999999998e108 < 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.f6473.9
Applied rewrites73.9%
(FPCore (x y z) :precision binary64 (if (<= y 7.5e+104) (* (- (/ x z) 1.0) z) (* (- 1.0 (log y)) y)))
double code(double x, double y, double z) {
double tmp;
if (y <= 7.5e+104) {
tmp = ((x / z) - 1.0) * 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 <= 7.5d+104) then
tmp = ((x / z) - 1.0d0) * 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 <= 7.5e+104) {
tmp = ((x / z) - 1.0) * z;
} else {
tmp = (1.0 - Math.log(y)) * y;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= 7.5e+104: tmp = ((x / z) - 1.0) * z else: tmp = (1.0 - math.log(y)) * y return tmp
function code(x, y, z) tmp = 0.0 if (y <= 7.5e+104) tmp = Float64(Float64(Float64(x / z) - 1.0) * 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 <= 7.5e+104) tmp = ((x / z) - 1.0) * z; else tmp = (1.0 - log(y)) * y; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, 7.5e+104], N[(N[(N[(x / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision], N[(N[(1.0 - N[Log[y], $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.5 \cdot 10^{+104}:\\
\;\;\;\;\left(\frac{x}{z} - 1\right) \cdot z\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \log y\right) \cdot y\\
\end{array}
\end{array}
if y < 7.5000000000000002e104Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.7%
Applied rewrites64.1%
Taylor expanded in x around inf
Applied rewrites61.0%
if 7.5000000000000002e104 < 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.f6472.8
Applied rewrites72.8%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.55e+157) (not (<= x 4e+36))) (* (/ x z) z) (- z)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55e+157) || !(x <= 4e+36)) {
tmp = (x / z) * z;
} 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 ((x <= (-1.55d+157)) .or. (.not. (x <= 4d+36))) then
tmp = (x / z) * z
else
tmp = -z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.55e+157) || !(x <= 4e+36)) {
tmp = (x / z) * z;
} else {
tmp = -z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.55e+157) or not (x <= 4e+36): tmp = (x / z) * z else: tmp = -z return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.55e+157) || !(x <= 4e+36)) tmp = Float64(Float64(x / z) * z); else tmp = Float64(-z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.55e+157) || ~((x <= 4e+36))) tmp = (x / z) * z; else tmp = -z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.55e+157], N[Not[LessEqual[x, 4e+36]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * z), $MachinePrecision], (-z)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+157} \lor \neg \left(x \leq 4 \cdot 10^{+36}\right):\\
\;\;\;\;\frac{x}{z} \cdot z\\
\mathbf{else}:\\
\;\;\;\;-z\\
\end{array}
\end{array}
if x < -1.5499999999999999e157 or 4.00000000000000017e36 < x Initial program 99.9%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites74.8%
Taylor expanded in x around inf
Applied rewrites45.7%
if -1.5499999999999999e157 < x < 4.00000000000000017e36Initial program 99.8%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6437.5
Applied rewrites37.5%
Final simplification40.2%
(FPCore (x y z) :precision binary64 (* (- (/ x z) 1.0) z))
double code(double x, double y, double z) {
return ((x / z) - 1.0) * 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) - 1.0d0) * z
end function
public static double code(double x, double y, double z) {
return ((x / z) - 1.0) * z;
}
def code(x, y, z): return ((x / z) - 1.0) * z
function code(x, y, z) return Float64(Float64(Float64(x / z) - 1.0) * z) end
function tmp = code(x, y, z) tmp = ((x / z) - 1.0) * z; end
code[x_, y_, z_] := N[(N[(N[(x / z), $MachinePrecision] - 1.0), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{z} - 1\right) \cdot z
\end{array}
Initial program 99.8%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites81.5%
Applied rewrites51.6%
Taylor expanded in x around inf
Applied rewrites46.3%
(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.0
Applied rewrites29.0%
(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 2024337
(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))