
(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 9 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 (* (/ z x) (+ 0.0007936500793651 y))) (/ 1.0 (* x 12.000000000000048)))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((z * ((z / x) * (0.0007936500793651 + y))) + (1.0 / (x * 12.000000000000048)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((x - 0.5d0) * log(x)) - x) + 0.91893853320467d0) + ((z * ((z / x) * (0.0007936500793651d0 + y))) + (1.0d0 / (x * 12.000000000000048d0)))
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) - x) + 0.91893853320467) + ((z * ((z / x) * (0.0007936500793651 + y))) + (1.0 / (x * 12.000000000000048)));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) - x) + 0.91893853320467) + ((z * ((z / x) * (0.0007936500793651 + y))) + (1.0 / (x * 12.000000000000048)))
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) - x) + 0.91893853320467) + Float64(Float64(z * Float64(Float64(z / x) * Float64(0.0007936500793651 + y))) + Float64(1.0 / Float64(x * 12.000000000000048)))) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) - x) + 0.91893853320467) + ((z * ((z / x) * (0.0007936500793651 + y))) + (1.0 / (x * 12.000000000000048))); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(N[(z * N[(N[(z / x), $MachinePrecision] * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x * 12.000000000000048), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x - x\right) + 0.91893853320467\right) + \left(z \cdot \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right) + \frac{1}{x \cdot 12.000000000000048}\right)
\end{array}
Initial program 94.9%
Taylor expanded in z around 0 95.5%
Taylor expanded in z around inf 92.1%
unpow292.1%
associate-*l*95.1%
associate-*r/95.1%
metadata-eval95.1%
distribute-rgt-out91.6%
associate-*l/91.6%
associate-*r/91.6%
associate-*l/95.0%
associate-/l*91.1%
distribute-rgt-out98.9%
Simplified98.9%
div-inv98.9%
clear-num98.9%
div-inv98.9%
metadata-eval98.9%
Applied egg-rr98.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 0.91893853320467 (* (log x) -0.5)))
(t_1
(+
t_0
(/ (+ 0.083333333333333 (* z (- (* z y) 0.0027777777777778))) x))))
(if (<= x 1.75e-275)
t_1
(if (<= x 2.2e-139)
(+
t_0
(/
(+
0.083333333333333
(* z (- (* z 0.0007936500793651) 0.0027777777777778)))
x))
(if (<= x 1.45e+59) t_1 (* x (+ (log x) -1.0)))))))
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 * y) - 0.0027777777777778))) / x);
double tmp;
if (x <= 1.75e-275) {
tmp = t_1;
} else if (x <= 2.2e-139) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
} else if (x <= 1.45e+59) {
tmp = t_1;
} 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) :: 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 * y) - 0.0027777777777778d0))) / x)
if (x <= 1.75d-275) then
tmp = t_1
else if (x <= 2.2d-139) then
tmp = t_0 + ((0.083333333333333d0 + (z * ((z * 0.0007936500793651d0) - 0.0027777777777778d0))) / x)
else if (x <= 1.45d+59) then
tmp = t_1
else
tmp = x * (log(x) + (-1.0d0))
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 * y) - 0.0027777777777778))) / x);
double tmp;
if (x <= 1.75e-275) {
tmp = t_1;
} else if (x <= 2.2e-139) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
} else if (x <= 1.45e+59) {
tmp = t_1;
} else {
tmp = x * (Math.log(x) + -1.0);
}
return tmp;
}
def code(x, y, z): t_0 = 0.91893853320467 + (math.log(x) * -0.5) t_1 = t_0 + ((0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x) tmp = 0 if x <= 1.75e-275: tmp = t_1 elif x <= 2.2e-139: tmp = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x) elif x <= 1.45e+59: tmp = t_1 else: tmp = x * (math.log(x) + -1.0) 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 * y) - 0.0027777777777778))) / x)) tmp = 0.0 if (x <= 1.75e-275) tmp = t_1; elseif (x <= 2.2e-139) tmp = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * 0.0007936500793651) - 0.0027777777777778))) / x)); elseif (x <= 1.45e+59) tmp = t_1; else tmp = Float64(x * Float64(log(x) + -1.0)); 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 * y) - 0.0027777777777778))) / x); tmp = 0.0; if (x <= 1.75e-275) tmp = t_1; elseif (x <= 2.2e-139) tmp = t_0 + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x); elseif (x <= 1.45e+59) tmp = t_1; else tmp = x * (log(x) + -1.0); 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 * y), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.75e-275], t$95$1, If[LessEqual[x, 2.2e-139], 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[x, 1.45e+59], t$95$1, N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\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 y - 0.0027777777777778\right)}{x}\\
\mathbf{if}\;x \leq 1.75 \cdot 10^{-275}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-139}:\\
\;\;\;\;t\_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right)}{x}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 1.74999999999999984e-275 or 2.2000000000000001e-139 < x < 1.44999999999999995e59Initial program 98.8%
add-cbrt-cube98.8%
pow398.8%
sub-neg98.8%
metadata-eval98.8%
Applied egg-rr98.8%
Taylor expanded in x around 0 93.4%
Taylor expanded in y around inf 78.5%
*-commutative78.5%
Simplified78.5%
if 1.74999999999999984e-275 < x < 2.2000000000000001e-139Initial program 99.7%
add-cbrt-cube99.7%
pow399.7%
sub-neg99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 99.7%
Taylor expanded in y around 0 96.0%
*-commutative96.0%
Simplified96.0%
if 1.44999999999999995e59 < x Initial program 89.8%
sub-neg89.8%
associate-+l+89.8%
fma-define89.9%
sub-neg89.9%
metadata-eval89.9%
+-commutative89.9%
unsub-neg89.9%
*-commutative89.9%
fma-define89.9%
fma-neg89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in z around 0 81.0%
Taylor expanded in x around inf 81.0%
sub-neg81.0%
mul-1-neg81.0%
log-rec81.0%
remove-double-neg81.0%
metadata-eval81.0%
Simplified81.0%
Final simplification83.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (+ (log x) -1.0))))
(if (<= x 4.5e+188)
(+
t_0
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x))
t_0)))
double code(double x, double y, double z) {
double t_0 = x * (log(x) + -1.0);
double tmp;
if (x <= 4.5e+188) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
} else {
tmp = t_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) :: t_0
real(8) :: tmp
t_0 = x * (log(x) + (-1.0d0))
if (x <= 4.5d+188) then
tmp = t_0 + ((0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (Math.log(x) + -1.0);
double tmp;
if (x <= 4.5e+188) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (math.log(x) + -1.0) tmp = 0 if x <= 4.5e+188: tmp = t_0 + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(log(x) + -1.0)) tmp = 0.0 if (x <= 4.5e+188) tmp = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (log(x) + -1.0); tmp = 0.0; if (x <= 4.5e+188) tmp = t_0 + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 4.5e+188], N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(\log x + -1\right)\\
\mathbf{if}\;x \leq 4.5 \cdot 10^{+188}:\\
\;\;\;\;t\_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < 4.5000000000000001e188Initial program 98.8%
Taylor expanded in x around inf 98.7%
sub-neg98.7%
mul-1-neg98.7%
log-rec98.7%
remove-double-neg98.7%
metadata-eval98.7%
+-commutative98.7%
Simplified98.7%
if 4.5000000000000001e188 < x Initial program 80.3%
sub-neg80.3%
associate-+l+80.3%
fma-define80.4%
sub-neg80.4%
metadata-eval80.4%
+-commutative80.4%
unsub-neg80.4%
*-commutative80.4%
fma-define80.4%
fma-neg80.4%
metadata-eval80.4%
Simplified80.4%
Taylor expanded in z around 0 90.3%
Taylor expanded in x around inf 90.3%
sub-neg90.3%
mul-1-neg90.3%
log-rec90.3%
remove-double-neg90.3%
metadata-eval90.3%
Simplified90.3%
Final simplification97.0%
(FPCore (x y z)
:precision binary64
(if (<= x 2.9e+60)
(+
(+ 0.91893853320467 (* (log x) -0.5))
(/
(+
0.083333333333333
(* z (- (* z 0.0007936500793651) 0.0027777777777778)))
x))
(* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2.9e+60) {
tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 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 <= 2.9d+60) then
tmp = (0.91893853320467d0 + (log(x) * (-0.5d0))) + ((0.083333333333333d0 + (z * ((z * 0.0007936500793651d0) - 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 <= 2.9e+60) {
tmp = (0.91893853320467 + (Math.log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x);
} else {
tmp = x * (Math.log(x) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 2.9e+60: tmp = (0.91893853320467 + (math.log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x) else: tmp = x * (math.log(x) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 2.9e+60) 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(x * Float64(log(x) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 2.9e+60) tmp = (0.91893853320467 + (log(x) * -0.5)) + ((0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x); else tmp = x * (log(x) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 2.9e+60], 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[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9 \cdot 10^{+60}:\\
\;\;\;\;\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}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 2.9e60Initial program 99.1%
add-cbrt-cube99.1%
pow399.1%
sub-neg99.1%
metadata-eval99.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 95.7%
Taylor expanded in y around 0 73.5%
*-commutative73.5%
Simplified73.5%
if 2.9e60 < x Initial program 89.7%
sub-neg89.7%
associate-+l+89.7%
fma-define89.8%
sub-neg89.8%
metadata-eval89.8%
+-commutative89.8%
unsub-neg89.8%
*-commutative89.8%
fma-define89.8%
fma-neg89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in z around 0 81.6%
Taylor expanded in x around inf 81.6%
sub-neg81.6%
mul-1-neg81.6%
log-rec81.6%
remove-double-neg81.6%
metadata-eval81.6%
Simplified81.6%
Final simplification77.1%
(FPCore (x y z) :precision binary64 (+ (+ (* z (* (/ z x) (+ 0.0007936500793651 y))) (/ 1.0 (* x 12.000000000000048))) (* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
return ((z * ((z / x) * (0.0007936500793651 + y))) + (1.0 / (x * 12.000000000000048))) + (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 = ((z * ((z / x) * (0.0007936500793651d0 + y))) + (1.0d0 / (x * 12.000000000000048d0))) + (x * (log(x) + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return ((z * ((z / x) * (0.0007936500793651 + y))) + (1.0 / (x * 12.000000000000048))) + (x * (Math.log(x) + -1.0));
}
def code(x, y, z): return ((z * ((z / x) * (0.0007936500793651 + y))) + (1.0 / (x * 12.000000000000048))) + (x * (math.log(x) + -1.0))
function code(x, y, z) return Float64(Float64(Float64(z * Float64(Float64(z / x) * Float64(0.0007936500793651 + y))) + Float64(1.0 / Float64(x * 12.000000000000048))) + Float64(x * Float64(log(x) + -1.0))) end
function tmp = code(x, y, z) tmp = ((z * ((z / x) * (0.0007936500793651 + y))) + (1.0 / (x * 12.000000000000048))) + (x * (log(x) + -1.0)); end
code[x_, y_, z_] := N[(N[(N[(z * N[(N[(z / x), $MachinePrecision] * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 / N[(x * 12.000000000000048), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot \left(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right) + \frac{1}{x \cdot 12.000000000000048}\right) + x \cdot \left(\log x + -1\right)
\end{array}
Initial program 94.9%
Taylor expanded in z around 0 95.5%
Taylor expanded in z around inf 92.1%
unpow292.1%
associate-*l*95.1%
associate-*r/95.1%
metadata-eval95.1%
distribute-rgt-out91.6%
associate-*l/91.6%
associate-*r/91.6%
associate-*l/95.0%
associate-/l*91.1%
distribute-rgt-out98.9%
Simplified98.9%
div-inv98.9%
clear-num98.9%
div-inv98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Taylor expanded in x around inf 98.9%
sub-neg98.9%
mul-1-neg98.9%
log-rec98.9%
remove-double-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (+ (* x (+ (log x) -1.0)) (+ (* z (* (/ z x) (+ 0.0007936500793651 y))) (* 0.083333333333333 (/ 1.0 x)))))
double code(double x, double y, double z) {
return (x * (log(x) + -1.0)) + ((z * ((z / x) * (0.0007936500793651 + y))) + (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 * ((z / x) * (0.0007936500793651d0 + y))) + (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 * ((z / x) * (0.0007936500793651 + y))) + (0.083333333333333 * (1.0 / x)));
}
def code(x, y, z): return (x * (math.log(x) + -1.0)) + ((z * ((z / x) * (0.0007936500793651 + y))) + (0.083333333333333 * (1.0 / x)))
function code(x, y, z) return Float64(Float64(x * Float64(log(x) + -1.0)) + Float64(Float64(z * Float64(Float64(z / x) * Float64(0.0007936500793651 + y))) + Float64(0.083333333333333 * Float64(1.0 / x)))) end
function tmp = code(x, y, z) tmp = (x * (log(x) + -1.0)) + ((z * ((z / x) * (0.0007936500793651 + y))) + (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[(z / x), $MachinePrecision] * N[(0.0007936500793651 + y), $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(\frac{z}{x} \cdot \left(0.0007936500793651 + y\right)\right) + 0.083333333333333 \cdot \frac{1}{x}\right)
\end{array}
Initial program 94.9%
Taylor expanded in z around 0 95.5%
Taylor expanded in z around inf 92.1%
unpow292.1%
associate-*l*95.1%
associate-*r/95.1%
metadata-eval95.1%
distribute-rgt-out91.6%
associate-*l/91.6%
associate-*r/91.6%
associate-*l/95.0%
associate-/l*91.1%
distribute-rgt-out98.9%
Simplified98.9%
Taylor expanded in x around inf 98.9%
sub-neg98.9%
mul-1-neg98.9%
log-rec98.9%
remove-double-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z)
:precision binary64
(if (<= x 1360000000.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 <= 1360000000.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 <= 1360000000.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 <= 1360000000.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 <= 1360000000.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 <= 1360000000.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 <= 1360000000.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, 1360000000.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 1360000000:\\
\;\;\;\;\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 < 1.36e9Initial program 99.8%
add-cbrt-cube99.8%
pow399.8%
sub-neg99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 99.8%
Taylor expanded in z around 0 49.8%
*-commutative49.8%
Simplified49.8%
if 1.36e9 < x Initial program 90.4%
sub-neg90.4%
associate-+l+90.4%
fma-define90.6%
sub-neg90.6%
metadata-eval90.6%
+-commutative90.6%
unsub-neg90.6%
*-commutative90.6%
fma-define90.6%
fma-neg90.6%
metadata-eval90.6%
Simplified90.6%
Taylor expanded in z around 0 74.0%
Taylor expanded in x around inf 74.0%
sub-neg74.0%
mul-1-neg74.0%
log-rec74.0%
remove-double-neg74.0%
metadata-eval74.0%
Simplified74.0%
Final simplification62.3%
(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 94.9%
Taylor expanded in z around 0 56.7%
Taylor expanded in x around inf 56.7%
sub-neg98.9%
mul-1-neg98.9%
log-rec98.9%
remove-double-neg98.9%
metadata-eval98.9%
+-commutative98.9%
Simplified56.7%
Final simplification56.7%
(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 94.9%
sub-neg94.9%
associate-+l+94.9%
fma-define95.0%
sub-neg95.0%
metadata-eval95.0%
+-commutative95.0%
unsub-neg95.0%
*-commutative95.0%
fma-define95.0%
fma-neg95.0%
metadata-eval95.0%
Simplified95.0%
Taylor expanded in z around 0 56.8%
Taylor expanded in x around inf 38.9%
sub-neg38.9%
mul-1-neg38.9%
log-rec38.9%
remove-double-neg38.9%
metadata-eval38.9%
Simplified38.9%
(FPCore (x y z) :precision binary64 (+ (+ (+ (* (- x 0.5) (log x)) (- 0.91893853320467 x)) (/ 0.083333333333333 x)) (* (/ z x) (- (* z (+ y 0.0007936500793651)) 0.0027777777777778))))
double code(double x, double y, double z) {
return ((((x - 0.5) * log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((((x - 0.5d0) * log(x)) + (0.91893853320467d0 - x)) + (0.083333333333333d0 / x)) + ((z / x) * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))
end function
public static double code(double x, double y, double z) {
return ((((x - 0.5) * Math.log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
}
def code(x, y, z): return ((((x - 0.5) * math.log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))
function code(x, y, z) return Float64(Float64(Float64(Float64(Float64(x - 0.5) * log(x)) + Float64(0.91893853320467 - x)) + Float64(0.083333333333333 / x)) + Float64(Float64(z / x) * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) end
function tmp = code(x, y, z) tmp = ((((x - 0.5) * log(x)) + (0.91893853320467 - x)) + (0.083333333333333 / x)) + ((z / x) * ((z * (y + 0.0007936500793651)) - 0.0027777777777778)); end
code[x_, y_, z_] := N[(N[(N[(N[(N[(x - 0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] + N[(0.91893853320467 - x), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(z / x), $MachinePrecision] * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x - 0.5\right) \cdot \log x + \left(0.91893853320467 - x\right)\right) + \frac{0.083333333333333}{x}\right) + \frac{z}{x} \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)
\end{array}
herbie shell --seed 2024086
(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)))