
(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 11 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 4.9e-88)
(+
(+ 0.91893853320467 (* (log x) -0.5))
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(+
(/ 0.083333333333333 x)
(*
z
(-
(* z (+ (/ 0.0007936500793651 x) (/ y x)))
(/ 0.0027777777777778 x)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.9e-88) {
tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((0.083333333333333 / x) + (z * ((z * ((0.0007936500793651 / x) + (y / x))) - (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) :: tmp
if (x <= 4.9d-88) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) + ((0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x)
else
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((0.083333333333333d0 / x) + (z * ((z * ((0.0007936500793651d0 / x) + (y / x))) - (0.0027777777777778d0 / x))))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 4.9e-88) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
} else {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((0.083333333333333 / x) + (z * ((z * ((0.0007936500793651 / x) + (y / x))) - (0.0027777777777778 / x))));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 4.9e-88: tmp = (0.91893853320467 + (math.log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) else: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((0.083333333333333 / x) + (z * ((z * ((0.0007936500793651 / x) + (y / x))) - (0.0027777777777778 / x)))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 4.9e-88) tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x)); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(0.083333333333333 / x) + Float64(z * Float64(Float64(z * Float64(Float64(0.0007936500793651 / x) + Float64(y / x))) - Float64(0.0027777777777778 / x))))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 4.9e-88) tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x); else tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((0.083333333333333 / x) + (z * ((z * ((0.0007936500793651 / x) + (y / x))) - (0.0027777777777778 / x)))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 4.9e-88], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $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[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(z * N[(N[(z * N[(N[(0.0007936500793651 / x), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.0027777777777778 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.9 \cdot 10^{-88}:\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\frac{0.083333333333333}{x} + z \cdot \left(z \cdot \left(\frac{0.0007936500793651}{x} + \frac{y}{x}\right) - \frac{0.0027777777777778}{x}\right)\right)\\
\end{array}
\end{array}
if x < 4.90000000000000028e-88Initial program 99.7%
Taylor expanded in x around 0 99.7%
if 4.90000000000000028e-88 < x Initial program 90.3%
Taylor expanded in z around 0 99.6%
fma-define99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
fma-undefine99.6%
Applied egg-rr99.6%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (+ (* (fma z (+ 0.0007936500793651 y) -0.0027777777777778) (/ z x)) (/ 0.083333333333333 x))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((fma(z, (0.0007936500793651 + y), -0.0027777777777778) * (z / x)) + (0.083333333333333 / x));
}
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(fma(z, Float64(0.0007936500793651 + y), -0.0027777777777778) * Float64(z / x)) + Float64(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.0007936500793651 + y), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(\mathsf{fma}\left(z, 0.0007936500793651 + y, -0.0027777777777778\right) \cdot \frac{z}{x} + \frac{0.083333333333333}{x}\right)
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 94.4%
fma-define94.4%
associate-*r/94.4%
metadata-eval94.4%
associate-*r/94.4%
metadata-eval94.4%
associate-*r/94.4%
metadata-eval94.4%
Simplified94.4%
fma-undefine94.4%
Applied egg-rr94.4%
Taylor expanded in x around 0 93.9%
fma-neg93.9%
metadata-eval93.9%
*-commutative93.9%
associate-/l*98.2%
Simplified98.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
(t_1 (+ 0.91893853320467 (* (log x) -0.5))))
(if (<= t_0 -0.05)
(+ t_1 (/ (+ 0.083333333333333 (* z (- (* z y) 0.0027777777777778))) x))
(if (<= t_0 1e+132)
(+
(/ 0.083333333333333 x)
(- (* (log x) (+ x -0.5)) (+ x -0.91893853320467)))
(+ t_1 (/ (+ 0.083333333333333 t_0) x))))))
double code(double x, double y, double z) {
double t_0 = z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778);
double t_1 = 0.91893853320467 + (log(x) * -0.5);
double tmp;
if (t_0 <= -0.05) {
tmp = t_1 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x);
} else if (t_0 <= 1e+132) {
tmp = (0.083333333333333 / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467));
} else {
tmp = t_1 + ((0.083333333333333 + t_0) / 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 * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0)
t_1 = 0.91893853320467d0 + (log(x) * (-0.5d0))
if (t_0 <= (-0.05d0)) then
tmp = t_1 + ((0.083333333333333d0 + (z * ((z * y) - 0.0027777777777778d0))) / x)
else if (t_0 <= 1d+132) then
tmp = (0.083333333333333d0 / x) + ((log(x) * (x + (-0.5d0))) - (x + (-0.91893853320467d0)))
else
tmp = t_1 + ((0.083333333333333d0 + t_0) / x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778);
double t_1 = 0.91893853320467 + (Math.log(x) * -0.5);
double tmp;
if (t_0 <= -0.05) {
tmp = t_1 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x);
} else if (t_0 <= 1e+132) {
tmp = (0.083333333333333 / x) + ((Math.log(x) * (x + -0.5)) - (x + -0.91893853320467));
} else {
tmp = t_1 + ((0.083333333333333 + t_0) / x);
}
return tmp;
}
def code(x, y, z): t_0 = z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778) t_1 = 0.91893853320467 + (math.log(x) * -0.5) tmp = 0 if t_0 <= -0.05: tmp = t_1 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x) elif t_0 <= 1e+132: tmp = (0.083333333333333 / x) + ((math.log(x) * (x + -0.5)) - (x + -0.91893853320467)) else: tmp = t_1 + ((0.083333333333333 + t_0) / x) return tmp
function code(x, y, z) t_0 = Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778)) t_1 = Float64(0.91893853320467 + Float64(log(x) * -0.5)) tmp = 0.0 if (t_0 <= -0.05) tmp = Float64(t_1 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * y) - 0.0027777777777778))) / x)); elseif (t_0 <= 1e+132) tmp = Float64(Float64(0.083333333333333 / x) + Float64(Float64(log(x) * Float64(x + -0.5)) - Float64(x + -0.91893853320467))); else tmp = Float64(t_1 + Float64(Float64(0.083333333333333 + t_0) / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778); t_1 = 0.91893853320467 + (log(x) * -0.5); tmp = 0.0; if (t_0 <= -0.05) tmp = t_1 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x); elseif (t_0 <= 1e+132) tmp = (0.083333333333333 / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467)); else tmp = t_1 + ((0.083333333333333 + t_0) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.05], N[(t$95$1 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * y), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+132], N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] - N[(x + -0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(0.083333333333333 + t$95$0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)\\
t_1 := 0.91893853320467 + \log x \cdot -0.5\\
\mathbf{if}\;t\_0 \leq -0.05:\\
\;\;\;\;t\_1 + \frac{0.083333333333333 + z \cdot \left(z \cdot y - 0.0027777777777778\right)}{x}\\
\mathbf{elif}\;t\_0 \leq 10^{+132}:\\
\;\;\;\;\frac{0.083333333333333}{x} + \left(\log x \cdot \left(x + -0.5\right) - \left(x + -0.91893853320467\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \frac{0.083333333333333 + t\_0}{x}\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -0.050000000000000003Initial program 87.6%
Taylor expanded in x around 0 74.7%
Taylor expanded in y around inf 74.7%
*-commutative74.7%
Simplified74.7%
if -0.050000000000000003 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 9.99999999999999991e131Initial program 99.5%
Taylor expanded in z around 0 93.5%
associate-+l-99.5%
sub-neg99.5%
metadata-eval99.5%
sub-neg99.5%
metadata-eval99.5%
Applied egg-rr93.5%
if 9.99999999999999991e131 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 88.6%
Taylor expanded in x around 0 84.0%
Final simplification87.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 0.91893853320467 (* (log x) -0.5)))
(t_1
(+
t_0
(/
(+
0.083333333333333
(* z (- (* z 0.0007936500793651) 0.0027777777777778)))
x))))
(if (<= z -1.25e+69)
t_1
(if (<= z -5.2e-30)
(+ t_0 (/ (+ 0.083333333333333 (* z (- (* z y) 0.0027777777777778))) x))
(if (<= z 3.6e+102)
(+
(/ 0.083333333333333 x)
(- (* (log x) (+ x -0.5)) (+ x -0.91893853320467)))
t_1)))))
double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + (log(x) * -0.5);
double t_1 = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
double tmp;
if (z <= -1.25e+69) {
tmp = t_1;
} else if (z <= -5.2e-30) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x);
} else if (z <= 3.6e+102) {
tmp = (0.083333333333333 / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467));
} else {
tmp = t_1;
}
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 = 0.91893853320467d0 + (log(x) * (-0.5d0))
t_1 = t_0 + ((0.083333333333333d0 + (z * ((z * 0.0007936500793651d0) - 0.0027777777777778d0))) / x)
if (z <= (-1.25d+69)) then
tmp = t_1
else if (z <= (-5.2d-30)) then
tmp = t_0 + ((0.083333333333333d0 + (z * ((z * y) - 0.0027777777777778d0))) / x)
else if (z <= 3.6d+102) then
tmp = (0.083333333333333d0 / x) + ((log(x) * (x + (-0.5d0))) - (x + (-0.91893853320467d0)))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + (Math.log(x) * -0.5);
double t_1 = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
double tmp;
if (z <= -1.25e+69) {
tmp = t_1;
} else if (z <= -5.2e-30) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x);
} else if (z <= 3.6e+102) {
tmp = (0.083333333333333 / x) + ((Math.log(x) * (x + -0.5)) - (x + -0.91893853320467));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = 0.91893853320467 + (math.log(x) * -0.5) t_1 = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x) tmp = 0 if z <= -1.25e+69: tmp = t_1 elif z <= -5.2e-30: tmp = t_0 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x) elif z <= 3.6e+102: tmp = (0.083333333333333 / x) + ((math.log(x) * (x + -0.5)) - (x + -0.91893853320467)) else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(0.91893853320467 + Float64(log(x) * -0.5)) t_1 = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * 0.0007936500793651) - 0.0027777777777778))) / x)) tmp = 0.0 if (z <= -1.25e+69) tmp = t_1; elseif (z <= -5.2e-30) tmp = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * y) - 0.0027777777777778))) / x)); elseif (z <= 3.6e+102) tmp = Float64(Float64(0.083333333333333 / x) + Float64(Float64(log(x) * Float64(x + -0.5)) - Float64(x + -0.91893853320467))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.91893853320467 + (log(x) * -0.5); t_1 = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x); tmp = 0.0; if (z <= -1.25e+69) tmp = t_1; elseif (z <= -5.2e-30) tmp = t_0 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x); elseif (z <= 3.6e+102) tmp = (0.083333333333333 / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * 0.0007936500793651), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.25e+69], t$95$1, If[LessEqual[z, -5.2e-30], N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * y), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.6e+102], N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] - N[(x + -0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.91893853320467 + \log x \cdot -0.5\\
t_1 := t\_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right)}{x}\\
\mathbf{if}\;z \leq -1.25 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-30}:\\
\;\;\;\;t\_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot y - 0.0027777777777778\right)}{x}\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{+102}:\\
\;\;\;\;\frac{0.083333333333333}{x} + \left(\log x \cdot \left(x + -0.5\right) - \left(x + -0.91893853320467\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.25000000000000009e69 or 3.6000000000000002e102 < z Initial program 87.2%
Taylor expanded in x around 0 85.4%
Taylor expanded in y around 0 65.0%
*-commutative65.0%
Simplified65.0%
if -1.25000000000000009e69 < z < -5.19999999999999973e-30Initial program 99.4%
Taylor expanded in x around 0 68.1%
Taylor expanded in y around inf 59.7%
*-commutative59.7%
Simplified59.7%
if -5.19999999999999973e-30 < z < 3.6000000000000002e102Initial program 97.6%
Taylor expanded in z around 0 88.0%
associate-+l-97.6%
sub-neg97.6%
metadata-eval97.6%
sub-neg97.6%
metadata-eval97.6%
Applied egg-rr88.0%
Final simplification77.1%
(FPCore (x y z)
:precision binary64
(if (<= x 7.2e+14)
(+
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x)
(- (* (log x) (+ x -0.5)) (+ x -0.91893853320467)))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(* z (* (+ 0.0007936500793651 y) (/ z x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 7.2e+14) {
tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467));
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (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 <= 7.2d+14) then
tmp = ((0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x) + ((log(x) * (x + (-0.5d0))) - (x + (-0.91893853320467d0)))
else
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + (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 <= 7.2e+14) {
tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + ((Math.log(x) * (x + -0.5)) - (x + -0.91893853320467));
} else {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + (z * ((0.0007936500793651 + y) * (z / x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 7.2e+14: tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + ((math.log(x) * (x + -0.5)) - (x + -0.91893853320467)) else: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (z * ((0.0007936500793651 + y) * (z / x))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 7.2e+14) tmp = Float64(Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x) + Float64(Float64(log(x) * Float64(x + -0.5)) - Float64(x + -0.91893853320467))); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + 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 <= 7.2e+14) tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467)); else tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (z * ((0.0007936500793651 + y) * (z / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 7.2e+14], N[(N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] - N[(x + -0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} + \left(\log x \cdot \left(x + -0.5\right) - \left(x + -0.91893853320467\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + z \cdot \left(\left(0.0007936500793651 + y\right) \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if x < 7.2e14Initial program 99.7%
associate-+l-99.7%
sub-neg99.7%
metadata-eval99.7%
sub-neg99.7%
metadata-eval99.7%
Applied egg-rr99.7%
if 7.2e14 < x Initial program 87.4%
Taylor expanded in z around 0 99.6%
fma-define99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 93.3%
unpow293.3%
associate-*l*99.6%
distribute-rgt-in99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*l/99.5%
associate-*r/99.6%
associate-*l/96.5%
associate-/l*99.6%
distribute-rgt-out99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(if (or (<= z -6.8e+68) (not (<= z 9.5e+101)))
(+
(+ 0.91893853320467 (* (log x) -0.5))
(/
(+
0.083333333333333
(* z (- (* z 0.0007936500793651) 0.0027777777777778)))
x))
(+
(/ 0.083333333333333 x)
(- (* (log x) (+ x -0.5)) (+ x -0.91893853320467)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e+68) || !(z <= 9.5e+101)) {
tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
} else {
tmp = (0.083333333333333 / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467));
}
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 ((z <= (-6.8d+68)) .or. (.not. (z <= 9.5d+101))) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) + ((0.083333333333333d0 + (z * ((z * 0.0007936500793651d0) - 0.0027777777777778d0))) / x)
else
tmp = (0.083333333333333d0 / x) + ((log(x) * (x + (-0.5d0))) - (x + (-0.91893853320467d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e+68) || !(z <= 9.5e+101)) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
} else {
tmp = (0.083333333333333 / x) + ((Math.log(x) * (x + -0.5)) - (x + -0.91893853320467));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.8e+68) or not (z <= 9.5e+101): tmp = (0.91893853320467 + (math.log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x) else: tmp = (0.083333333333333 / x) + ((math.log(x) * (x + -0.5)) - (x + -0.91893853320467)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.8e+68) || !(z <= 9.5e+101)) tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * 0.0007936500793651) - 0.0027777777777778))) / x)); else tmp = Float64(Float64(0.083333333333333 / x) + Float64(Float64(log(x) * Float64(x + -0.5)) - Float64(x + -0.91893853320467))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.8e+68) || ~((z <= 9.5e+101))) tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x); else tmp = (0.083333333333333 / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.8e+68], N[Not[LessEqual[z, 9.5e+101]], $MachinePrecision]], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(0.083333333333333 + N[(z * N[(N[(z * 0.0007936500793651), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision]), $MachinePrecision] - N[(x + -0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{+68} \lor \neg \left(z \leq 9.5 \cdot 10^{+101}\right):\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.083333333333333}{x} + \left(\log x \cdot \left(x + -0.5\right) - \left(x + -0.91893853320467\right)\right)\\
\end{array}
\end{array}
if z < -6.8000000000000003e68 or 9.49999999999999947e101 < z Initial program 87.2%
Taylor expanded in x around 0 85.4%
Taylor expanded in y around 0 65.0%
*-commutative65.0%
Simplified65.0%
if -6.8000000000000003e68 < z < 9.49999999999999947e101Initial program 97.8%
Taylor expanded in z around 0 81.0%
associate-+l-97.8%
sub-neg97.8%
metadata-eval97.8%
sub-neg97.8%
metadata-eval97.8%
Applied egg-rr81.0%
Final simplification75.1%
(FPCore (x y z)
:precision binary64
(if (<= x 0.00255)
(+
(+ 0.91893853320467 (* (log x) -0.5))
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x))
(+
(+ (- (* (- x 0.5) (log x)) x) 0.91893853320467)
(* z (* (+ 0.0007936500793651 y) (/ z x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.00255) {
tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
} else {
tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (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 <= 0.00255d0) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) + ((0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x)
else
tmp = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + (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 <= 0.00255) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
} else {
tmp = ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + (z * ((0.0007936500793651 + y) * (z / x)));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 0.00255: tmp = (0.91893853320467 + (math.log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) else: tmp = ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + (z * ((0.0007936500793651 + y) * (z / x))) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 0.00255) tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x)); else tmp = Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + 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 <= 0.00255) tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x); else tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + (z * ((0.0007936500793651 + y) * (z / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 0.00255], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $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[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00255:\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + z \cdot \left(\left(0.0007936500793651 + y\right) \cdot \frac{z}{x}\right)\\
\end{array}
\end{array}
if x < 0.0025500000000000002Initial program 99.7%
Taylor expanded in x around 0 99.7%
if 0.0025500000000000002 < x Initial program 88.2%
Taylor expanded in z around 0 99.6%
fma-define99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*r/99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 93.7%
unpow293.7%
associate-*l*99.6%
distribute-rgt-in99.6%
associate-*r/99.6%
metadata-eval99.6%
associate-*l/99.5%
associate-*r/99.6%
associate-*l/96.7%
associate-/l*99.6%
distribute-rgt-out99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(if (<= x 1.0)
(+
(+ 0.91893853320467 (* (log x) -0.5))
(/ (+ 0.083333333333333 (* z -0.0027777777777778)) x))
(* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.0) {
tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * -0.0027777777777778)) / 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 <= 1.0d0) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) + ((0.083333333333333d0 + (z * (-0.0027777777777778d0))) / 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 <= 1.0) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) + ((0.083333333333333 + (z * -0.0027777777777778)) / x);
} else {
tmp = x * (Math.log(x) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.0: tmp = (0.91893853320467 + (math.log(x) * -0.5)) + ((0.083333333333333 + (z * -0.0027777777777778)) / x) else: tmp = x * (math.log(x) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) + Float64(Float64(0.083333333333333 + Float64(z * -0.0027777777777778)) / 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 <= 1.0) tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * -0.0027777777777778)) / x); else tmp = x * (log(x) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.0], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + N[(N[(0.083333333333333 + N[(z * -0.0027777777777778), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \frac{0.083333333333333 + z \cdot -0.0027777777777778}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 1Initial program 99.7%
Taylor expanded in x around 0 99.7%
Taylor expanded in z around 0 60.0%
if 1 < x Initial program 87.8%
sub-neg87.8%
associate-+l+87.8%
fma-define87.9%
sub-neg87.9%
metadata-eval87.9%
+-commutative87.9%
unsub-neg87.9%
*-commutative87.9%
fma-define87.9%
fma-neg87.9%
metadata-eval87.9%
Simplified87.9%
Taylor expanded in z around 0 61.7%
Taylor expanded in x around inf 61.7%
sub-neg61.7%
mul-1-neg61.7%
log-rec61.7%
remove-double-neg61.7%
metadata-eval61.7%
+-commutative61.7%
Simplified61.7%
Final simplification60.8%
(FPCore (x y z) :precision binary64 (if (<= x 1.0) (+ (/ 0.083333333333333 x) (+ 0.91893853320467 (* (log x) -0.5))) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.0) {
tmp = (0.083333333333333 / x) + (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 <= 1.0d0) then
tmp = (0.083333333333333d0 / x) + (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 <= 1.0) {
tmp = (0.083333333333333 / x) + (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 <= 1.0: tmp = (0.083333333333333 / x) + (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 <= 1.0) tmp = Float64(Float64(0.083333333333333 / x) + 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 <= 1.0) tmp = (0.083333333333333 / x) + (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, 1.0], N[(N[(0.083333333333333 / x), $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 1:\\
\;\;\;\;\frac{0.083333333333333}{x} + \left(0.91893853320467 + \log x \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 1Initial program 99.7%
Taylor expanded in z around 0 48.8%
Taylor expanded in x around 0 48.8%
if 1 < x Initial program 87.8%
sub-neg87.8%
associate-+l+87.8%
fma-define87.9%
sub-neg87.9%
metadata-eval87.9%
+-commutative87.9%
unsub-neg87.9%
*-commutative87.9%
fma-define87.9%
fma-neg87.9%
metadata-eval87.9%
Simplified87.9%
Taylor expanded in z around 0 61.7%
Taylor expanded in x around inf 61.7%
sub-neg61.7%
mul-1-neg61.7%
log-rec61.7%
remove-double-neg61.7%
metadata-eval61.7%
+-commutative61.7%
Simplified61.7%
Final simplification55.0%
(FPCore (x y z) :precision binary64 (+ (/ 0.083333333333333 x) (+ 0.91893853320467 (- (* x (log x)) x))))
double code(double x, double y, double z) {
return (0.083333333333333 / x) + (0.91893853320467 + ((x * log(x)) - 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) + (0.91893853320467d0 + ((x * log(x)) - x))
end function
public static double code(double x, double y, double z) {
return (0.083333333333333 / x) + (0.91893853320467 + ((x * Math.log(x)) - x));
}
def code(x, y, z): return (0.083333333333333 / x) + (0.91893853320467 + ((x * math.log(x)) - x))
function code(x, y, z) return Float64(Float64(0.083333333333333 / x) + Float64(0.91893853320467 + Float64(Float64(x * log(x)) - x))) end
function tmp = code(x, y, z) tmp = (0.083333333333333 / x) + (0.91893853320467 + ((x * log(x)) - x)); end
code[x_, y_, z_] := N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(0.91893853320467 + N[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.083333333333333}{x} + \left(0.91893853320467 + \left(x \cdot \log x - x\right)\right)
\end{array}
Initial program 93.9%
Taylor expanded in z around 0 55.0%
Taylor expanded in x around inf 54.9%
mul-1-neg54.9%
distribute-rgt-neg-in54.9%
log-rec54.9%
remove-double-neg54.9%
Simplified54.9%
Final simplification54.9%
(FPCore (x y z) :precision binary64 (* x (+ (log x) -1.0)))
double code(double x, double y, double z) {
return 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 = x * (log(x) + (-1.0d0))
end function
public static double code(double x, double y, double z) {
return x * (Math.log(x) + -1.0);
}
def code(x, y, z): return x * (math.log(x) + -1.0)
function code(x, y, z) return Float64(x * Float64(log(x) + -1.0)) end
function tmp = code(x, y, z) tmp = x * (log(x) + -1.0); end
code[x_, y_, z_] := N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\log x + -1\right)
\end{array}
Initial program 93.9%
sub-neg93.9%
associate-+l+93.9%
fma-define94.0%
sub-neg94.0%
metadata-eval94.0%
+-commutative94.0%
unsub-neg94.0%
*-commutative94.0%
fma-define94.0%
fma-neg94.0%
metadata-eval94.0%
Simplified94.0%
Taylor expanded in z around 0 55.1%
Taylor expanded in x around inf 30.7%
sub-neg30.7%
mul-1-neg30.7%
log-rec30.7%
remove-double-neg30.7%
metadata-eval30.7%
+-commutative30.7%
Simplified30.7%
Final simplification30.7%
(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 2024101
(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)))