
(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 13 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.1e+71)
(+
(fma (+ x -0.5) (log x) (- 0.91893853320467 x))
(/
(fma
z
(fma (+ y 0.0007936500793651) z -0.0027777777777778)
0.083333333333333)
x))
(+
(+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))
(/ z (/ (/ x (+ y 0.0007936500793651)) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.1e+71) {
tmp = fma((x + -0.5), log(x), (0.91893853320467 - x)) + (fma(z, fma((y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x);
} else {
tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + (z / ((x / (y + 0.0007936500793651)) / z));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 4.1e+71) tmp = Float64(fma(Float64(x + -0.5), log(x), Float64(0.91893853320467 - x)) + Float64(fma(z, fma(Float64(y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x)); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(z / Float64(Float64(x / Float64(y + 0.0007936500793651)) / z))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 4.1e+71], N[(N[(N[(x + -0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision] + N[(N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(z / N[(N[(x / N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.1 \cdot 10^{+71}:\\
\;\;\;\;\mathsf{fma}\left(x + -0.5, \log x, 0.91893853320467 - x\right) + \frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{z}{\frac{\frac{x}{y + 0.0007936500793651}}{z}}\\
\end{array}
\end{array}
if x < 4.1000000000000002e71Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
fma-def99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unsub-neg99.8%
*-commutative99.8%
fma-def99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
if 4.1000000000000002e71 < x Initial program 87.5%
Taylor expanded in z around inf 87.5%
associate-/l*93.1%
Simplified93.1%
unpow293.1%
div-inv93.1%
times-frac96.8%
+-commutative96.8%
Applied egg-rr96.8%
frac-times93.1%
associate-/l*99.6%
un-div-inv99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(if (<= x 100000000000.0)
(+
(- (fma (log x) (+ x -0.5) 0.91893853320467) x)
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x))
(+
(+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))
(/ z (/ (/ x (+ y 0.0007936500793651)) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 100000000000.0) {
tmp = (fma(log(x), (x + -0.5), 0.91893853320467) - x) + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
} else {
tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + (z / ((x / (y + 0.0007936500793651)) / z));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 100000000000.0) tmp = Float64(Float64(fma(log(x), Float64(x + -0.5), 0.91893853320467) - x) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x)); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(z / Float64(Float64(x / Float64(y + 0.0007936500793651)) / z))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 100000000000.0], N[(N[(N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision] + 0.91893853320467), $MachinePrecision] - x), $MachinePrecision] + N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(z / N[(N[(x / N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 100000000000:\\
\;\;\;\;\left(\mathsf{fma}\left(\log x, x + -0.5, 0.91893853320467\right) - x\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{z}{\frac{\frac{x}{y + 0.0007936500793651}}{z}}\\
\end{array}
\end{array}
if x < 1e11Initial program 99.8%
Taylor expanded in x around 0 99.8%
sub-neg99.8%
metadata-eval99.8%
distribute-rgt-in99.8%
*-commutative99.8%
neg-mul-199.8%
associate-+l+99.8%
distribute-rgt-out99.8%
+-commutative99.8%
*-commutative99.8%
associate-+l+99.8%
sub-neg99.8%
+-commutative99.8%
*-commutative99.8%
fma-def99.8%
Simplified99.8%
if 1e11 < x Initial program 90.5%
Taylor expanded in z around inf 90.5%
associate-/l*94.7%
Simplified94.7%
unpow294.7%
div-inv94.7%
times-frac97.5%
+-commutative97.5%
Applied egg-rr97.5%
frac-times94.7%
associate-/l*99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 0.91893853320467 (- (* (log x) (- x 0.5)) x)))
(t_1 (+ t_0 (* (/ z x) (* z y)))))
(if (<= z -1.95e-11)
t_1
(if (<= z 2.9e-23)
(+ t_0 (/ 0.083333333333333 x))
(if (or (<= z 2.1e+234) (not (<= z 2.6e+289)))
t_1
(+ t_0 (* (/ z x) (* z 0.0007936500793651))))))))
double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x);
double t_1 = t_0 + ((z / x) * (z * y));
double tmp;
if (z <= -1.95e-11) {
tmp = t_1;
} else if (z <= 2.9e-23) {
tmp = t_0 + (0.083333333333333 / x);
} else if ((z <= 2.1e+234) || !(z <= 2.6e+289)) {
tmp = t_1;
} else {
tmp = t_0 + ((z / x) * (z * 0.0007936500793651));
}
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) * (x - 0.5d0)) - x)
t_1 = t_0 + ((z / x) * (z * y))
if (z <= (-1.95d-11)) then
tmp = t_1
else if (z <= 2.9d-23) then
tmp = t_0 + (0.083333333333333d0 / x)
else if ((z <= 2.1d+234) .or. (.not. (z <= 2.6d+289))) then
tmp = t_1
else
tmp = t_0 + ((z / x) * (z * 0.0007936500793651d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x);
double t_1 = t_0 + ((z / x) * (z * y));
double tmp;
if (z <= -1.95e-11) {
tmp = t_1;
} else if (z <= 2.9e-23) {
tmp = t_0 + (0.083333333333333 / x);
} else if ((z <= 2.1e+234) || !(z <= 2.6e+289)) {
tmp = t_1;
} else {
tmp = t_0 + ((z / x) * (z * 0.0007936500793651));
}
return tmp;
}
def code(x, y, z): t_0 = 0.91893853320467 + ((math.log(x) * (x - 0.5)) - x) t_1 = t_0 + ((z / x) * (z * y)) tmp = 0 if z <= -1.95e-11: tmp = t_1 elif z <= 2.9e-23: tmp = t_0 + (0.083333333333333 / x) elif (z <= 2.1e+234) or not (z <= 2.6e+289): tmp = t_1 else: tmp = t_0 + ((z / x) * (z * 0.0007936500793651)) return tmp
function code(x, y, z) t_0 = Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) t_1 = Float64(t_0 + Float64(Float64(z / x) * Float64(z * y))) tmp = 0.0 if (z <= -1.95e-11) tmp = t_1; elseif (z <= 2.9e-23) tmp = Float64(t_0 + Float64(0.083333333333333 / x)); elseif ((z <= 2.1e+234) || !(z <= 2.6e+289)) tmp = t_1; else tmp = Float64(t_0 + Float64(Float64(z / x) * Float64(z * 0.0007936500793651))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x); t_1 = t_0 + ((z / x) * (z * y)); tmp = 0.0; if (z <= -1.95e-11) tmp = t_1; elseif (z <= 2.9e-23) tmp = t_0 + (0.083333333333333 / x); elseif ((z <= 2.1e+234) || ~((z <= 2.6e+289))) tmp = t_1; else tmp = t_0 + ((z / x) * (z * 0.0007936500793651)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(N[(z / x), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.95e-11], t$95$1, If[LessEqual[z, 2.9e-23], N[(t$95$0 + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 2.1e+234], N[Not[LessEqual[z, 2.6e+289]], $MachinePrecision]], t$95$1, N[(t$95$0 + N[(N[(z / x), $MachinePrecision] * N[(z * 0.0007936500793651), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\\
t_1 := t_0 + \frac{z}{x} \cdot \left(z \cdot y\right)\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{-11}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-23}:\\
\;\;\;\;t_0 + \frac{0.083333333333333}{x}\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+234} \lor \neg \left(z \leq 2.6 \cdot 10^{+289}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\\
\end{array}
\end{array}
if z < -1.95000000000000005e-11 or 2.9000000000000002e-23 < z < 2.1e234 or 2.60000000000000007e289 < z Initial program 91.5%
Taylor expanded in z around inf 89.9%
associate-/l*94.2%
Simplified94.2%
unpow294.2%
div-inv94.2%
times-frac96.0%
+-commutative96.0%
Applied egg-rr96.0%
Taylor expanded in y around inf 77.9%
*-commutative77.9%
Simplified77.9%
if -1.95000000000000005e-11 < z < 2.9000000000000002e-23Initial program 99.6%
Taylor expanded in z around 0 98.8%
if 2.1e234 < z < 2.60000000000000007e289Initial program 86.2%
Taylor expanded in z around inf 86.2%
associate-/l*86.2%
Simplified86.2%
unpow286.2%
div-inv86.2%
times-frac100.0%
+-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 92.3%
*-commutative92.3%
Simplified92.3%
Final simplification88.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))))
(if (<= x 1600000.0)
(+
t_0
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x))
(+ t_0 (/ z (/ (/ x (+ y 0.0007936500793651)) z))))))
double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x);
double tmp;
if (x <= 1600000.0) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
} else {
tmp = t_0 + (z / ((x / (y + 0.0007936500793651)) / z));
}
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 = 0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)
if (x <= 1600000.0d0) then
tmp = t_0 + ((0.083333333333333d0 + (z * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))) / x)
else
tmp = t_0 + (z / ((x / (y + 0.0007936500793651d0)) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x);
double tmp;
if (x <= 1600000.0) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
} else {
tmp = t_0 + (z / ((x / (y + 0.0007936500793651)) / z));
}
return tmp;
}
def code(x, y, z): t_0 = 0.91893853320467 + ((math.log(x) * (x - 0.5)) - x) tmp = 0 if x <= 1600000.0: tmp = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) else: tmp = t_0 + (z / ((x / (y + 0.0007936500793651)) / z)) return tmp
function code(x, y, z) t_0 = Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) tmp = 0.0 if (x <= 1600000.0) tmp = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x)); else tmp = Float64(t_0 + Float64(z / Float64(Float64(x / Float64(y + 0.0007936500793651)) / z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x); tmp = 0.0; if (x <= 1600000.0) tmp = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x); else tmp = t_0 + (z / ((x / (y + 0.0007936500793651)) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1600000.0], N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(z / N[(N[(x / N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\\
\mathbf{if}\;x \leq 1600000:\\
\;\;\;\;t_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;t_0 + \frac{z}{\frac{\frac{x}{y + 0.0007936500793651}}{z}}\\
\end{array}
\end{array}
if x < 1.6e6Initial program 99.8%
if 1.6e6 < x Initial program 90.8%
Taylor expanded in z around inf 90.8%
associate-/l*94.9%
Simplified94.9%
unpow294.9%
div-inv94.9%
times-frac97.6%
+-commutative97.6%
Applied egg-rr97.6%
frac-times94.9%
associate-/l*99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))))
(if (or (<= z -1.4e-6) (not (<= z 10.0)))
(+ t_0 (* (/ z x) (* z 0.0007936500793651)))
(+ t_0 (/ 0.083333333333333 x)))))
double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x);
double tmp;
if ((z <= -1.4e-6) || !(z <= 10.0)) {
tmp = t_0 + ((z / x) * (z * 0.0007936500793651));
} 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 = 0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)
if ((z <= (-1.4d-6)) .or. (.not. (z <= 10.0d0))) then
tmp = t_0 + ((z / x) * (z * 0.0007936500793651d0))
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 = 0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x);
double tmp;
if ((z <= -1.4e-6) || !(z <= 10.0)) {
tmp = t_0 + ((z / x) * (z * 0.0007936500793651));
} else {
tmp = t_0 + (0.083333333333333 / x);
}
return tmp;
}
def code(x, y, z): t_0 = 0.91893853320467 + ((math.log(x) * (x - 0.5)) - x) tmp = 0 if (z <= -1.4e-6) or not (z <= 10.0): tmp = t_0 + ((z / x) * (z * 0.0007936500793651)) else: tmp = t_0 + (0.083333333333333 / x) return tmp
function code(x, y, z) t_0 = Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) tmp = 0.0 if ((z <= -1.4e-6) || !(z <= 10.0)) tmp = Float64(t_0 + Float64(Float64(z / x) * Float64(z * 0.0007936500793651))); else tmp = Float64(t_0 + Float64(0.083333333333333 / x)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x); tmp = 0.0; if ((z <= -1.4e-6) || ~((z <= 10.0))) tmp = t_0 + ((z / x) * (z * 0.0007936500793651)); else tmp = t_0 + (0.083333333333333 / x); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -1.4e-6], N[Not[LessEqual[z, 10.0]], $MachinePrecision]], N[(t$95$0 + N[(N[(z / x), $MachinePrecision] * N[(z * 0.0007936500793651), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{-6} \lor \neg \left(z \leq 10\right):\\
\;\;\;\;t_0 + \frac{z}{x} \cdot \left(z \cdot 0.0007936500793651\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \frac{0.083333333333333}{x}\\
\end{array}
\end{array}
if z < -1.39999999999999994e-6 or 10 < z Initial program 90.7%
Taylor expanded in z around inf 89.9%
associate-/l*93.9%
Simplified93.9%
unpow293.9%
div-inv93.9%
times-frac96.9%
+-commutative96.9%
Applied egg-rr96.9%
Taylor expanded in y around 0 63.3%
*-commutative63.3%
Simplified63.3%
if -1.39999999999999994e-6 < z < 10Initial program 99.6%
Taylor expanded in z around 0 96.6%
Final simplification79.6%
(FPCore (x y z)
:precision binary64
(if (or (<= y -760000.0) (not (<= y 2.32e+73)))
(+ (+ 0.91893853320467 (- (* (log x) (- x 0.5)) x)) (* (/ z x) (* z y)))
(+
(- (* x (log x)) x)
(/
(+
0.083333333333333
(* z (- (* z 0.0007936500793651) 0.0027777777777778)))
x))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -760000.0) || !(y <= 2.32e+73)) {
tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((z / x) * (z * y));
} else {
tmp = ((x * log(x)) - x) + ((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) :: tmp
if ((y <= (-760000.0d0)) .or. (.not. (y <= 2.32d+73))) then
tmp = (0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)) + ((z / x) * (z * y))
else
tmp = ((x * log(x)) - x) + ((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 tmp;
if ((y <= -760000.0) || !(y <= 2.32e+73)) {
tmp = (0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x)) + ((z / x) * (z * y));
} else {
tmp = ((x * Math.log(x)) - x) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -760000.0) or not (y <= 2.32e+73): tmp = (0.91893853320467 + ((math.log(x) * (x - 0.5)) - x)) + ((z / x) * (z * y)) else: tmp = ((x * math.log(x)) - x) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -760000.0) || !(y <= 2.32e+73)) tmp = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(Float64(z / x) * Float64(z * y))); else tmp = Float64(Float64(Float64(x * log(x)) - x) + 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) tmp = 0.0; if ((y <= -760000.0) || ~((y <= 2.32e+73))) tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((z / x) * (z * y)); else tmp = ((x * log(x)) - x) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -760000.0], N[Not[LessEqual[y, 2.32e+73]], $MachinePrecision]], N[(N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(N[(z / x), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 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}
\mathbf{if}\;y \leq -760000 \lor \neg \left(y \leq 2.32 \cdot 10^{+73}\right):\\
\;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{z}{x} \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \log x - x\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right)}{x}\\
\end{array}
\end{array}
if y < -7.6e5 or 2.32000000000000014e73 < y Initial program 93.6%
Taylor expanded in z around inf 82.8%
associate-/l*87.6%
Simplified87.6%
unpow287.6%
div-inv87.5%
times-frac86.3%
+-commutative86.3%
Applied egg-rr86.3%
Taylor expanded in y around inf 86.3%
*-commutative86.3%
Simplified86.3%
if -7.6e5 < y < 2.32000000000000014e73Initial program 96.0%
Taylor expanded in x around 0 96.0%
sub-neg96.0%
metadata-eval96.0%
distribute-rgt-in96.0%
*-commutative96.0%
neg-mul-196.0%
associate-+l+96.0%
distribute-rgt-out96.0%
+-commutative96.0%
*-commutative96.0%
associate-+l+96.0%
sub-neg96.0%
+-commutative96.0%
*-commutative96.0%
fma-def96.0%
Simplified96.0%
Taylor expanded in x around inf 94.8%
mul-1-neg94.8%
distribute-rgt-neg-in94.8%
log-rec94.8%
remove-double-neg94.8%
Simplified94.8%
Taylor expanded in y around 0 93.5%
Final simplification90.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* x (log x)) x)))
(if (or (<= y -760000.0) (not (<= y 3.3e-175)))
(+ t_0 (/ (+ 0.083333333333333 (* z (- (* z y) 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 <= -760000.0) || !(y <= 3.3e-175)) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * y) - 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 <= (-760000.0d0)) .or. (.not. (y <= 3.3d-175))) then
tmp = t_0 + ((0.083333333333333d0 + (z * ((z * y) - 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 <= -760000.0) || !(y <= 3.3e-175)) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * y) - 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 <= -760000.0) or not (y <= 3.3e-175): tmp = t_0 + ((0.083333333333333 + (z * ((z * y) - 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 <= -760000.0) || !(y <= 3.3e-175)) tmp = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * y) - 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 <= -760000.0) || ~((y <= 3.3e-175))) tmp = t_0 + ((0.083333333333333 + (z * ((z * y) - 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[Or[LessEqual[y, -760000.0], N[Not[LessEqual[y, 3.3e-175]], $MachinePrecision]], N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * y), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $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 -760000 \lor \neg \left(y \leq 3.3 \cdot 10^{-175}\right):\\
\;\;\;\;t_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot y - 0.0027777777777778\right)}{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 < -7.6e5 or 3.29999999999999999e-175 < y Initial program 94.5%
Taylor expanded in x around 0 94.5%
sub-neg94.5%
metadata-eval94.5%
distribute-rgt-in94.5%
*-commutative94.5%
neg-mul-194.5%
associate-+l+94.5%
distribute-rgt-out94.5%
+-commutative94.5%
*-commutative94.5%
associate-+l+94.5%
sub-neg94.5%
+-commutative94.5%
*-commutative94.5%
fma-def94.5%
Simplified94.5%
Taylor expanded in x around inf 93.5%
mul-1-neg93.5%
distribute-rgt-neg-in93.5%
log-rec93.5%
remove-double-neg93.5%
Simplified93.5%
Taylor expanded in y around inf 93.8%
*-commutative93.8%
Simplified93.8%
if -7.6e5 < y < 3.29999999999999999e-175Initial program 95.8%
Taylor expanded in x around 0 95.9%
sub-neg95.9%
metadata-eval95.9%
distribute-rgt-in95.8%
*-commutative95.8%
neg-mul-195.8%
associate-+l+95.8%
distribute-rgt-out95.8%
+-commutative95.8%
*-commutative95.8%
associate-+l+95.8%
sub-neg95.8%
+-commutative95.8%
*-commutative95.8%
fma-def95.8%
Simplified95.8%
Taylor expanded in x around inf 95.0%
mul-1-neg95.0%
distribute-rgt-neg-in95.0%
log-rec95.0%
remove-double-neg95.0%
Simplified95.0%
Taylor expanded in y around 0 94.9%
Final simplification94.2%
(FPCore (x y z)
:precision binary64
(if (<= x 2e+151)
(+
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x)
(* x (+ (log x) -1.0)))
(+ (+ 0.91893853320467 (- (* (log x) (- x 0.5)) x)) (* (/ z x) (* z y)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e+151) {
tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + (x * (log(x) + -1.0));
} else {
tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((z / x) * (z * y));
}
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 <= 2d+151) then
tmp = ((0.083333333333333d0 + (z * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))) / x) + (x * (log(x) + (-1.0d0)))
else
tmp = (0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)) + ((z / x) * (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 2e+151) {
tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + (x * (Math.log(x) + -1.0));
} else {
tmp = (0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x)) + ((z / x) * (z * y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2e+151: tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + (x * (math.log(x) + -1.0)) else: tmp = (0.91893853320467 + ((math.log(x) * (x - 0.5)) - x)) + ((z / x) * (z * y)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2e+151) tmp = Float64(Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x) + Float64(x * Float64(log(x) + -1.0))); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(Float64(z / x) * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2e+151) tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + (x * (log(x) + -1.0)); else tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((z / x) * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2e+151], N[(N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(N[(z / x), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{+151}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x} + x \cdot \left(\log x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{z}{x} \cdot \left(z \cdot y\right)\\
\end{array}
\end{array}
if x < 2.00000000000000003e151Initial program 99.3%
Taylor expanded in x around inf 98.1%
sub-neg51.8%
mul-1-neg51.8%
log-rec51.8%
remove-double-neg51.8%
metadata-eval51.8%
Simplified98.1%
if 2.00000000000000003e151 < x Initial program 81.4%
Taylor expanded in z around inf 81.4%
associate-/l*89.0%
Simplified89.0%
unpow289.0%
div-inv89.0%
times-frac95.0%
+-commutative95.0%
Applied egg-rr95.0%
Taylor expanded in y around inf 93.2%
*-commutative93.2%
Simplified93.2%
Final simplification96.9%
(FPCore (x y z)
:precision binary64
(if (<= x 110.0)
(+
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x)
(* x (+ (log x) -1.0)))
(+
(+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))
(/ z (/ (/ x (+ y 0.0007936500793651)) z)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 110.0) {
tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + (x * (log(x) + -1.0));
} else {
tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + (z / ((x / (y + 0.0007936500793651)) / z));
}
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 <= 110.0d0) then
tmp = ((0.083333333333333d0 + (z * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))) / x) + (x * (log(x) + (-1.0d0)))
else
tmp = (0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)) + (z / ((x / (y + 0.0007936500793651d0)) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 110.0) {
tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + (x * (Math.log(x) + -1.0));
} else {
tmp = (0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x)) + (z / ((x / (y + 0.0007936500793651)) / z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 110.0: tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + (x * (math.log(x) + -1.0)) else: tmp = (0.91893853320467 + ((math.log(x) * (x - 0.5)) - x)) + (z / ((x / (y + 0.0007936500793651)) / z)) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 110.0) tmp = Float64(Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x) + Float64(x * Float64(log(x) + -1.0))); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(z / Float64(Float64(x / Float64(y + 0.0007936500793651)) / z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 110.0) tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + (x * (log(x) + -1.0)); else tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + (z / ((x / (y + 0.0007936500793651)) / z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 110.0], N[(N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(z / N[(N[(x / N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 110:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x} + x \cdot \left(\log x + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{z}{\frac{\frac{x}{y + 0.0007936500793651}}{z}}\\
\end{array}
\end{array}
if x < 110Initial program 99.8%
Taylor expanded in x around inf 98.6%
sub-neg44.4%
mul-1-neg44.4%
log-rec44.4%
remove-double-neg44.4%
metadata-eval44.4%
Simplified98.6%
if 110 < x Initial program 90.8%
Taylor expanded in z around inf 90.8%
associate-/l*94.9%
Simplified94.9%
unpow294.9%
div-inv94.9%
times-frac97.6%
+-commutative97.6%
Applied egg-rr97.6%
frac-times94.9%
associate-/l*99.6%
un-div-inv99.6%
Applied egg-rr99.6%
Final simplification99.1%
(FPCore (x y z) :precision binary64 (+ (+ 0.91893853320467 (- (* (log x) (- x 0.5)) x)) (/ 0.083333333333333 x)))
double code(double x, double y, double z) {
return (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + (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 + ((log(x) * (x - 0.5d0)) - x)) + (0.083333333333333d0 / x)
end function
public static double code(double x, double y, double z) {
return (0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x)) + (0.083333333333333 / x);
}
def code(x, y, z): return (0.91893853320467 + ((math.log(x) * (x - 0.5)) - x)) + (0.083333333333333 / x)
function code(x, y, z) return Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(0.083333333333333 / x)) end
function tmp = code(x, y, z) tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + (0.083333333333333 / x); end
code[x_, y_, z_] := N[(N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{0.083333333333333}{x}
\end{array}
Initial program 95.0%
Taylor expanded in z around 0 59.2%
Final simplification59.2%
(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 95.0%
Taylor expanded in x around 0 95.0%
sub-neg95.0%
metadata-eval95.0%
distribute-rgt-in95.0%
*-commutative95.0%
neg-mul-195.0%
associate-+l+95.0%
distribute-rgt-out95.0%
+-commutative95.0%
*-commutative95.0%
associate-+l+95.0%
sub-neg95.0%
+-commutative95.0%
*-commutative95.0%
fma-def95.0%
Simplified95.0%
Taylor expanded in x around inf 94.1%
mul-1-neg94.1%
distribute-rgt-neg-in94.1%
log-rec94.1%
remove-double-neg94.1%
Simplified94.1%
Taylor expanded in y around inf 83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in z around 0 63.7%
Final simplification63.7%
(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 95.0%
Taylor expanded in z around 0 59.2%
Taylor expanded in x around inf 58.3%
sub-neg58.3%
mul-1-neg58.3%
log-rec58.3%
remove-double-neg58.3%
metadata-eval58.3%
Simplified58.3%
Final simplification58.3%
(FPCore (x y z) :precision binary64 (+ 0.91893853320467 (/ 0.083333333333333 x)))
double code(double x, double y, double z) {
return 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 = 0.91893853320467d0 + (0.083333333333333d0 / x)
end function
public static double code(double x, double y, double z) {
return 0.91893853320467 + (0.083333333333333 / x);
}
def code(x, y, z): return 0.91893853320467 + (0.083333333333333 / x)
function code(x, y, z) return Float64(0.91893853320467 + Float64(0.083333333333333 / x)) end
function tmp = code(x, y, z) tmp = 0.91893853320467 + (0.083333333333333 / x); end
code[x_, y_, z_] := N[(0.91893853320467 + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.91893853320467 + \frac{0.083333333333333}{x}
\end{array}
Initial program 95.0%
Taylor expanded in z around 0 59.2%
Taylor expanded in x around inf 58.3%
mul-1-neg58.3%
distribute-rgt-neg-in58.3%
log-rec58.3%
remove-double-neg58.3%
Simplified58.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 2024013
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
:herbie-target
(+ (+ (+ (* (- 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)))