
(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 (+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (+ (* z (/ (+ 0.0007936500793651 y) (/ x z))) (/ 0.083333333333333 x))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((z * ((0.0007936500793651 + y) / (x / z))) + (0.083333333333333 / x));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((z * ((0.0007936500793651d0 + y) / (x / z))) + (0.083333333333333d0 / x))
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((z * ((0.0007936500793651 + y) / (x / z))) + (0.083333333333333 / x));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((z * ((0.0007936500793651 + y) / (x / 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(z * Float64(Float64(0.0007936500793651 + y) / Float64(x / z))) + Float64(0.083333333333333 / x))) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((z * ((0.0007936500793651 + y) / (x / z))) + (0.083333333333333 / x)); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(z \cdot \frac{0.0007936500793651 + y}{\frac{x}{z}} + \frac{0.083333333333333}{x}\right)
\end{array}
Initial program 94.2%
Taylor expanded in z around 0 94.4%
Taylor expanded in z around inf 89.8%
unpow289.8%
associate-*r/89.8%
metadata-eval89.8%
associate-*l*93.5%
distribute-rgt-in91.5%
associate-*l/91.5%
associate-*r/91.5%
associate-*l/95.3%
associate-/l*94.8%
distribute-rgt-out98.3%
Simplified98.3%
*-commutative98.3%
clear-num98.3%
un-div-inv98.3%
Applied egg-rr98.3%
Taylor expanded in x around 0 98.3%
Final simplification98.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 0.083333333333333 (/ 1.0 x))))
(if (<= x 2e-9)
(+
(+ 0.91893853320467 (* (log x) -0.5))
(+ t_0 (* z (/ -0.0027777777777778 x))))
(+ t_0 (- (* (log x) (+ x -0.5)) (+ x -0.91893853320467))))))
double code(double x, double y, double z) {
double t_0 = 0.083333333333333 * (1.0 / x);
double tmp;
if (x <= 2e-9) {
tmp = (0.91893853320467 + (log(x) * -0.5)) + (t_0 + (z * (-0.0027777777777778 / x)));
} else {
tmp = t_0 + ((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) :: t_0
real(8) :: tmp
t_0 = 0.083333333333333d0 * (1.0d0 / x)
if (x <= 2d-9) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) + (t_0 + (z * ((-0.0027777777777778d0) / x)))
else
tmp = t_0 + ((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 t_0 = 0.083333333333333 * (1.0 / x);
double tmp;
if (x <= 2e-9) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) + (t_0 + (z * (-0.0027777777777778 / x)));
} else {
tmp = t_0 + ((Math.log(x) * (x + -0.5)) - (x + -0.91893853320467));
}
return tmp;
}
def code(x, y, z): t_0 = 0.083333333333333 * (1.0 / x) tmp = 0 if x <= 2e-9: tmp = (0.91893853320467 + (math.log(x) * -0.5)) + (t_0 + (z * (-0.0027777777777778 / x))) else: tmp = t_0 + ((math.log(x) * (x + -0.5)) - (x + -0.91893853320467)) return tmp
function code(x, y, z) t_0 = Float64(0.083333333333333 * Float64(1.0 / x)) tmp = 0.0 if (x <= 2e-9) tmp = Float64(Float64(0.91893853320467 + Float64(log(x) * -0.5)) + Float64(t_0 + Float64(z * Float64(-0.0027777777777778 / x)))); else tmp = Float64(t_0 + Float64(Float64(log(x) * Float64(x + -0.5)) - Float64(x + -0.91893853320467))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.083333333333333 * (1.0 / x); tmp = 0.0; if (x <= 2e-9) tmp = (0.91893853320467 + (log(x) * -0.5)) + (t_0 + (z * (-0.0027777777777778 / x))); else tmp = t_0 + ((log(x) * (x + -0.5)) - (x + -0.91893853320467)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2e-9], N[(N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 + N[(z * N[(-0.0027777777777778 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + 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}
t_0 := 0.083333333333333 \cdot \frac{1}{x}\\
\mathbf{if}\;x \leq 2 \cdot 10^{-9}:\\
\;\;\;\;\left(0.91893853320467 + \log x \cdot -0.5\right) + \left(t\_0 + z \cdot \frac{-0.0027777777777778}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(\log x \cdot \left(x + -0.5\right) - \left(x + -0.91893853320467\right)\right)\\
\end{array}
\end{array}
if x < 2.00000000000000012e-9Initial program 99.7%
Taylor expanded in z around 0 89.0%
Taylor expanded in x around 0 89.0%
Taylor expanded in z around 0 56.0%
associate-*r/56.0%
*-commutative56.0%
associate-/l*56.0%
Simplified56.0%
if 2.00000000000000012e-9 < x Initial program 89.0%
Taylor expanded in z around 0 69.0%
associate-+l-69.0%
sub-neg69.0%
metadata-eval69.0%
*-commutative69.0%
sub-neg69.0%
metadata-eval69.0%
Applied egg-rr69.0%
div-inv69.0%
*-commutative69.0%
Applied egg-rr69.0%
Final simplification62.7%
(FPCore (x y z) :precision binary64 (+ (* x (+ (log x) -1.0)) (+ (* z (* (+ 0.0007936500793651 y) (/ z x))) (* 0.083333333333333 (/ 1.0 x)))))
double code(double x, double y, double z) {
return (x * (log(x) + -1.0)) + ((z * ((0.0007936500793651 + y) * (z / 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 * (log(x) + (-1.0d0))) + ((z * ((0.0007936500793651d0 + y) * (z / x))) + (0.083333333333333d0 * (1.0d0 / x)))
end function
public static double code(double x, double y, double z) {
return (x * (Math.log(x) + -1.0)) + ((z * ((0.0007936500793651 + y) * (z / x))) + (0.083333333333333 * (1.0 / x)));
}
def code(x, y, z): return (x * (math.log(x) + -1.0)) + ((z * ((0.0007936500793651 + y) * (z / x))) + (0.083333333333333 * (1.0 / x)))
function code(x, y, z) return Float64(Float64(x * Float64(log(x) + -1.0)) + Float64(Float64(z * Float64(Float64(0.0007936500793651 + y) * Float64(z / x))) + Float64(0.083333333333333 * Float64(1.0 / x)))) end
function tmp = code(x, y, z) tmp = (x * (log(x) + -1.0)) + ((z * ((0.0007936500793651 + y) * (z / x))) + (0.083333333333333 * (1.0 / x))); end
code[x_, y_, z_] := N[(N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(z * N[(N[(0.0007936500793651 + y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\log x + -1\right) + \left(z \cdot \left(\left(0.0007936500793651 + y\right) \cdot \frac{z}{x}\right) + 0.083333333333333 \cdot \frac{1}{x}\right)
\end{array}
Initial program 94.2%
Taylor expanded in z around 0 94.4%
Taylor expanded in z around inf 89.8%
unpow289.8%
associate-*r/89.8%
metadata-eval89.8%
associate-*l*93.5%
distribute-rgt-in91.5%
associate-*l/91.5%
associate-*r/91.5%
associate-*l/95.3%
associate-/l*94.8%
distribute-rgt-out98.3%
Simplified98.3%
Taylor expanded in x around inf 96.7%
sub-neg56.3%
mul-1-neg56.3%
log-rec56.3%
remove-double-neg56.3%
metadata-eval56.3%
+-commutative56.3%
Simplified96.7%
Final simplification96.7%
(FPCore (x y z)
:precision binary64
(+
(* x (+ (log x) -1.0))
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x)))
double code(double x, double y, double z) {
return (x * (log(x) + -1.0)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 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) + (-1.0d0))) + ((0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x)
end function
public static double code(double x, double y, double z) {
return (x * (Math.log(x) + -1.0)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
}
def code(x, y, z): return (x * (math.log(x) + -1.0)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x)
function code(x, y, z) return Float64(Float64(x * Float64(log(x) + -1.0)) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x)) end
function tmp = code(x, y, z) tmp = (x * (log(x) + -1.0)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x); end
code[x_, y_, z_] := N[(N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $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]
\begin{array}{l}
\\
x \cdot \left(\log x + -1\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}
\end{array}
Initial program 94.2%
Taylor expanded in x around inf 92.6%
sub-neg56.3%
mul-1-neg56.3%
log-rec56.3%
remove-double-neg56.3%
metadata-eval56.3%
+-commutative56.3%
Simplified92.6%
Final simplification92.6%
(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 94.2%
Taylor expanded in z around 0 57.9%
Final simplification57.9%
(FPCore (x y z) :precision binary64 (+ (/ 0.083333333333333 x) (- (* (log x) (+ x -0.5)) (+ x -0.91893853320467))))
double code(double x, double y, double z) {
return (0.083333333333333 / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467));
}
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) + ((log(x) * (x + (-0.5d0))) - (x + (-0.91893853320467d0)))
end function
public static double code(double x, double y, double z) {
return (0.083333333333333 / x) + ((Math.log(x) * (x + -0.5)) - (x + -0.91893853320467));
}
def code(x, y, z): return (0.083333333333333 / x) + ((math.log(x) * (x + -0.5)) - (x + -0.91893853320467))
function code(x, y, z) return Float64(Float64(0.083333333333333 / x) + Float64(Float64(log(x) * Float64(x + -0.5)) - Float64(x + -0.91893853320467))) end
function tmp = code(x, y, z) tmp = (0.083333333333333 / x) + ((log(x) * (x + -0.5)) - (x + -0.91893853320467)); end
code[x_, y_, z_] := 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}
\\
\frac{0.083333333333333}{x} + \left(\log x \cdot \left(x + -0.5\right) - \left(x + -0.91893853320467\right)\right)
\end{array}
Initial program 94.2%
Taylor expanded in z around 0 57.9%
associate-+l-58.0%
sub-neg58.0%
metadata-eval58.0%
*-commutative58.0%
sub-neg58.0%
metadata-eval58.0%
Applied egg-rr58.0%
Final simplification58.0%
(FPCore (x y z) :precision binary64 (- (+ (/ 0.083333333333333 x) (* (log x) (+ x -0.5))) (+ x -0.91893853320467)))
double code(double x, double y, double z) {
return ((0.083333333333333 / x) + (log(x) * (x + -0.5))) - (x + -0.91893853320467);
}
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) + (log(x) * (x + (-0.5d0)))) - (x + (-0.91893853320467d0))
end function
public static double code(double x, double y, double z) {
return ((0.083333333333333 / x) + (Math.log(x) * (x + -0.5))) - (x + -0.91893853320467);
}
def code(x, y, z): return ((0.083333333333333 / x) + (math.log(x) * (x + -0.5))) - (x + -0.91893853320467)
function code(x, y, z) return Float64(Float64(Float64(0.083333333333333 / x) + Float64(log(x) * Float64(x + -0.5))) - Float64(x + -0.91893853320467)) end
function tmp = code(x, y, z) tmp = ((0.083333333333333 / x) + (log(x) * (x + -0.5))) - (x + -0.91893853320467); end
code[x_, y_, z_] := N[(N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x + -0.91893853320467), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{0.083333333333333}{x} + \log x \cdot \left(x + -0.5\right)\right) - \left(x + -0.91893853320467\right)
\end{array}
Initial program 94.2%
Taylor expanded in z around 0 57.9%
associate-+l-58.0%
sub-neg58.0%
metadata-eval58.0%
*-commutative58.0%
sub-neg58.0%
metadata-eval58.0%
Applied egg-rr58.0%
+-commutative58.0%
associate-+r-58.0%
Applied egg-rr58.0%
Final simplification58.0%
(FPCore (x y z) :precision binary64 (+ (/ 0.083333333333333 x) (+ 0.91893853320467 (* x (+ (log x) -1.0)))))
double code(double x, double y, double z) {
return (0.083333333333333 / x) + (0.91893853320467 + (x * (log(x) + -1.0)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (0.083333333333333d0 / x) + (0.91893853320467d0 + (x * (log(x) + (-1.0d0))))
end function
public static double code(double x, double y, double z) {
return (0.083333333333333 / x) + (0.91893853320467 + (x * (Math.log(x) + -1.0)));
}
def code(x, y, z): return (0.083333333333333 / x) + (0.91893853320467 + (x * (math.log(x) + -1.0)))
function code(x, y, z) return Float64(Float64(0.083333333333333 / x) + Float64(0.91893853320467 + Float64(x * Float64(log(x) + -1.0)))) end
function tmp = code(x, y, z) tmp = (0.083333333333333 / x) + (0.91893853320467 + (x * (log(x) + -1.0))); end
code[x_, y_, z_] := N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(0.91893853320467 + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.083333333333333}{x} + \left(0.91893853320467 + x \cdot \left(\log x + -1\right)\right)
\end{array}
Initial program 94.2%
Taylor expanded in z around 0 57.9%
add-sqr-sqrt57.8%
pow257.8%
sub-neg57.8%
metadata-eval57.8%
*-commutative57.8%
Applied egg-rr57.8%
Taylor expanded in x around inf 33.7%
mul-1-neg33.7%
distribute-rgt-neg-in33.7%
log-rec33.7%
remove-double-neg33.7%
Simplified33.7%
Taylor expanded in x around 0 56.3%
Final simplification56.3%
(FPCore (x y z) :precision binary64 (if (<= x 25.0) (/ 0.083333333333333 x) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 25.0) {
tmp = 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 <= 25.0d0) then
tmp = 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 <= 25.0) {
tmp = 0.083333333333333 / x;
} else {
tmp = x * (Math.log(x) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 25.0: tmp = 0.083333333333333 / x else: tmp = x * (math.log(x) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 25.0) tmp = 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 <= 25.0) tmp = 0.083333333333333 / x; else tmp = x * (log(x) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 25.0], N[(0.083333333333333 / x), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 25:\\
\;\;\;\;\frac{0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 25Initial program 99.7%
Taylor expanded in z around 0 46.4%
associate-+l-46.4%
sub-neg46.4%
metadata-eval46.4%
*-commutative46.4%
sub-neg46.4%
metadata-eval46.4%
Applied egg-rr46.4%
Taylor expanded in x around 0 44.2%
if 25 < x Initial program 88.5%
associate-+l+88.5%
fmm-def88.6%
sub-neg88.6%
metadata-eval88.6%
fma-define88.6%
fmm-def88.6%
metadata-eval88.6%
Simplified88.6%
Taylor expanded in z around 0 69.9%
Taylor expanded in x around inf 68.9%
sub-neg68.9%
mul-1-neg68.9%
log-rec68.9%
remove-double-neg68.9%
metadata-eval68.9%
+-commutative68.9%
Simplified68.9%
Final simplification56.3%
(FPCore (x y z) :precision binary64 (+ (/ 0.083333333333333 x) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
return (0.083333333333333 / x) + (x * (log(x) + -1.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (0.083333333333333d0 / x) + (x * (log(x) + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return (0.083333333333333 / x) + (x * (Math.log(x) + -1.0));
}
def code(x, y, z): return (0.083333333333333 / x) + (x * (math.log(x) + -1.0))
function code(x, y, z) return Float64(Float64(0.083333333333333 / x) + Float64(x * Float64(log(x) + -1.0))) end
function tmp = code(x, y, z) tmp = (0.083333333333333 / x) + (x * (log(x) + -1.0)); end
code[x_, y_, z_] := N[(N[(0.083333333333333 / x), $MachinePrecision] + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.083333333333333}{x} + x \cdot \left(\log x + -1\right)
\end{array}
Initial program 94.2%
Taylor expanded in z around 0 57.9%
Taylor expanded in x around inf 56.3%
sub-neg56.3%
mul-1-neg56.3%
log-rec56.3%
remove-double-neg56.3%
metadata-eval56.3%
+-commutative56.3%
Simplified56.3%
Final simplification56.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 94.2%
Taylor expanded in z around 0 57.9%
associate-+l-58.0%
sub-neg58.0%
metadata-eval58.0%
*-commutative58.0%
sub-neg58.0%
metadata-eval58.0%
Applied egg-rr58.0%
Taylor expanded in x around 0 23.8%
Final simplification23.8%
(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 2024095
(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)))