
(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 5e-22)
(-
(+ 0.91893853320467 (* (log x) -0.5))
(/
(-
(* z (- 0.0027777777777778 (* z (+ 0.0007936500793651 y))))
0.083333333333333)
x))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(+
(* (/ 1.0 x) 0.083333333333333)
(* z (* (+ 0.0007936500793651 y) (/ z x)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5e-22) {
tmp = (0.91893853320467 + (log(x) * -0.5)) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((1.0 / x) * 0.083333333333333) + (z * ((0.0007936500793651 + y) * (z / 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) :: tmp
if (x <= 5d-22) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) - (((z * (0.0027777777777778d0 - (z * (0.0007936500793651d0 + y)))) - 0.083333333333333d0) / x)
else
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + (((1.0d0 / x) * 0.083333333333333d0) + (z * ((0.0007936500793651d0 + y) * (z / x))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 5e-22) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + (((1.0 / x) * 0.083333333333333) + (z * ((0.0007936500793651 + y) * (z / x))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 5e-22: tmp = (0.91893853320467 + (math.log(x) * -0.5)) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x) else: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (((1.0 / x) * 0.083333333333333) + (z * ((0.0007936500793651 + y) * (z / x)))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 5e-22) tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) - Float64(Float64(Float64(z * Float64(0.0027777777777778 - Float64(z * Float64(0.0007936500793651 + y)))) - 0.083333333333333) / x)); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(Float64(1.0 / x) * 0.083333333333333) + Float64(z * Float64(Float64(0.0007936500793651 + y) * Float64(z / x))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 5e-22) tmp = (0.91893853320467 + (log(x) * -0.5)) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x); else tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (((1.0 / x) * 0.083333333333333) + (z * ((0.0007936500793651 + y) * (z / x)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 5e-22], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(z * N[(0.0027777777777778 - N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(N[(1.0 / x), $MachinePrecision] * 0.083333333333333), $MachinePrecision] + N[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-22}:\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) - \frac{z \cdot \left(0.0027777777777778 - z \cdot \left(0.0007936500793651 + y\right)\right) - 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\frac{1}{x} \cdot 0.083333333333333 + z \cdot \left(\left(0.0007936500793651 + y\right) \cdot \frac{z}{x}\right)\right)\\
\end{array}
\end{array}
if x < 4.99999999999999954e-22Initial program 99.6%
Taylor expanded in x around 0 99.6%
if 4.99999999999999954e-22 < x Initial program 89.1%
Taylor expanded in z around 0 99.5%
Taylor expanded in z around inf 93.8%
unpow293.8%
associate-*l*99.5%
distribute-rgt-in98.8%
associate-*r/98.8%
metadata-eval98.8%
associate-*l/98.8%
associate-*r/98.8%
associate-*l/98.2%
associate-/l*98.9%
distribute-rgt-out99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (+ 0.0007936500793651 y))) (t_1 (- t_0 0.0027777777777778)))
(if (<= (* z t_1) 5e+297)
(-
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/ (- (* z (- 0.0027777777777778 t_0)) 0.083333333333333) x))
(+
(+ 0.91893853320467 (* (log x) -0.5))
(+ (* (/ 1.0 x) 0.083333333333333) (* z (/ t_1 x)))))))
double code(double x, double y, double z) {
double t_0 = z * (0.0007936500793651 + y);
double t_1 = t_0 - 0.0027777777777778;
double tmp;
if ((z * t_1) <= 5e+297) {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) - (((z * (0.0027777777777778 - t_0)) - 0.083333333333333) / x);
} else {
tmp = (0.91893853320467 + (log(x) * -0.5)) + (((1.0 / x) * 0.083333333333333) + (z * (t_1 / 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) :: t_1
real(8) :: tmp
t_0 = z * (0.0007936500793651d0 + y)
t_1 = t_0 - 0.0027777777777778d0
if ((z * t_1) <= 5d+297) then
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) - (((z * (0.0027777777777778d0 - t_0)) - 0.083333333333333d0) / x)
else
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) + (((1.0d0 / x) * 0.083333333333333d0) + (z * (t_1 / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (0.0007936500793651 + y);
double t_1 = t_0 - 0.0027777777777778;
double tmp;
if ((z * t_1) <= 5e+297) {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) - (((z * (0.0027777777777778 - t_0)) - 0.083333333333333) / x);
} else {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) + (((1.0 / x) * 0.083333333333333) + (z * (t_1 / x)));
}
return tmp;
}
def code(x, y, z): t_0 = z * (0.0007936500793651 + y) t_1 = t_0 - 0.0027777777777778 tmp = 0 if (z * t_1) <= 5e+297: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) - (((z * (0.0027777777777778 - t_0)) - 0.083333333333333) / x) else: tmp = (0.91893853320467 + (math.log(x) * -0.5)) + (((1.0 / x) * 0.083333333333333) + (z * (t_1 / x))) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(0.0007936500793651 + y)) t_1 = Float64(t_0 - 0.0027777777777778) tmp = 0.0 if (Float64(z * t_1) <= 5e+297) tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) - Float64(Float64(Float64(z * Float64(0.0027777777777778 - t_0)) - 0.083333333333333) / x)); else tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) + Float64(Float64(Float64(1.0 / x) * 0.083333333333333) + Float64(z * Float64(t_1 / x)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (0.0007936500793651 + y); t_1 = t_0 - 0.0027777777777778; tmp = 0.0; if ((z * t_1) <= 5e+297) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) - (((z * (0.0027777777777778 - t_0)) - 0.083333333333333) / x); else tmp = (0.91893853320467 + (log(x) * -0.5)) + (((1.0 / x) * 0.083333333333333) + (z * (t_1 / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - 0.0027777777777778), $MachinePrecision]}, If[LessEqual[N[(z * t$95$1), $MachinePrecision], 5e+297], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] - N[(N[(N[(z * N[(0.0027777777777778 - t$95$0), $MachinePrecision]), $MachinePrecision] - 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / x), $MachinePrecision] * 0.083333333333333), $MachinePrecision] + N[(z * N[(t$95$1 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(0.0007936500793651 + y\right)\\
t_1 := t\_0 - 0.0027777777777778\\
\mathbf{if}\;z \cdot t\_1 \leq 5 \cdot 10^{+297}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) - \frac{z \cdot \left(0.0027777777777778 - t\_0\right) - 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \left(\frac{1}{x} \cdot 0.083333333333333 + z \cdot \frac{t\_1}{x}\right)\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 4.9999999999999998e297Initial program 98.0%
if 4.9999999999999998e297 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 79.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in x around 0 98.3%
Taylor expanded in x around 0 88.8%
Taylor expanded in x around -inf 79.9%
mul-1-neg79.9%
associate-/l*88.8%
distribute-lft-neg-in88.8%
mul-1-neg88.8%
unsub-neg88.8%
Simplified88.8%
Final simplification95.9%
(FPCore (x y z)
:precision binary64
(-
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(+
(*
z
(- (* 0.0027777777777778 (/ 1.0 x)) (/ (* z (+ 0.0007936500793651 y)) x)))
(* 0.083333333333333 (/ -1.0 x)))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) - ((z * ((0.0027777777777778 * (1.0 / x)) - ((z * (0.0007936500793651 + y)) / x))) + (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.0027777777777778d0 * (1.0d0 / x)) - ((z * (0.0007936500793651d0 + y)) / x))) + (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.0027777777777778 * (1.0 / x)) - ((z * (0.0007936500793651 + y)) / x))) + (0.083333333333333 * (-1.0 / x)));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) - ((z * ((0.0027777777777778 * (1.0 / x)) - ((z * (0.0007936500793651 + y)) / x))) + (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.0027777777777778 * Float64(1.0 / x)) - Float64(Float64(z * Float64(0.0007936500793651 + y)) / x))) + 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.0027777777777778 * (1.0 / x)) - ((z * (0.0007936500793651 + y)) / x))) + (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.0027777777777778 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] - N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] / x), $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 \left(0.0027777777777778 \cdot \frac{1}{x} - \frac{z \cdot \left(0.0007936500793651 + y\right)}{x}\right) + 0.083333333333333 \cdot \frac{-1}{x}\right)
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 95.8%
Taylor expanded in x around 0 98.1%
Final simplification98.1%
(FPCore (x y z)
:precision binary64
(if (<= x 2500000.0)
(-
(+ 0.91893853320467 (* (log x) -0.5))
(/
(-
(* z (- 0.0027777777777778 (* z (+ 0.0007936500793651 y))))
0.083333333333333)
x))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/ 0.083333333333333 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2500000.0) {
tmp = (0.91893853320467 + (log(x) * -0.5)) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (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) :: tmp
if (x <= 2500000.0d0) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) - (((z * (0.0027777777777778d0 - (z * (0.0007936500793651d0 + y)))) - 0.083333333333333d0) / x)
else
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + (0.083333333333333d0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2500000.0) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x);
} else {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2500000.0: tmp = (0.91893853320467 + (math.log(x) * -0.5)) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x) else: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2500000.0) tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) - Float64(Float64(Float64(z * Float64(0.0027777777777778 - Float64(z * Float64(0.0007936500793651 + y)))) - 0.083333333333333) / x)); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(0.083333333333333 / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2500000.0) tmp = (0.91893853320467 + (log(x) * -0.5)) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x); else tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2500000.0], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(z * N[(0.0027777777777778 - N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2500000:\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) - \frac{z \cdot \left(0.0027777777777778 - z \cdot \left(0.0007936500793651 + y\right)\right) - 0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}\\
\end{array}
\end{array}
if x < 2.5e6Initial program 99.6%
Taylor expanded in x around 0 99.6%
if 2.5e6 < x Initial program 88.4%
Taylor expanded in z around 0 74.8%
Final simplification86.9%
(FPCore (x y z)
:precision binary64
(-
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/
(-
(* z (- 0.0027777777777778 (* z (+ 0.0007936500793651 y))))
0.083333333333333)
x)))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 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) - (((z * (0.0027777777777778d0 - (z * (0.0007936500793651d0 + y)))) - 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) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 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(z * Float64(0.0027777777777778 - Float64(z * Float64(0.0007936500793651 + y)))) - 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 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[(z * N[(0.0027777777777778 - N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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{z \cdot \left(0.0027777777777778 - z \cdot \left(0.0007936500793651 + y\right)\right) - 0.083333333333333}{x}
\end{array}
Initial program 93.9%
Final simplification93.9%
(FPCore (x y z)
:precision binary64
(if (<= x 1.22e-17)
(+
(+ 0.91893853320467 (* (log x) -0.5))
(+ (* (/ 1.0 x) 0.083333333333333) (* (/ z x) -0.0027777777777778)))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(/ 0.083333333333333 x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.22e-17) {
tmp = (0.91893853320467 + (log(x) * -0.5)) + (((1.0 / x) * 0.083333333333333) + ((z / x) * -0.0027777777777778));
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (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) :: tmp
if (x <= 1.22d-17) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) + (((1.0d0 / x) * 0.083333333333333d0) + ((z / x) * (-0.0027777777777778d0)))
else
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + (0.083333333333333d0 / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.22e-17) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) + (((1.0 / x) * 0.083333333333333) + ((z / x) * -0.0027777777777778));
} else {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.22e-17: tmp = (0.91893853320467 + (math.log(x) * -0.5)) + (((1.0 / x) * 0.083333333333333) + ((z / x) * -0.0027777777777778)) else: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.22e-17) tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) + Float64(Float64(Float64(1.0 / x) * 0.083333333333333) + Float64(Float64(z / x) * -0.0027777777777778))); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(0.083333333333333 / x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.22e-17) tmp = (0.91893853320467 + (log(x) * -0.5)) + (((1.0 / x) * 0.083333333333333) + ((z / x) * -0.0027777777777778)); else tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (0.083333333333333 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.22e-17], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(1.0 / x), $MachinePrecision] * 0.083333333333333), $MachinePrecision] + N[(N[(z / x), $MachinePrecision] * -0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.22 \cdot 10^{-17}:\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \left(\frac{1}{x} \cdot 0.083333333333333 + \frac{z}{x} \cdot -0.0027777777777778\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{0.083333333333333}{x}\\
\end{array}
\end{array}
if x < 1.22e-17Initial program 99.6%
Taylor expanded in z around 0 91.4%
Taylor expanded in x around 0 97.3%
Taylor expanded in x around 0 97.3%
Taylor expanded in z around 0 58.1%
*-commutative58.1%
Simplified58.1%
if 1.22e-17 < x Initial program 89.0%
Taylor expanded in z around 0 72.1%
Final simplification65.7%
(FPCore (x y z)
:precision binary64
(-
(+ 0.91893853320467 (* x (+ (log x) -1.0)))
(/
(-
(* z (- 0.0027777777777778 (* z (+ 0.0007936500793651 y))))
0.083333333333333)
x)))
double code(double x, double y, double z) {
return (0.91893853320467 + (x * (log(x) + -1.0))) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 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.91893853320467d0 + (x * (log(x) + (-1.0d0)))) - (((z * (0.0027777777777778d0 - (z * (0.0007936500793651d0 + y)))) - 0.083333333333333d0) / x)
end function
public static double code(double x, double y, double z) {
return (0.91893853320467 + (x * (Math.log(x) + -1.0))) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x);
}
def code(x, y, z): return (0.91893853320467 + (x * (math.log(x) + -1.0))) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x)
function code(x, y, z) return Float64(Float64(0.91893853320467 + Float64(x * Float64(log(x) + -1.0))) - Float64(Float64(Float64(z * Float64(0.0027777777777778 - Float64(z * Float64(0.0007936500793651 + y)))) - 0.083333333333333) / x)) end
function tmp = code(x, y, z) tmp = (0.91893853320467 + (x * (log(x) + -1.0))) - (((z * (0.0027777777777778 - (z * (0.0007936500793651 + y)))) - 0.083333333333333) / x); end
code[x_, y_, z_] := N[(N[(0.91893853320467 + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(z * N[(0.0027777777777778 - N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) - \frac{z \cdot \left(0.0027777777777778 - z \cdot \left(0.0007936500793651 + y\right)\right) - 0.083333333333333}{x}
\end{array}
Initial program 93.9%
Taylor expanded in x around inf 93.3%
sub-neg60.0%
mul-1-neg60.0%
log-rec59.6%
remove-double-neg59.6%
metadata-eval59.6%
+-commutative59.6%
Simplified93.3%
Final simplification93.3%
(FPCore (x y z) :precision binary64 (if (<= x 0.33) (+ (* (/ 1.0 x) 0.083333333333333) (+ 0.91893853320467 (* (log x) -0.5))) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.33) {
tmp = ((1.0 / x) * 0.083333333333333) + (0.91893853320467 + (log(x) * -0.5));
} else {
tmp = 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 <= 0.33d0) then
tmp = ((1.0d0 / x) * 0.083333333333333d0) + (0.91893853320467d0 + (log(x) * (-0.5d0)))
else
tmp = 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 <= 0.33) {
tmp = ((1.0 / x) * 0.083333333333333) + (0.91893853320467 + (Math.log(x) * -0.5));
} else {
tmp = x * (Math.log(x) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 0.33: tmp = ((1.0 / x) * 0.083333333333333) + (0.91893853320467 + (math.log(x) * -0.5)) else: tmp = x * (math.log(x) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 0.33) tmp = Float64(Float64(Float64(1.0 / x) * 0.083333333333333) + Float64(0.91893853320467 + Float64(log(x) * -0.5))); else tmp = Float64(x * Float64(log(x) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 0.33) tmp = ((1.0 / x) * 0.083333333333333) + (0.91893853320467 + (log(x) * -0.5)); else tmp = x * (log(x) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 0.33], N[(N[(N[(1.0 / x), $MachinePrecision] * 0.083333333333333), $MachinePrecision] + N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.33:\\
\;\;\;\;\frac{1}{x} \cdot 0.083333333333333 + \left(0.91893853320467 + \log x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 0.330000000000000016Initial program 99.6%
Taylor expanded in z around 0 45.7%
Taylor expanded in x around 0 45.7%
div-inv45.3%
*-commutative45.3%
Applied egg-rr45.7%
if 0.330000000000000016 < x Initial program 88.6%
sub-neg88.6%
associate-+l+88.6%
fma-define88.8%
sub-neg88.8%
metadata-eval88.8%
+-commutative88.8%
unsub-neg88.8%
*-commutative88.8%
fma-define88.8%
fma-neg88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in z around 0 73.4%
Taylor expanded in x around inf 72.6%
sub-neg72.6%
mul-1-neg72.6%
log-rec72.6%
remove-double-neg72.6%
metadata-eval72.6%
Simplified72.6%
Final simplification59.8%
(FPCore (x y z) :precision binary64 (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (* (/ 1.0 x) 0.083333333333333)))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((1.0 / x) * 0.083333333333333);
}
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) + ((1.0d0 / x) * 0.083333333333333d0)
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((1.0 / x) * 0.083333333333333);
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((1.0 / x) * 0.083333333333333)
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(1.0 / x) * 0.083333333333333)) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((1.0 / x) * 0.083333333333333); 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[(1.0 / x), $MachinePrecision] * 0.083333333333333), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{1}{x} \cdot 0.083333333333333
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 60.1%
div-inv23.3%
*-commutative23.3%
Applied egg-rr60.1%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ 1.0 (* x 12.000000000000048))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (1.0 / (x * 12.000000000000048));
}
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) + (1.0d0 / (x * 12.000000000000048d0))
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + (1.0 / (x * 12.000000000000048));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (1.0 / (x * 12.000000000000048))
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(1.0 / Float64(x * 12.000000000000048))) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (1.0 / (x * 12.000000000000048)); 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[(1.0 / N[(x * 12.000000000000048), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \frac{1}{x \cdot 12.000000000000048}
\end{array}
Initial program 93.9%
add-cbrt-cube71.3%
pow371.3%
*-commutative71.3%
fma-undefine71.3%
fma-neg71.3%
metadata-eval71.3%
Applied egg-rr71.3%
Taylor expanded in z around 0 56.9%
metadata-eval56.9%
cube-div56.9%
Simplified56.9%
rem-cbrt-cube60.1%
clear-num60.1%
div-inv60.2%
metadata-eval60.2%
Applied egg-rr60.2%
Final simplification60.2%
(FPCore (x y z) :precision binary64 (if (<= x 0.33) (+ 0.91893853320467 (+ (* (log x) -0.5) (/ 0.083333333333333 x))) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.33) {
tmp = 0.91893853320467 + ((log(x) * -0.5) + (0.083333333333333 / x));
} else {
tmp = 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 <= 0.33d0) then
tmp = 0.91893853320467d0 + ((log(x) * (-0.5d0)) + (0.083333333333333d0 / x))
else
tmp = 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 <= 0.33) {
tmp = 0.91893853320467 + ((Math.log(x) * -0.5) + (0.083333333333333 / x));
} else {
tmp = x * (Math.log(x) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 0.33: tmp = 0.91893853320467 + ((math.log(x) * -0.5) + (0.083333333333333 / x)) else: tmp = x * (math.log(x) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 0.33) tmp = Float64(0.91893853320467 + Float64(Float64(log(x) * -0.5) + Float64(0.083333333333333 / x))); else tmp = Float64(x * Float64(log(x) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 0.33) tmp = 0.91893853320467 + ((log(x) * -0.5) + (0.083333333333333 / x)); else tmp = x * (log(x) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 0.33], N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.33:\\
\;\;\;\;0.91893853320467 + \left(\log x \cdot -0.5 + \frac{0.083333333333333}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 0.330000000000000016Initial program 99.6%
Taylor expanded in z around 0 45.7%
Taylor expanded in x around 0 45.7%
Taylor expanded in x around inf 45.7%
*-commutative45.7%
div-inv45.7%
fma-define45.7%
log-rec45.7%
Applied egg-rr45.7%
fma-undefine45.7%
*-commutative45.7%
+-commutative45.7%
neg-mul-145.7%
associate-*r*45.7%
metadata-eval45.7%
*-commutative45.7%
Simplified45.7%
if 0.330000000000000016 < x Initial program 88.6%
sub-neg88.6%
associate-+l+88.6%
fma-define88.8%
sub-neg88.8%
metadata-eval88.8%
+-commutative88.8%
unsub-neg88.8%
*-commutative88.8%
fma-define88.8%
fma-neg88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in z around 0 73.4%
Taylor expanded in x around inf 72.6%
sub-neg72.6%
mul-1-neg72.6%
log-rec72.6%
remove-double-neg72.6%
metadata-eval72.6%
Simplified72.6%
Final simplification59.8%
(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 60.1%
Final simplification60.1%
(FPCore (x y z) :precision binary64 (+ (+ 0.91893853320467 (* x (+ (log x) -1.0))) (/ 0.083333333333333 x)))
double code(double x, double y, double z) {
return (0.91893853320467 + (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 = (0.91893853320467d0 + (x * (log(x) + (-1.0d0)))) + (0.083333333333333d0 / x)
end function
public static double code(double x, double y, double z) {
return (0.91893853320467 + (x * (Math.log(x) + -1.0))) + (0.083333333333333 / x);
}
def code(x, y, z): return (0.91893853320467 + (x * (math.log(x) + -1.0))) + (0.083333333333333 / x)
function code(x, y, z) return Float64(Float64(0.91893853320467 + Float64(x * Float64(log(x) + -1.0))) + Float64(0.083333333333333 / x)) end
function tmp = code(x, y, z) tmp = (0.91893853320467 + (x * (log(x) + -1.0))) + (0.083333333333333 / x); end
code[x_, y_, z_] := N[(N[(0.91893853320467 + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right) + \frac{0.083333333333333}{x}
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 60.1%
Taylor expanded in x around inf 60.0%
sub-neg60.0%
mul-1-neg60.0%
log-rec59.6%
remove-double-neg59.6%
metadata-eval59.6%
+-commutative59.6%
Simplified59.6%
Final simplification59.6%
(FPCore (x y z) :precision binary64 (if (<= x 0.33) (* (/ 1.0 x) 0.083333333333333) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.33) {
tmp = (1.0 / x) * 0.083333333333333;
} else {
tmp = 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 <= 0.33d0) then
tmp = (1.0d0 / x) * 0.083333333333333d0
else
tmp = 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 <= 0.33) {
tmp = (1.0 / x) * 0.083333333333333;
} else {
tmp = x * (Math.log(x) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 0.33: tmp = (1.0 / x) * 0.083333333333333 else: tmp = x * (math.log(x) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 0.33) tmp = Float64(Float64(1.0 / x) * 0.083333333333333); else tmp = Float64(x * Float64(log(x) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 0.33) tmp = (1.0 / x) * 0.083333333333333; else tmp = x * (log(x) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 0.33], N[(N[(1.0 / x), $MachinePrecision] * 0.083333333333333), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.33:\\
\;\;\;\;\frac{1}{x} \cdot 0.083333333333333\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 0.330000000000000016Initial program 99.6%
Taylor expanded in z around 0 45.7%
Taylor expanded in x around 0 45.7%
Taylor expanded in x around 0 45.3%
div-inv45.3%
*-commutative45.3%
Applied egg-rr45.3%
if 0.330000000000000016 < x Initial program 88.6%
sub-neg88.6%
associate-+l+88.6%
fma-define88.8%
sub-neg88.8%
metadata-eval88.8%
+-commutative88.8%
unsub-neg88.8%
*-commutative88.8%
fma-define88.8%
fma-neg88.8%
metadata-eval88.8%
Simplified88.8%
Taylor expanded in z around 0 73.4%
Taylor expanded in x around inf 72.6%
sub-neg72.6%
mul-1-neg72.6%
log-rec72.6%
remove-double-neg72.6%
metadata-eval72.6%
Simplified72.6%
Final simplification59.6%
(FPCore (x y z) :precision binary64 (* (/ 1.0 x) 0.083333333333333))
double code(double x, double y, double z) {
return (1.0 / x) * 0.083333333333333;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (1.0d0 / x) * 0.083333333333333d0
end function
public static double code(double x, double y, double z) {
return (1.0 / x) * 0.083333333333333;
}
def code(x, y, z): return (1.0 / x) * 0.083333333333333
function code(x, y, z) return Float64(Float64(1.0 / x) * 0.083333333333333) end
function tmp = code(x, y, z) tmp = (1.0 / x) * 0.083333333333333; end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] * 0.083333333333333), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x} \cdot 0.083333333333333
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 60.1%
Taylor expanded in x around 0 22.3%
Taylor expanded in x around 0 23.2%
div-inv23.3%
*-commutative23.3%
Applied egg-rr23.3%
Final simplification23.3%
(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 60.1%
Taylor expanded in x around 0 22.3%
Taylor expanded in x around 0 23.2%
Final simplification23.2%
(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 2024059
(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)))