
(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 16 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 (<= x 1.3e-10)
(-
(* (log x) (- x 0.5))
(-
(- x 0.91893853320467)
(/
(fma
(fma z (+ 0.0007936500793651 y) -0.0027777777777778)
z
0.083333333333333)
x)))
(fma
-0.083333333333333
(/ -1.0 x)
(fma
(fma (/ y x) z (/ (fma 0.0007936500793651 z -0.0027777777777778) x))
z
(fma (log x) (- x 0.5) (- 0.91893853320467 x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.3e-10) {
tmp = (log(x) * (x - 0.5)) - ((x - 0.91893853320467) - (fma(fma(z, (0.0007936500793651 + y), -0.0027777777777778), z, 0.083333333333333) / x));
} else {
tmp = fma(-0.083333333333333, (-1.0 / x), fma(fma((y / x), z, (fma(0.0007936500793651, z, -0.0027777777777778) / x)), z, fma(log(x), (x - 0.5), (0.91893853320467 - x))));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.3e-10) tmp = Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(Float64(x - 0.91893853320467) - Float64(fma(fma(z, Float64(0.0007936500793651 + y), -0.0027777777777778), z, 0.083333333333333) / x))); else tmp = fma(-0.083333333333333, Float64(-1.0 / x), fma(fma(Float64(y / x), z, Float64(fma(0.0007936500793651, z, -0.0027777777777778) / x)), z, fma(log(x), Float64(x - 0.5), Float64(0.91893853320467 - x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.3e-10], N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(x - 0.91893853320467), $MachinePrecision] - N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.083333333333333 * N[(-1.0 / x), $MachinePrecision] + N[(N[(N[(y / x), $MachinePrecision] * z + N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * z + N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{-10}:\\
\;\;\;\;\log x \cdot \left(x - 0.5\right) - \left(\left(x - 0.91893853320467\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0007936500793651 + y, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.083333333333333, \frac{-1}{x}, \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(\log x, x - 0.5, 0.91893853320467 - x\right)\right)\right)\\
\end{array}
\end{array}
if x < 1.29999999999999991e-10Initial program 99.7%
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6499.7
Applied rewrites99.7%
if 1.29999999999999991e-10 < x Initial program 84.9%
Taylor expanded in y around 0
Applied rewrites99.5%
Applied rewrites99.5%
Applied rewrites99.6%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 -1e+122)
(fma (* z (/ z x)) y (/ 0.083333333333333 x))
(if (<= t_0 4e+306)
(+
(fma (- x 0.5) (log x) (- 0.91893853320467 x))
(/ 0.083333333333333 x))
(* (* (+ (/ y x) (/ 0.0007936500793651 x)) z) z)))))
double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= -1e+122) {
tmp = fma((z * (z / x)), y, (0.083333333333333 / x));
} else if (t_0 <= 4e+306) {
tmp = fma((x - 0.5), log(x), (0.91893853320467 - x)) + (0.083333333333333 / x);
} else {
tmp = (((y / x) + (0.0007936500793651 / x)) * z) * z;
}
return tmp;
}
function code(x, y, z) t_0 = 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)) tmp = 0.0 if (t_0 <= -1e+122) tmp = fma(Float64(z * Float64(z / x)), y, Float64(0.083333333333333 / x)); elseif (t_0 <= 4e+306) tmp = Float64(fma(Float64(x - 0.5), log(x), Float64(0.91893853320467 - x)) + Float64(0.083333333333333 / x)); else tmp = Float64(Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * z) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, -1e+122], N[(N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision] * y + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+306], N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \frac{z}{x}, y, \frac{0.083333333333333}{x}\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467 - x\right) + \frac{0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -1.00000000000000001e122Initial program 84.1%
Taylor expanded in y around inf
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites8.5%
Taylor expanded in y around inf
Applied rewrites90.7%
if -1.00000000000000001e122 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.00000000000000007e306Initial program 99.4%
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6499.4
Applied rewrites99.4%
Taylor expanded in z around 0
Applied rewrites90.1%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
Applied rewrites90.2%
if 4.00000000000000007e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 78.5%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6487.9
Applied rewrites87.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 -1e+122)
(fma (* z (/ z x)) y (/ 0.083333333333333 x))
(if (<= t_0 4e+306)
(fma
(- x 0.5)
(log x)
(- (+ (/ 0.083333333333333 x) 0.91893853320467) x))
(* (* (+ (/ y x) (/ 0.0007936500793651 x)) z) z)))))
double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= -1e+122) {
tmp = fma((z * (z / x)), y, (0.083333333333333 / x));
} else if (t_0 <= 4e+306) {
tmp = fma((x - 0.5), log(x), (((0.083333333333333 / x) + 0.91893853320467) - x));
} else {
tmp = (((y / x) + (0.0007936500793651 / x)) * z) * z;
}
return tmp;
}
function code(x, y, z) t_0 = 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)) tmp = 0.0 if (t_0 <= -1e+122) tmp = fma(Float64(z * Float64(z / x)), y, Float64(0.083333333333333 / x)); elseif (t_0 <= 4e+306) tmp = fma(Float64(x - 0.5), log(x), Float64(Float64(Float64(0.083333333333333 / x) + 0.91893853320467) - x)); else tmp = Float64(Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * z) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, -1e+122], N[(N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision] * y + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+306], 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[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \frac{z}{x}, y, \frac{0.083333333333333}{x}\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(x - 0.5, \log x, \left(\frac{0.083333333333333}{x} + 0.91893853320467\right) - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -1.00000000000000001e122Initial program 84.1%
Taylor expanded in y around inf
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites8.5%
Taylor expanded in y around inf
Applied rewrites90.7%
if -1.00000000000000001e122 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.00000000000000007e306Initial program 99.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-/.f6490.1
Applied rewrites90.1%
if 4.00000000000000007e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 78.5%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6487.9
Applied rewrites87.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 -1e+122)
(fma (* z (/ z x)) y (/ 0.083333333333333 x))
(if (<= t_0 4e+306)
(-
(fma (log x) (- x 0.5) (+ (/ 0.083333333333333 x) 0.91893853320467))
x)
(* (* (+ (/ y x) (/ 0.0007936500793651 x)) z) z)))))
double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= -1e+122) {
tmp = fma((z * (z / x)), y, (0.083333333333333 / x));
} else if (t_0 <= 4e+306) {
tmp = fma(log(x), (x - 0.5), ((0.083333333333333 / x) + 0.91893853320467)) - x;
} else {
tmp = (((y / x) + (0.0007936500793651 / x)) * z) * z;
}
return tmp;
}
function code(x, y, z) t_0 = 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)) tmp = 0.0 if (t_0 <= -1e+122) tmp = fma(Float64(z * Float64(z / x)), y, Float64(0.083333333333333 / x)); elseif (t_0 <= 4e+306) tmp = Float64(fma(log(x), Float64(x - 0.5), Float64(Float64(0.083333333333333 / x) + 0.91893853320467)) - x); else tmp = Float64(Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * z) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, -1e+122], N[(N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision] * y + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+306], N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] + 0.91893853320467), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \frac{z}{x}, y, \frac{0.083333333333333}{x}\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+306}:\\
\;\;\;\;\mathsf{fma}\left(\log x, x - 0.5, \frac{0.083333333333333}{x} + 0.91893853320467\right) - x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -1.00000000000000001e122Initial program 84.1%
Taylor expanded in y around inf
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites8.5%
Taylor expanded in y around inf
Applied rewrites90.7%
if -1.00000000000000001e122 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.00000000000000007e306Initial program 99.4%
Taylor expanded in y around inf
Applied rewrites92.3%
Taylor expanded in z around 0
lower--.f64N/A
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6490.1
Applied rewrites90.1%
if 4.00000000000000007e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 78.5%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6487.9
Applied rewrites87.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
(* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z)
0.083333333333333)
x))))
(if (<= t_0 -1e+122)
(fma (* z (/ z x)) y (/ 0.083333333333333 x))
(if (<= t_0 4e+306)
(- (* (log x) x) (- (- x 0.91893853320467) (/ 0.083333333333333 x)))
(* (* (+ (/ y x) (/ 0.0007936500793651 x)) z) z)))))
double code(double x, double y, double z) {
double t_0 = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((((((y + 0.0007936500793651) * z) - 0.0027777777777778) * z) + 0.083333333333333) / x);
double tmp;
if (t_0 <= -1e+122) {
tmp = fma((z * (z / x)), y, (0.083333333333333 / x));
} else if (t_0 <= 4e+306) {
tmp = (log(x) * x) - ((x - 0.91893853320467) - (0.083333333333333 / x));
} else {
tmp = (((y / x) + (0.0007936500793651 / x)) * z) * z;
}
return tmp;
}
function code(x, y, z) t_0 = 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)) tmp = 0.0 if (t_0 <= -1e+122) tmp = fma(Float64(z * Float64(z / x)), y, Float64(0.083333333333333 / x)); elseif (t_0 <= 4e+306) tmp = Float64(Float64(log(x) * x) - Float64(Float64(x - 0.91893853320467) - Float64(0.083333333333333 / x))); else tmp = Float64(Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * z) * z); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = 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]}, If[LessEqual[t$95$0, -1e+122], N[(N[(z * N[(z / x), $MachinePrecision]), $MachinePrecision] * y + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 4e+306], N[(N[(N[Log[x], $MachinePrecision] * x), $MachinePrecision] - N[(N[(x - 0.91893853320467), $MachinePrecision] - N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \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}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+122}:\\
\;\;\;\;\mathsf{fma}\left(z \cdot \frac{z}{x}, y, \frac{0.083333333333333}{x}\right)\\
\mathbf{elif}\;t\_0 \leq 4 \cdot 10^{+306}:\\
\;\;\;\;\log x \cdot x - \left(\left(x - 0.91893853320467\right) - \frac{0.083333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot z\right) \cdot z\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -1.00000000000000001e122Initial program 84.1%
Taylor expanded in y around inf
Applied rewrites99.8%
Taylor expanded in z around 0
Applied rewrites8.5%
Taylor expanded in y around inf
Applied rewrites90.7%
if -1.00000000000000001e122 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.00000000000000007e306Initial program 99.4%
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6499.4
Applied rewrites99.4%
Taylor expanded in z around 0
Applied rewrites90.1%
Taylor expanded in x around inf
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f6486.3
Applied rewrites86.3%
if 4.00000000000000007e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 78.5%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6487.9
Applied rewrites87.9%
(FPCore (x y z)
:precision binary64
(if (<= x 2e+77)
(-
(* (log x) (- x 0.5))
(-
(- x 0.91893853320467)
(/
(fma
(fma z (+ 0.0007936500793651 y) -0.0027777777777778)
z
0.083333333333333)
x)))
(-
(+
(fma
(fma (/ y x) z (/ (fma 0.0007936500793651 z -0.0027777777777778) x))
z
(/ 0.083333333333333 x))
(fma (- x 0.5) (log x) 0.91893853320467))
x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e+77) {
tmp = (log(x) * (x - 0.5)) - ((x - 0.91893853320467) - (fma(fma(z, (0.0007936500793651 + y), -0.0027777777777778), z, 0.083333333333333) / x));
} else {
tmp = (fma(fma((y / x), z, (fma(0.0007936500793651, z, -0.0027777777777778) / x)), z, (0.083333333333333 / x)) + fma((x - 0.5), log(x), 0.91893853320467)) - x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 2e+77) tmp = Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(Float64(x - 0.91893853320467) - Float64(fma(fma(z, Float64(0.0007936500793651 + y), -0.0027777777777778), z, 0.083333333333333) / x))); else tmp = Float64(Float64(fma(fma(Float64(y / x), z, Float64(fma(0.0007936500793651, z, -0.0027777777777778) / x)), z, Float64(0.083333333333333 / x)) + fma(Float64(x - 0.5), log(x), 0.91893853320467)) - x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 2e+77], N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(x - 0.91893853320467), $MachinePrecision] - N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(y / x), $MachinePrecision] * z + N[(N[(0.0007936500793651 * z + -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * z + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + 0.91893853320467), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+77}:\\
\;\;\;\;\log x \cdot \left(x - 0.5\right) - \left(\left(x - 0.91893853320467\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0007936500793651 + y, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{y}{x}, z, \frac{\mathsf{fma}\left(0.0007936500793651, z, -0.0027777777777778\right)}{x}\right), z, \frac{0.083333333333333}{x}\right) + \mathsf{fma}\left(x - 0.5, \log x, 0.91893853320467\right)\right) - x\\
\end{array}
\end{array}
if x < 1.99999999999999997e77Initial program 99.6%
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6499.7
Applied rewrites99.7%
if 1.99999999999999997e77 < x Initial program 79.8%
Taylor expanded in y around 0
Applied rewrites99.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (log x) (- x 0.5))))
(if (<= x 2300.0)
(-
t_0
(-
(- x 0.91893853320467)
(/
(fma
(fma z (+ 0.0007936500793651 y) -0.0027777777777778)
z
0.083333333333333)
x)))
(-
t_0
(- (- x 0.91893853320467) (* z (/ (* (+ 0.0007936500793651 y) z) x)))))))
double code(double x, double y, double z) {
double t_0 = log(x) * (x - 0.5);
double tmp;
if (x <= 2300.0) {
tmp = t_0 - ((x - 0.91893853320467) - (fma(fma(z, (0.0007936500793651 + y), -0.0027777777777778), z, 0.083333333333333) / x));
} else {
tmp = t_0 - ((x - 0.91893853320467) - (z * (((0.0007936500793651 + y) * z) / x)));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(log(x) * Float64(x - 0.5)) tmp = 0.0 if (x <= 2300.0) tmp = Float64(t_0 - Float64(Float64(x - 0.91893853320467) - Float64(fma(fma(z, Float64(0.0007936500793651 + y), -0.0027777777777778), z, 0.083333333333333) / x))); else tmp = Float64(t_0 - Float64(Float64(x - 0.91893853320467) - Float64(z * Float64(Float64(Float64(0.0007936500793651 + y) * z) / x)))); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2300.0], N[(t$95$0 - N[(N[(x - 0.91893853320467), $MachinePrecision] - N[(N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(N[(x - 0.91893853320467), $MachinePrecision] - N[(z * N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log x \cdot \left(x - 0.5\right)\\
\mathbf{if}\;x \leq 2300:\\
\;\;\;\;t\_0 - \left(\left(x - 0.91893853320467\right) - \frac{\mathsf{fma}\left(\mathsf{fma}\left(z, 0.0007936500793651 + y, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \left(\left(x - 0.91893853320467\right) - z \cdot \frac{\left(0.0007936500793651 + y\right) \cdot z}{x}\right)\\
\end{array}
\end{array}
if x < 2300Initial program 99.6%
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6499.6
Applied rewrites99.6%
if 2300 < x Initial program 83.5%
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6483.5
Applied rewrites83.5%
Taylor expanded in z around inf
associate-/l*N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites96.6%
(FPCore (x y z)
:precision binary64
(if (<= x 0.038)
(/
(fma
(fma (+ 0.0007936500793651 y) z -0.0027777777777778)
z
0.083333333333333)
x)
(-
(* (log x) (- x 0.5))
(- (- x 0.91893853320467) (* z (/ (* (+ 0.0007936500793651 y) z) x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.038) {
tmp = fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = (log(x) * (x - 0.5)) - ((x - 0.91893853320467) - (z * (((0.0007936500793651 + y) * z) / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 0.038) tmp = Float64(fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(log(x) * Float64(x - 0.5)) - Float64(Float64(x - 0.91893853320467) - Float64(z * Float64(Float64(Float64(0.0007936500793651 + y) * z) / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 0.038], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(x - 0.91893853320467), $MachinePrecision] - N[(z * N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.038:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\log x \cdot \left(x - 0.5\right) - \left(\left(x - 0.91893853320467\right) - z \cdot \frac{\left(0.0007936500793651 + y\right) \cdot z}{x}\right)\\
\end{array}
\end{array}
if x < 0.0379999999999999991Initial 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
lower-+.f6496.8
Applied rewrites96.8%
if 0.0379999999999999991 < x Initial program 84.0%
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
lower--.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6484.0
Applied rewrites84.0%
Taylor expanded in z around inf
associate-/l*N/A
unpow2N/A
associate-*l*N/A
associate-/l*N/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
*-lft-identityN/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites95.5%
(FPCore (x y z)
:precision binary64
(if (<= x 7e+40)
(/
(fma
(fma (+ 0.0007936500793651 y) z -0.0027777777777778)
z
0.083333333333333)
x)
(* (* (/ (- (log x) 1.0) y) y) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 7e+40) {
tmp = fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = (((log(x) - 1.0) / y) * y) * x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 7e+40) tmp = Float64(fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(Float64(log(x) - 1.0) / y) * y) * x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 7e+40], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(N[Log[x], $MachinePrecision] - 1.0), $MachinePrecision] / y), $MachinePrecision] * y), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7 \cdot 10^{+40}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\log x - 1}{y} \cdot y\right) \cdot x\\
\end{array}
\end{array}
if x < 6.9999999999999998e40Initial 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
lower-+.f6494.0
Applied rewrites94.0%
if 6.9999999999999998e40 < x Initial program 81.8%
Taylor expanded in y around inf
Applied rewrites63.7%
Taylor expanded in x around inf
Applied rewrites49.1%
Taylor expanded in x around inf
Applied rewrites71.5%
(FPCore (x y z)
:precision binary64
(if (<= x 1e-40)
(/
(fma
(fma (+ 0.0007936500793651 y) z -0.0027777777777778)
z
0.083333333333333)
x)
(fma
-0.083333333333333
(/ -1.0 x)
(* (* (/ z x) (+ 0.0007936500793651 y)) z))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1e-40) {
tmp = fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = fma(-0.083333333333333, (-1.0 / x), (((z / x) * (0.0007936500793651 + y)) * z));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1e-40) tmp = Float64(fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = fma(-0.083333333333333, Float64(-1.0 / x), Float64(Float64(Float64(z / x) * Float64(0.0007936500793651 + y)) * z)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1e-40], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(-0.083333333333333 * N[(-1.0 / x), $MachinePrecision] + N[(N[(N[(z / x), $MachinePrecision] * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 10^{-40}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.083333333333333, \frac{-1}{x}, \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right) \cdot z\right)\\
\end{array}
\end{array}
if x < 9.9999999999999993e-41Initial 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
lower-+.f6499.7
Applied rewrites99.7%
if 9.9999999999999993e-41 < x Initial program 85.8%
Taylor expanded in y around 0
Applied rewrites99.5%
Applied rewrites99.5%
Applied rewrites99.6%
Taylor expanded in z around inf
Applied rewrites40.7%
Final simplification65.3%
(FPCore (x y z)
:precision binary64
(if (<= x 4e+78)
(/
(fma
(fma (+ 0.0007936500793651 y) z -0.0027777777777778)
z
0.083333333333333)
x)
(* (* (+ (/ y x) (/ 0.0007936500793651 x)) z) z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 4e+78) {
tmp = fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = (((y / x) + (0.0007936500793651 / x)) * z) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 4e+78) tmp = Float64(fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * z) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 4e+78], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4 \cdot 10^{+78}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot z\right) \cdot z\\
\end{array}
\end{array}
if x < 4.00000000000000003e78Initial 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
lower-+.f6489.5
Applied rewrites89.5%
if 4.00000000000000003e78 < x Initial program 79.8%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6429.9
Applied rewrites29.9%
(FPCore (x y z)
:precision binary64
(if (<= x 7.2e+72)
(/
(fma
(fma (+ 0.0007936500793651 y) z -0.0027777777777778)
z
0.083333333333333)
x)
(* (* (/ z x) (+ 0.0007936500793651 y)) z)))
double code(double x, double y, double z) {
double tmp;
if (x <= 7.2e+72) {
tmp = fma(fma((0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x;
} else {
tmp = ((z / x) * (0.0007936500793651 + y)) * z;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 7.2e+72) tmp = Float64(fma(fma(Float64(0.0007936500793651 + y), z, -0.0027777777777778), z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(z / x) * Float64(0.0007936500793651 + y)) * z); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 7.2e+72], N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(z / x), $MachinePrecision] * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{+72}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.0007936500793651 + y, z, -0.0027777777777778\right), z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right) \cdot z\\
\end{array}
\end{array}
if x < 7.20000000000000069e72Initial 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
lower-+.f6490.0
Applied rewrites90.0%
if 7.20000000000000069e72 < x Initial program 80.2%
Taylor expanded in y around inf
Applied rewrites90.8%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-/l*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6430.3
Applied rewrites30.3%
(FPCore (x y z) :precision binary64 (* (* (/ z x) (+ 0.0007936500793651 y)) z))
double code(double x, double y, double z) {
return ((z / x) * (0.0007936500793651 + 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 = ((z / x) * (0.0007936500793651d0 + y)) * z
end function
public static double code(double x, double y, double z) {
return ((z / x) * (0.0007936500793651 + y)) * z;
}
def code(x, y, z): return ((z / x) * (0.0007936500793651 + y)) * z
function code(x, y, z) return Float64(Float64(Float64(z / x) * Float64(0.0007936500793651 + y)) * z) end
function tmp = code(x, y, z) tmp = ((z / x) * (0.0007936500793651 + y)) * z; end
code[x_, y_, z_] := N[(N[(N[(z / x), $MachinePrecision] * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right) \cdot z
\end{array}
Initial program 91.6%
Taylor expanded in y around inf
Applied rewrites93.0%
Taylor expanded in z around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-inN/A
associate-*l*N/A
associate-*l/N/A
*-lft-identityN/A
associate-*l/N/A
associate-/l*N/A
distribute-rgt-outN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6443.5
Applied rewrites43.5%
(FPCore (x y z) :precision binary64 (* (/ (* (+ 0.0007936500793651 y) z) x) z))
double code(double x, double y, double z) {
return (((0.0007936500793651 + y) * z) / x) * z;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (((0.0007936500793651d0 + y) * z) / x) * z
end function
public static double code(double x, double y, double z) {
return (((0.0007936500793651 + y) * z) / x) * z;
}
def code(x, y, z): return (((0.0007936500793651 + y) * z) / x) * z
function code(x, y, z) return Float64(Float64(Float64(Float64(0.0007936500793651 + y) * z) / x) * z) end
function tmp = code(x, y, z) tmp = (((0.0007936500793651 + y) * z) / x) * z; end
code[x_, y_, z_] := N[(N[(N[(N[(0.0007936500793651 + y), $MachinePrecision] * z), $MachinePrecision] / x), $MachinePrecision] * z), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(0.0007936500793651 + y\right) \cdot z}{x} \cdot z
\end{array}
Initial program 91.6%
Taylor expanded in y around inf
Applied rewrites80.3%
Taylor expanded in x around inf
Applied rewrites44.6%
Taylor expanded in z around inf
Applied rewrites42.8%
(FPCore (x y z) :precision binary64 (* y (* (/ z x) z)))
double code(double x, double y, double z) {
return y * ((z / x) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y * ((z / x) * z)
end function
public static double code(double x, double y, double z) {
return y * ((z / x) * z);
}
def code(x, y, z): return y * ((z / x) * z)
function code(x, y, z) return Float64(y * Float64(Float64(z / x) * z)) end
function tmp = code(x, y, z) tmp = y * ((z / x) * z); end
code[x_, y_, z_] := N[(y * N[(N[(z / x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(\frac{z}{x} \cdot z\right)
\end{array}
Initial program 91.6%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f6432.4
Applied rewrites32.4%
Applied rewrites35.1%
(FPCore (x y z) :precision binary64 (* -0.0027777777777778 (/ z x)))
double code(double x, double y, double z) {
return -0.0027777777777778 * (z / 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.0027777777777778d0) * (z / x)
end function
public static double code(double x, double y, double z) {
return -0.0027777777777778 * (z / x);
}
def code(x, y, z): return -0.0027777777777778 * (z / x)
function code(x, y, z) return Float64(-0.0027777777777778 * Float64(z / x)) end
function tmp = code(x, y, z) tmp = -0.0027777777777778 * (z / x); end
code[x_, y_, z_] := N[(-0.0027777777777778 * N[(z / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-0.0027777777777778 \cdot \frac{z}{x}
\end{array}
Initial program 91.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
metadata-evalN/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
lower-/.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f6439.8
Applied rewrites39.8%
Taylor expanded in z around 0
Applied rewrites7.4%
(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 2024313
(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)))