
(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 12 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 9.8e+73)
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x))
(+
(+
(* 0.083333333333333 (/ 1.0 x))
(* z (* (+ 0.0007936500793651 y) (/ z x))))
(* x (+ (log x) -1.0)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 9.8e+73) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
} else {
tmp = ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x)))) + (x * (log(x) + -1.0));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 9.8d+73) then
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x)
else
tmp = ((0.083333333333333d0 * (1.0d0 / x)) + (z * ((0.0007936500793651d0 + y) * (z / x)))) + (x * (log(x) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 9.8e+73) {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
} else {
tmp = ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x)))) + (x * (Math.log(x) + -1.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 9.8e+73: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) else: tmp = ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x)))) + (x * (math.log(x) + -1.0)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 9.8e+73) tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x)); else tmp = Float64(Float64(Float64(0.083333333333333 * Float64(1.0 / x)) + Float64(z * Float64(Float64(0.0007936500793651 + y) * Float64(z / x)))) + Float64(x * Float64(log(x) + -1.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 9.8e+73) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x); else tmp = ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x)))) + (x * (log(x) + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 9.8e+73], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.8 \cdot 10^{+73}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(0.083333333333333 \cdot \frac{1}{x} + z \cdot \left(\left(0.0007936500793651 + y\right) \cdot \frac{z}{x}\right)\right) + x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 9.7999999999999998e73Initial program 99.7%
if 9.7999999999999998e73 < x Initial program 83.6%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 88.8%
unpow288.8%
associate-*r/88.8%
metadata-eval88.8%
associate-*l*99.6%
distribute-rgt-in99.6%
associate-*l/99.6%
associate-*r/99.6%
associate-*l/96.6%
associate-/l*99.6%
distribute-rgt-out99.6%
Simplified99.6%
Taylor expanded in x around inf 99.7%
sub-neg99.7%
mul-1-neg99.7%
log-rec99.7%
remove-double-neg99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (+ (* z (/ (+ 0.0007936500793651 y) (/ x z))) (* 0.083333333333333 (/ 1.0 x)))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((z * ((0.0007936500793651 + y) / (x / z))) + (0.083333333333333 * (1.0 / 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) + ((z * ((0.0007936500793651d0 + y) / (x / z))) + (0.083333333333333d0 * (1.0d0 / x)))
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((z * ((0.0007936500793651 + y) / (x / z))) + (0.083333333333333 * (1.0 / x)));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((z * ((0.0007936500793651 + y) / (x / z))) + (0.083333333333333 * (1.0 / x)))
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(z * Float64(Float64(0.0007936500793651 + y) / Float64(x / z))) + Float64(0.083333333333333 * Float64(1.0 / x)))) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((z * ((0.0007936500793651 + y) / (x / z))) + (0.083333333333333 * (1.0 / 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[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(z \cdot \frac{0.0007936500793651 + y}{\frac{x}{z}} + 0.083333333333333 \cdot \frac{1}{x}\right)
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 95.2%
Taylor expanded in z around inf 91.2%
unpow291.2%
associate-*r/91.2%
metadata-eval91.2%
associate-*l*95.2%
distribute-rgt-in92.4%
associate-*l/92.4%
associate-*r/92.4%
associate-*l/95.1%
associate-/l*94.2%
distribute-rgt-out98.9%
Simplified98.9%
*-commutative98.9%
clear-num98.8%
un-div-inv98.9%
Applied egg-rr98.9%
(FPCore (x y z) :precision binary64 (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (+ (* 0.083333333333333 (/ 1.0 x)) (* z (* (+ 0.0007936500793651 y) (/ z x))))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (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 = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((0.083333333333333d0 * (1.0d0 / x)) + (z * ((0.0007936500793651d0 + y) * (z / x))))
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x))));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x))))
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(0.083333333333333 * Float64(1.0 / x)) + Float64(z * Float64(Float64(0.0007936500793651 + y) * Float64(z / x))))) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / 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[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(0.083333333333333 \cdot \frac{1}{x} + z \cdot \left(\left(0.0007936500793651 + y\right) \cdot \frac{z}{x}\right)\right)
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 95.2%
Taylor expanded in z around inf 91.2%
unpow291.2%
associate-*r/91.2%
metadata-eval91.2%
associate-*l*95.2%
distribute-rgt-in92.4%
associate-*l/92.4%
associate-*r/92.4%
associate-*l/95.1%
associate-/l*94.2%
distribute-rgt-out98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ (log x) -1.0))))
(if (<= x 2.6e+199)
(+
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x)
t_0)
(+ t_0 (/ 0.083333333333333 x)))))
double code(double x, double y, double z) {
double t_0 = x * (log(x) + -1.0);
double tmp;
if (x <= 2.6e+199) {
tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + t_0;
} else {
tmp = t_0 + (0.083333333333333 / x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (log(x) + (-1.0d0))
if (x <= 2.6d+199) then
tmp = ((0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x) + t_0
else
tmp = t_0 + (0.083333333333333d0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (Math.log(x) + -1.0);
double tmp;
if (x <= 2.6e+199) {
tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + t_0;
} else {
tmp = t_0 + (0.083333333333333 / x);
}
return tmp;
}
def code(x, y, z): t_0 = x * (math.log(x) + -1.0) tmp = 0 if x <= 2.6e+199: tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + t_0 else: tmp = t_0 + (0.083333333333333 / x) return tmp
function code(x, y, z) t_0 = Float64(x * Float64(log(x) + -1.0)) tmp = 0.0 if (x <= 2.6e+199) tmp = Float64(Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x) + t_0); else tmp = Float64(t_0 + Float64(0.083333333333333 / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (log(x) + -1.0); tmp = 0.0; if (x <= 2.6e+199) tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + t_0; else tmp = t_0 + (0.083333333333333 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.6e+199], N[(N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + t$95$0), $MachinePrecision], N[(t$95$0 + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(\log x + -1\right)\\
\mathbf{if}\;x \leq 2.6 \cdot 10^{+199}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} + t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{0.083333333333333}{x}\\
\end{array}
\end{array}
if x < 2.6000000000000001e199Initial program 98.0%
Taylor expanded in x around inf 96.9%
sub-neg97.7%
mul-1-neg97.7%
log-rec97.7%
remove-double-neg97.7%
metadata-eval97.7%
+-commutative97.7%
Simplified96.9%
if 2.6000000000000001e199 < x Initial program 71.7%
Taylor expanded in z around 0 87.8%
Taylor expanded in x around inf 87.8%
sub-neg99.6%
mul-1-neg99.6%
log-rec99.6%
remove-double-neg99.6%
metadata-eval99.6%
+-commutative99.6%
Simplified87.8%
Final simplification95.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* x (log x)) x)))
(if (<= y -6.8e-20)
(+ t_0 (/ (+ 0.083333333333333 (* z -0.0027777777777778)) x))
(+
t_0
(/
(+
0.083333333333333
(* z (- (* z 0.0007936500793651) 0.0027777777777778)))
x)))))
double code(double x, double y, double z) {
double t_0 = (x * log(x)) - x;
double tmp;
if (y <= -6.8e-20) {
tmp = t_0 + ((0.083333333333333 + (z * -0.0027777777777778)) / x);
} else {
tmp = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (x * log(x)) - x
if (y <= (-6.8d-20)) then
tmp = t_0 + ((0.083333333333333d0 + (z * (-0.0027777777777778d0))) / x)
else
tmp = t_0 + ((0.083333333333333d0 + (z * ((z * 0.0007936500793651d0) - 0.0027777777777778d0))) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (x * Math.log(x)) - x;
double tmp;
if (y <= -6.8e-20) {
tmp = t_0 + ((0.083333333333333 + (z * -0.0027777777777778)) / x);
} else {
tmp = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
}
return tmp;
}
def code(x, y, z): t_0 = (x * math.log(x)) - x tmp = 0 if y <= -6.8e-20: tmp = t_0 + ((0.083333333333333 + (z * -0.0027777777777778)) / x) else: tmp = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x) return tmp
function code(x, y, z) t_0 = Float64(Float64(x * log(x)) - x) tmp = 0.0 if (y <= -6.8e-20) tmp = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * -0.0027777777777778)) / x)); else tmp = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * 0.0007936500793651) - 0.0027777777777778))) / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (x * log(x)) - x; tmp = 0.0; if (y <= -6.8e-20) tmp = t_0 + ((0.083333333333333 + (z * -0.0027777777777778)) / x); else tmp = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[LessEqual[y, -6.8e-20], N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * -0.0027777777777778), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * 0.0007936500793651), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \log x - x\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{-20}:\\
\;\;\;\;t\_0 + \frac{0.083333333333333 + z \cdot -0.0027777777777778}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right)}{x}\\
\end{array}
\end{array}
if y < -6.7999999999999994e-20Initial program 92.6%
Taylor expanded in x around 0 92.7%
sub-neg92.7%
metadata-eval92.7%
distribute-rgt-in92.6%
*-commutative92.6%
neg-mul-192.6%
associate-+l+92.6%
distribute-rgt-out92.6%
+-commutative92.6%
*-commutative92.6%
fma-define92.7%
fma-define92.6%
associate-+l+92.6%
sub-neg92.6%
+-commutative92.6%
*-commutative92.6%
fma-define92.6%
Simplified92.6%
Taylor expanded in x around inf 90.3%
mul-1-neg90.3%
distribute-rgt-neg-in90.3%
log-rec90.3%
remove-double-neg90.3%
Simplified90.3%
Taylor expanded in z around 0 66.1%
*-commutative66.1%
Simplified66.1%
if -6.7999999999999994e-20 < y Initial program 94.4%
Taylor expanded in x around 0 94.3%
sub-neg94.3%
metadata-eval94.3%
distribute-rgt-in94.4%
*-commutative94.4%
neg-mul-194.4%
associate-+l+94.4%
distribute-rgt-out94.4%
+-commutative94.4%
*-commutative94.4%
fma-define94.3%
fma-define94.4%
associate-+l+94.4%
sub-neg94.4%
+-commutative94.4%
*-commutative94.4%
fma-define94.4%
Simplified94.4%
Taylor expanded in x around inf 94.0%
mul-1-neg94.0%
distribute-rgt-neg-in94.0%
log-rec94.0%
remove-double-neg94.0%
Simplified94.0%
Taylor expanded in y around 0 89.5%
Final simplification83.3%
(FPCore (x y z) :precision binary64 (+ (+ (* 0.083333333333333 (/ 1.0 x)) (* z (* (+ 0.0007936500793651 y) (/ z x)))) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
return ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x)))) + (x * (log(x) + -1.0));
}
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 * (1.0d0 / x)) + (z * ((0.0007936500793651d0 + y) * (z / x)))) + (x * (log(x) + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x)))) + (x * (Math.log(x) + -1.0));
}
def code(x, y, z): return ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x)))) + (x * (math.log(x) + -1.0))
function code(x, y, z) return Float64(Float64(Float64(0.083333333333333 * Float64(1.0 / x)) + Float64(z * Float64(Float64(0.0007936500793651 + y) * Float64(z / x)))) + Float64(x * Float64(log(x) + -1.0))) end
function tmp = code(x, y, z) tmp = ((0.083333333333333 * (1.0 / x)) + (z * ((0.0007936500793651 + y) * (z / x)))) + (x * (log(x) + -1.0)); end
code[x_, y_, z_] := N[(N[(N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.083333333333333 \cdot \frac{1}{x} + z \cdot \left(\left(0.0007936500793651 + y\right) \cdot \frac{z}{x}\right)\right) + x \cdot \left(\log x + -1\right)
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 95.2%
Taylor expanded in z around inf 91.2%
unpow291.2%
associate-*r/91.2%
metadata-eval91.2%
associate-*l*95.2%
distribute-rgt-in92.4%
associate-*l/92.4%
associate-*r/92.4%
associate-*l/95.1%
associate-/l*94.2%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in x around inf 98.0%
sub-neg98.0%
mul-1-neg98.0%
log-rec98.0%
remove-double-neg98.0%
metadata-eval98.0%
+-commutative98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (+ (- (* x (log x)) x) (/ (+ 0.083333333333333 (* z -0.0027777777777778)) x)))
double code(double x, double y, double z) {
return ((x * log(x)) - x) + ((0.083333333333333 + (z * -0.0027777777777778)) / 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 * log(x)) - x) + ((0.083333333333333d0 + (z * (-0.0027777777777778d0))) / x)
end function
public static double code(double x, double y, double z) {
return ((x * Math.log(x)) - x) + ((0.083333333333333 + (z * -0.0027777777777778)) / x);
}
def code(x, y, z): return ((x * math.log(x)) - x) + ((0.083333333333333 + (z * -0.0027777777777778)) / x)
function code(x, y, z) return Float64(Float64(Float64(x * log(x)) - x) + Float64(Float64(0.083333333333333 + Float64(z * -0.0027777777777778)) / x)) end
function tmp = code(x, y, z) tmp = ((x * log(x)) - x) + ((0.083333333333333 + (z * -0.0027777777777778)) / x); end
code[x_, y_, z_] := N[(N[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + N[(N[(0.083333333333333 + N[(z * -0.0027777777777778), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \log x - x\right) + \frac{0.083333333333333 + z \cdot -0.0027777777777778}{x}
\end{array}
Initial program 93.9%
Taylor expanded in x around 0 93.9%
sub-neg93.9%
metadata-eval93.9%
distribute-rgt-in93.9%
*-commutative93.9%
neg-mul-193.9%
associate-+l+93.9%
distribute-rgt-out93.9%
+-commutative93.9%
*-commutative93.9%
fma-define93.9%
fma-define93.9%
associate-+l+93.9%
sub-neg93.9%
+-commutative93.9%
*-commutative93.9%
fma-define93.9%
Simplified93.9%
Taylor expanded in x around inf 93.0%
mul-1-neg93.0%
distribute-rgt-neg-in93.0%
log-rec93.0%
remove-double-neg93.0%
Simplified93.0%
Taylor expanded in z around 0 63.5%
*-commutative63.5%
Simplified63.5%
Final simplification63.5%
(FPCore (x y z) :precision binary64 (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ 0.083333333333333 x)))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (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) + (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) + (0.083333333333333 / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(0.083333333333333 / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (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[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 58.7%
(FPCore (x y z) :precision binary64 (+ (* 0.083333333333333 (/ 1.0 x)) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
return (0.083333333333333 * (1.0 / x)) + (x * (log(x) + -1.0));
}
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 * (1.0d0 / x)) + (x * (log(x) + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return (0.083333333333333 * (1.0 / x)) + (x * (Math.log(x) + -1.0));
}
def code(x, y, z): return (0.083333333333333 * (1.0 / x)) + (x * (math.log(x) + -1.0))
function code(x, y, z) return Float64(Float64(0.083333333333333 * Float64(1.0 / x)) + Float64(x * Float64(log(x) + -1.0))) end
function tmp = code(x, y, z) tmp = (0.083333333333333 * (1.0 / x)) + (x * (log(x) + -1.0)); end
code[x_, y_, z_] := N[(N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.083333333333333 \cdot \frac{1}{x} + x \cdot \left(\log x + -1\right)
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 58.7%
Taylor expanded in x around inf 57.7%
sub-neg98.0%
mul-1-neg98.0%
log-rec98.0%
remove-double-neg98.0%
metadata-eval98.0%
+-commutative98.0%
Simplified57.7%
div-inv57.8%
*-commutative57.8%
Applied egg-rr57.8%
Final simplification57.8%
(FPCore (x y z) :precision binary64 (+ (* x (+ (log x) -1.0)) (/ 0.083333333333333 x)))
double code(double x, double y, double z) {
return (x * (log(x) + -1.0)) + (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 * (log(x) + (-1.0d0))) + (0.083333333333333d0 / x)
end function
public static double code(double x, double y, double z) {
return (x * (Math.log(x) + -1.0)) + (0.083333333333333 / x);
}
def code(x, y, z): return (x * (math.log(x) + -1.0)) + (0.083333333333333 / x)
function code(x, y, z) return Float64(Float64(x * Float64(log(x) + -1.0)) + Float64(0.083333333333333 / x)) end
function tmp = code(x, y, z) tmp = (x * (log(x) + -1.0)) + (0.083333333333333 / x); end
code[x_, y_, z_] := N[(N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\log x + -1\right) + \frac{0.083333333333333}{x}
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 58.7%
Taylor expanded in x around inf 57.7%
sub-neg98.0%
mul-1-neg98.0%
log-rec98.0%
remove-double-neg98.0%
metadata-eval98.0%
+-commutative98.0%
Simplified57.7%
Final simplification57.7%
(FPCore (x y z) :precision binary64 (* 0.083333333333333 (/ 1.0 x)))
double code(double x, double y, double z) {
return 0.083333333333333 * (1.0 / 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 * (1.0d0 / x)
end function
public static double code(double x, double y, double z) {
return 0.083333333333333 * (1.0 / x);
}
def code(x, y, z): return 0.083333333333333 * (1.0 / x)
function code(x, y, z) return Float64(0.083333333333333 * Float64(1.0 / x)) end
function tmp = code(x, y, z) tmp = 0.083333333333333 * (1.0 / x); end
code[x_, y_, z_] := N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.083333333333333 \cdot \frac{1}{x}
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 58.7%
Taylor expanded in x around inf 57.7%
sub-neg98.0%
mul-1-neg98.0%
log-rec98.0%
remove-double-neg98.0%
metadata-eval98.0%
+-commutative98.0%
Simplified57.7%
Taylor expanded in x around 0 23.9%
div-inv57.8%
*-commutative57.8%
Applied egg-rr24.0%
Final simplification24.0%
(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 93.9%
Taylor expanded in z around 0 58.7%
Taylor expanded in x around inf 57.7%
sub-neg98.0%
mul-1-neg98.0%
log-rec98.0%
remove-double-neg98.0%
metadata-eval98.0%
+-commutative98.0%
Simplified57.7%
Taylor expanded in x around 0 23.9%
(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 2024108
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
:alt
(+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))