
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / 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 - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z)
:precision binary64
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x)))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / 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 - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((((((y + 0.0007936500793651d0) * z) - 0.0027777777777778d0) * z) + 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(Float64(Float64(Float64(y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] * z), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{\left(\left(y + 0.0007936500793651\right) \cdot z - 0.0027777777777778\right) \cdot z + 0.083333333333333}{x}
\end{array}
(FPCore (x y z)
:precision binary64
(if (<= (* (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) z) 1e+291)
(fma
(fma
(fma z (+ 0.0007936500793651 y) -0.0027777777777778)
z
0.083333333333333)
(pow x -1.0)
(fma (log x) (- x 0.5) (fma -1.0 x 0.91893853320467)))
(-
(fma
(fma (/ y x) z (/ (fma 0.0007936500793651 z -0.0027777777777778) x))
z
(fma (- x 0.5) (log x) (/ 0.083333333333333 x)))
(- x 0.91893853320467))))
double code(double x, double y, double z) {
double tmp;
if ((((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z) <= 1e+291) {
tmp = fma(fma(fma(z, (0.0007936500793651 + y), -0.0027777777777778), z, 0.083333333333333), pow(x, -1.0), fma(log(x), (x - 0.5), fma(-1.0, x, 0.91893853320467)));
} else {
tmp = fma(fma((y / x), z, (fma(0.0007936500793651, z, -0.0027777777777778) / x)), z, fma((x - 0.5), log(x), (0.083333333333333 / x))) - (x - 0.91893853320467);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778) * z) <= 1e+291) tmp = fma(fma(fma(z, Float64(0.0007936500793651 + y), -0.0027777777777778), z, 0.083333333333333), (x ^ -1.0), fma(log(x), Float64(x - 0.5), fma(-1.0, x, 0.91893853320467))); else tmp = Float64(fma(fma(Float64(y / x), z, Float64(fma(0.0007936500793651, z, -0.0027777777777778) / x)), z, fma(Float64(x - 0.5), log(x), Float64(0.083333333333333 / x))) - Float64(x - 0.91893853320467)); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision], 1e+291], N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] * N[Power[x, -1.0], $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(-1.0 * x + 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / x), $MachinePrecision] * z + N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * z + N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right) \cdot z \leq 10^{+291}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0007936500793651 + y, -0.0027777777777778\right), z, 0.083333333333333\right), {x}^{-1}, \mathsf{fma}\left(\log x, x - 0.5, \mathsf{fma}\left(-1, x, 0.91893853320467\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{x}, z, \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{x}\right), z, \mathsf{fma}\left(x - 0.5, \log x, \frac{0.083333333333333}{x}\right)\right) - \left(x - 0.91893853320467\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 9.9999999999999996e290Initial program 99.6%
lift-+.f64N/A
+-commutativeN/A
lift-/.f64N/A
div-invN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
metadata-evalN/A
inv-powN/A
lower-pow.f6499.6
Applied rewrites99.7%
if 9.9999999999999996e290 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 84.7%
Taylor expanded in z around 0
Applied rewrites99.9%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(if (<= x 2e+52)
(/
(fma
(+ (fma (- x 0.5) (log x) (- x)) 0.91893853320467)
x
(fma
(fma (+ 0.0007936500793651 y) z -0.0027777777777778)
z
0.083333333333333))
x)
(-
(fma
(fma (/ y x) z (/ (fma 0.0007936500793651 z -0.0027777777777778) x))
z
(fma (- x 0.5) (log x) (/ 0.083333333333333 x)))
(- x 0.91893853320467))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e+52) {
tmp = fma((fma((x - 0.5), log(x), -x) + 0.91893853320467), x, fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333)) / x;
} else {
tmp = fma(fma((y / x), z, (fma(0.0007936500793651, z, -0.0027777777777778) / x)), z, fma((x - 0.5), log(x), (0.083333333333333 / x))) - (x - 0.91893853320467);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 2e+52) tmp = Float64(fma(Float64(fma(Float64(x - 0.5), log(x), Float64(-x)) + 0.91893853320467), x, fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333)) / x); else tmp = Float64(fma(fma(Float64(y / x), z, Float64(fma(0.0007936500793651, z, -0.0027777777777778) / x)), z, fma(Float64(x - 0.5), log(x), Float64(0.083333333333333 / x))) - Float64(x - 0.91893853320467)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 2e+52], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision] + 0.91893853320467), $MachinePrecision] * x + N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(y / x), $MachinePrecision] * z + N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * z + N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+52}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(x - 0.5, \log x, -x\right) + 0.91893853320467, x, \mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{x}, z, \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{x}\right), z, \mathsf{fma}\left(x - 0.5, \log x, \frac{0.083333333333333}{x}\right)\right) - \left(x - 0.91893853320467\right)\\
\end{array}
\end{array}
if x < 2e52Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
if 2e52 < x Initial program 89.5%
Taylor expanded in z around 0
Applied rewrites99.6%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) z)))
(if (<= t_0 -1e+142)
(* (/ (* z z) x) y)
(if (<= t_0 0.0001)
(fma
(- x 0.5)
(log x)
(- (/ 0.083333333333333 x) (- x 0.91893853320467)))
(*
(* (/ z x) z)
(-
(+ (+ (/ (/ 0.083333333333333 z) z) y) 0.0007936500793651)
(/ 0.0027777777777778 z)))))))
double code(double x, double y, double z) {
double t_0 = ((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z;
double tmp;
if (t_0 <= -1e+142) {
tmp = ((z * z) / x) * y;
} else if (t_0 <= 0.0001) {
tmp = fma((x - 0.5), log(x), ((0.083333333333333 / x) - (x - 0.91893853320467)));
} else {
tmp = ((z / x) * z) * (((((0.083333333333333 / z) / z) + y) + 0.0007936500793651) - (0.0027777777777778 / z));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778) * z) tmp = 0.0 if (t_0 <= -1e+142) tmp = Float64(Float64(Float64(z * z) / x) * y); elseif (t_0 <= 0.0001) tmp = fma(Float64(x - 0.5), log(x), Float64(Float64(0.083333333333333 / x) - Float64(x - 0.91893853320467))); else tmp = Float64(Float64(Float64(z / x) * z) * Float64(Float64(Float64(Float64(Float64(0.083333333333333 / z) / z) + y) + 0.0007936500793651) - Float64(0.0027777777777778 / z))); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+142], N[(N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 0.0001], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] - N[(x - 0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / x), $MachinePrecision] * z), $MachinePrecision] * N[(N[(N[(N[(N[(0.083333333333333 / z), $MachinePrecision] / z), $MachinePrecision] + y), $MachinePrecision] + 0.0007936500793651), $MachinePrecision] - N[(0.0027777777777778 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right) \cdot z\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+142}:\\
\;\;\;\;\frac{z \cdot z}{x} \cdot y\\
\mathbf{elif}\;t\_0 \leq 0.0001:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \frac{0.083333333333333}{x} - \left(x - 0.91893853320467\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{x} \cdot z\right) \cdot \left(\left(\left(\frac{\frac{0.083333333333333}{z}}{z} + y\right) + 0.0007936500793651\right) - \frac{0.0027777777777778}{z}\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -1.00000000000000005e142Initial program 99.8%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.7
Applied rewrites91.7%
Applied rewrites91.7%
if -1.00000000000000005e142 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 1.00000000000000005e-4Initial program 99.5%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6496.8
Applied rewrites96.8%
Applied rewrites96.8%
if 1.00000000000000005e-4 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 89.5%
Taylor expanded in z around -inf
Applied rewrites87.6%
Taylor expanded in x around 0
Applied rewrites81.8%
Final simplification89.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) z)))
(if (<= t_0 -1e+142)
(* (/ (* z z) x) y)
(if (<= t_0 0.0001)
(fma
(- x 0.5)
(log x)
(- (+ (/ 0.083333333333333 x) 0.91893853320467) x))
(*
(* (/ z x) z)
(-
(+ (+ (/ (/ 0.083333333333333 z) z) y) 0.0007936500793651)
(/ 0.0027777777777778 z)))))))
double code(double x, double y, double z) {
double t_0 = ((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z;
double tmp;
if (t_0 <= -1e+142) {
tmp = ((z * z) / x) * y;
} else if (t_0 <= 0.0001) {
tmp = fma((x - 0.5), log(x), (((0.083333333333333 / x) + 0.91893853320467) - x));
} else {
tmp = ((z / x) * z) * (((((0.083333333333333 / z) / z) + y) + 0.0007936500793651) - (0.0027777777777778 / z));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778) * z) tmp = 0.0 if (t_0 <= -1e+142) tmp = Float64(Float64(Float64(z * z) / x) * y); elseif (t_0 <= 0.0001) tmp = fma(Float64(x - 0.5), log(x), Float64(Float64(Float64(0.083333333333333 / x) + 0.91893853320467) - x)); else tmp = Float64(Float64(Float64(z / x) * z) * Float64(Float64(Float64(Float64(Float64(0.083333333333333 / z) / z) + y) + 0.0007936500793651) - Float64(0.0027777777777778 / z))); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+142], N[(N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$0, 0.0001], N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(N[(N[(0.083333333333333 / x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z / x), $MachinePrecision] * z), $MachinePrecision] * N[(N[(N[(N[(N[(0.083333333333333 / z), $MachinePrecision] / z), $MachinePrecision] + y), $MachinePrecision] + 0.0007936500793651), $MachinePrecision] - N[(0.0027777777777778 / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right) \cdot z\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+142}:\\
\;\;\;\;\frac{z \cdot z}{x} \cdot y\\
\mathbf{elif}\;t\_0 \leq 0.0001:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(\frac{0.083333333333333}{x} + 0.91893853320467\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{x} \cdot z\right) \cdot \left(\left(\left(\frac{\frac{0.083333333333333}{z}}{z} + y\right) + 0.0007936500793651\right) - \frac{0.0027777777777778}{z}\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -1.00000000000000005e142Initial program 99.8%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.7
Applied rewrites91.7%
Applied rewrites91.7%
if -1.00000000000000005e142 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 1.00000000000000005e-4Initial program 99.5%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6496.8
Applied rewrites96.8%
if 1.00000000000000005e-4 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 89.5%
Taylor expanded in z around -inf
Applied rewrites87.6%
Taylor expanded in x around 0
Applied rewrites81.8%
Final simplification89.9%
(FPCore (x y z)
:precision binary64
(if (<= x 1.25e+156)
(/
(fma
(+ (fma (- x 0.5) (log x) (- x)) 0.91893853320467)
x
(fma
(fma (+ 0.0007936500793651 y) z -0.0027777777777778)
z
0.083333333333333))
x)
(* (- (log x) 1.0) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.25e+156) {
tmp = fma((fma((x - 0.5), log(x), -x) + 0.91893853320467), x, fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333)) / x;
} else {
tmp = (log(x) - 1.0) * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.25e+156) tmp = Float64(fma(Float64(fma(Float64(x - 0.5), log(x), Float64(-x)) + 0.91893853320467), x, fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333)) / x); else tmp = Float64(Float64(log(x) - 1.0) * x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.25e+156], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision] + 0.91893853320467), $MachinePrecision] * x + N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.25 \cdot 10^{+156}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(x - 0.5, \log x, -x\right) + 0.91893853320467, x, \mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\
\end{array}
\end{array}
if x < 1.24999999999999998e156Initial program 99.2%
Taylor expanded in x around 0
Applied rewrites99.2%
if 1.24999999999999998e156 < x Initial program 84.1%
Taylor expanded in x around inf
*-commutativeN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-*.f64N/A
lower--.f64N/A
lower-log.f6477.3
Applied rewrites77.3%
Final simplification93.8%
(FPCore (x y z)
:precision binary64
(+
(/
(+
0.083333333333333
(* (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) z))
x)
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)))
double code(double x, double y, double z) {
return ((0.083333333333333 + (((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z)) / x) + ((((x - 0.5) * log(x)) - x) + 0.91893853320467);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((0.083333333333333d0 + (((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0) * z)) / x) + ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0)
end function
public static double code(double x, double y, double z) {
return ((0.083333333333333 + (((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z)) / x) + ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467);
}
def code(x, y, z): return ((0.083333333333333 + (((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z)) / x) + ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467)
function code(x, y, z) return Float64(Float64(Float64(0.083333333333333 + Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778) * z)) / x) + Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467)) end
function tmp = code(x, y, z) tmp = ((0.083333333333333 + (((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z)) / x) + ((((x - 0.5) * log(x)) - x) + 0.91893853320467); end
code[x_, y_, z_] := N[(N[(N[(0.083333333333333 + N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.083333333333333 + \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right) \cdot z}{x} + \left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right)
\end{array}
Initial program 95.4%
Final simplification95.4%
(FPCore (x y z)
:precision binary64
(if (<= x 1e+61)
(/
(fma
(fma (+ 0.0007936500793651 y) z -0.0027777777777778)
z
0.083333333333333)
x)
(* (- (log x) 1.0) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 1e+61) {
tmp = fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = (log(x) - 1.0) * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1e+61) tmp = Float64(fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(log(x) - 1.0) * x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1e+61], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{+61}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\log x - 1\right) \cdot x\\
\end{array}
\end{array}
if x < 9.99999999999999949e60Initial program 99.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6491.8
Applied rewrites91.8%
if 9.99999999999999949e60 < x Initial program 88.8%
Taylor expanded in x 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%
Final simplification84.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) z))
(t_1 (* (/ (* z z) x) y)))
(if (<= t_0 -4e+15)
t_1
(if (<= t_0 0.0001)
(/ (fma -0.0027777777777778 z 0.083333333333333) x)
(if (<= t_0 1e+291) t_1 (* (* (/ z x) z) 0.0007936500793651))))))
double code(double x, double y, double z) {
double t_0 = ((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z;
double t_1 = ((z * z) / x) * y;
double tmp;
if (t_0 <= -4e+15) {
tmp = t_1;
} else if (t_0 <= 0.0001) {
tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
} else if (t_0 <= 1e+291) {
tmp = t_1;
} else {
tmp = ((z / x) * z) * 0.0007936500793651;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778) * z) t_1 = Float64(Float64(Float64(z * z) / x) * y) tmp = 0.0 if (t_0 <= -4e+15) tmp = t_1; elseif (t_0 <= 0.0001) tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); elseif (t_0 <= 1e+291) tmp = t_1; else tmp = Float64(Float64(Float64(z / x) * z) * 0.0007936500793651); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+15], t$95$1, If[LessEqual[t$95$0, 0.0001], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[t$95$0, 1e+291], t$95$1, N[(N[(N[(z / x), $MachinePrecision] * z), $MachinePrecision] * 0.0007936500793651), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right) \cdot z\\
t_1 := \frac{z \cdot z}{x} \cdot y\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{+15}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0.0001:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{elif}\;t\_0 \leq 10^{+291}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{x} \cdot z\right) \cdot 0.0007936500793651\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -4e15 or 1.00000000000000005e-4 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 9.9999999999999996e290Initial program 99.7%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6464.1
Applied rewrites64.1%
Applied rewrites66.6%
if -4e15 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 1.00000000000000005e-4Initial program 99.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6448.3
Applied rewrites48.3%
Taylor expanded in z around 0
Applied rewrites47.5%
if 9.9999999999999996e290 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 84.7%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
Applied rewrites86.8%
Taylor expanded in z around inf
Applied rewrites74.6%
Final simplification60.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (+ 0.0007936500793651 y))))
(if (<= (* (- t_0 0.0027777777777778) z) 0.0001)
(/ (fma (* z y) z 0.083333333333333) x)
(/ (* t_0 z) x))))
double code(double x, double y, double z) {
double t_0 = z * (0.0007936500793651 + y);
double tmp;
if (((t_0 - 0.0027777777777778) * z) <= 0.0001) {
tmp = fma((z * y), z, 0.083333333333333) / x;
} else {
tmp = (t_0 * z) / x;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * Float64(0.0007936500793651 + y)) tmp = 0.0 if (Float64(Float64(t_0 - 0.0027777777777778) * z) <= 0.0001) tmp = Float64(fma(Float64(z * y), z, 0.083333333333333) / x); else tmp = Float64(Float64(t_0 * z) / x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(t$95$0 - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision], 0.0001], N[(N[(N[(z * y), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(t$95$0 * z), $MachinePrecision] / x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(0.0007936500793651 + y\right)\\
\mathbf{if}\;\left(t\_0 - 0.0027777777777778\right) \cdot z \leq 0.0001:\\
\;\;\;\;\frac{\mathsf{fma}\left(z \cdot y, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot z}{x}\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 1.00000000000000005e-4Initial program 99.6%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6458.0
Applied rewrites58.0%
Taylor expanded in y around inf
Applied rewrites57.2%
if 1.00000000000000005e-4 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 89.5%
Taylor expanded in x around 0
Applied rewrites84.2%
Taylor expanded in z around inf
Applied rewrites78.2%
Final simplification65.8%
(FPCore (x y z) :precision binary64 (if (<= (* (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) z) 2e+221) (/ (fma (* z y) z 0.083333333333333) x) (* (* (/ z x) z) 0.0007936500793651)))
double code(double x, double y, double z) {
double tmp;
if ((((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z) <= 2e+221) {
tmp = fma((z * y), z, 0.083333333333333) / x;
} else {
tmp = ((z / x) * z) * 0.0007936500793651;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778) * z) <= 2e+221) tmp = Float64(fma(Float64(z * y), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(z / x) * z) * 0.0007936500793651); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision], 2e+221], N[(N[(N[(z * y), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(z / x), $MachinePrecision] * z), $MachinePrecision] * 0.0007936500793651), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right) \cdot z \leq 2 \cdot 10^{+221}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z \cdot y, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{x} \cdot z\right) \cdot 0.0007936500793651\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 2.0000000000000001e221Initial program 99.6%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6459.8
Applied rewrites59.8%
Taylor expanded in y around inf
Applied rewrites55.0%
if 2.0000000000000001e221 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 85.8%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
Applied rewrites85.3%
Taylor expanded in z around inf
Applied rewrites71.7%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (if (<= (* (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778) z) 0.0001) (/ (fma -0.0027777777777778 z 0.083333333333333) x) (* (* (/ z x) z) 0.0007936500793651)))
double code(double x, double y, double z) {
double tmp;
if ((((z * (0.0007936500793651 + y)) - 0.0027777777777778) * z) <= 0.0001) {
tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
} else {
tmp = ((z / x) * z) * 0.0007936500793651;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778) * z) <= 0.0001) tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(z / x) * z) * 0.0007936500793651); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision] * z), $MachinePrecision], 0.0001], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(z / x), $MachinePrecision] * z), $MachinePrecision] * 0.0007936500793651), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right) \cdot z \leq 0.0001:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{x} \cdot z\right) \cdot 0.0007936500793651\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 1.00000000000000005e-4Initial program 99.6%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6458.0
Applied rewrites58.0%
Taylor expanded in z around 0
Applied rewrites37.5%
if 1.00000000000000005e-4 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 89.5%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
Applied rewrites80.2%
Taylor expanded in z around inf
Applied rewrites60.4%
Final simplification46.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (fma (* z y) z 0.083333333333333) x)))
(if (<= y -2200000.0)
t_0
(if (<= y 5.6e-13)
(/
(fma
(fma 0.0007936500793651 z -0.0027777777777778)
z
0.083333333333333)
x)
t_0))))
double code(double x, double y, double z) {
double t_0 = fma((z * y), z, 0.083333333333333) / x;
double tmp;
if (y <= -2200000.0) {
tmp = t_0;
} else if (y <= 5.6e-13) {
tmp = fma(fma(0.0007936500793651, z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(fma(Float64(z * y), z, 0.083333333333333) / x) tmp = 0.0 if (y <= -2200000.0) tmp = t_0; elseif (y <= 5.6e-13) tmp = Float64(fma(fma(0.0007936500793651, z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = t_0; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(z * y), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[y, -2200000.0], t$95$0, If[LessEqual[y, 5.6e-13], N[(N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(z \cdot y, z, 0.083333333333333\right)}{x}\\
\mathbf{if}\;y \leq -2200000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-13}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -2.2e6 or 5.6000000000000004e-13 < y Initial program 95.9%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6473.9
Applied rewrites73.9%
Taylor expanded in y around inf
Applied rewrites73.9%
if -2.2e6 < y < 5.6000000000000004e-13Initial program 94.9%
Taylor expanded in y around 0
associate--l+N/A
+-commutativeN/A
associate-+l-N/A
lower--.f64N/A
Applied rewrites99.4%
Taylor expanded in x around 0
Applied rewrites58.3%
(FPCore (x y z) :precision binary64 (/ (fma (fma (+ 0.0007936500793651 y) z -0.0027777777777778) z 0.083333333333333) x))
double code(double x, double y, double z) {
return fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x;
}
function code(x, y, z) return Float64(fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x) end
code[x_, y_, z_] := N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}
\end{array}
Initial program 95.4%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6466.9
Applied rewrites66.9%
Final simplification66.9%
(FPCore (x y z) :precision binary64 (/ (fma -0.0027777777777778 z 0.083333333333333) x))
double code(double x, double y, double z) {
return fma(-0.0027777777777778, z, 0.083333333333333) / x;
}
function code(x, y, z) return Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x) end
code[x_, y_, z_] := N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}
\end{array}
Initial program 95.4%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f6466.9
Applied rewrites66.9%
Taylor expanded in z around 0
Applied rewrites27.7%
(FPCore (x y z) :precision binary64 (/ 0.083333333333333 x))
double code(double x, double y, double z) {
return 0.083333333333333 / x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = 0.083333333333333d0 / x
end function
public static double code(double x, double y, double z) {
return 0.083333333333333 / x;
}
def code(x, y, z): return 0.083333333333333 / x
function code(x, y, z) return Float64(0.083333333333333 / x) end
function tmp = code(x, y, z) tmp = 0.083333333333333 / x; end
code[x_, y_, z_] := N[(0.083333333333333 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.083333333333333}{x}
\end{array}
Initial program 95.4%
Taylor expanded in z around 0
associate-+r+N/A
+-commutativeN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-log.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6454.4
Applied rewrites54.4%
Taylor expanded in x around 0
Applied rewrites22.1%
(FPCore (x y z) :precision binary64 (+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((x - 0.5d0) * log(x)) + (0.91893853320467d0 - x)) + (0.083333333333333d0 / x)) + ((z / x) * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) + Float64(0.91893853320467 - x)) + Float64(0.083333333333333 / x)) + Float64(Float64(z / x) * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778)); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(z / x), $MachinePrecision] * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \frac{0.083333333333333}{x}\right) + \frac{z}{x} \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)
\end{array}
herbie shell --seed 2024267
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (* (- x 1/2) (log x)) (- 91893853320467/100000000000000 x)) (/ 83333333333333/1000000000000000 x)) (* (/ z x) (- (* z (+ y 7936500793651/10000000000000000)) 13888888888889/5000000000000000))))
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))