
(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 12 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 3e-66)
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x)
(-
(+
0.91893853320467
(+
(* 0.083333333333333 (/ 1.0 x))
(+
(*
z
(+
(* z (+ (* 0.0007936500793651 (/ 1.0 x)) (/ y x)))
(* 0.0027777777777778 (/ -1.0 x))))
(* (log x) (- x 0.5)))))
x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 3e-66) {
tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x;
} else {
tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + ((z * ((z * ((0.0007936500793651 * (1.0 / x)) + (y / x))) + (0.0027777777777778 * (-1.0 / x)))) + (log(x) * (x - 0.5))))) - x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 3d-66) then
tmp = (0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x
else
tmp = (0.91893853320467d0 + ((0.083333333333333d0 * (1.0d0 / x)) + ((z * ((z * ((0.0007936500793651d0 * (1.0d0 / x)) + (y / x))) + (0.0027777777777778d0 * ((-1.0d0) / x)))) + (log(x) * (x - 0.5d0))))) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 3e-66) {
tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x;
} else {
tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + ((z * ((z * ((0.0007936500793651 * (1.0 / x)) + (y / x))) + (0.0027777777777778 * (-1.0 / x)))) + (Math.log(x) * (x - 0.5))))) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 3e-66: tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x else: tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + ((z * ((z * ((0.0007936500793651 * (1.0 / x)) + (y / x))) + (0.0027777777777778 * (-1.0 / x)))) + (math.log(x) * (x - 0.5))))) - x return tmp
function code(x, y, z) tmp = 0.0 if (x <= 3e-66) tmp = Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(0.083333333333333 * Float64(1.0 / x)) + Float64(Float64(z * Float64(Float64(z * Float64(Float64(0.0007936500793651 * Float64(1.0 / x)) + Float64(y / x))) + Float64(0.0027777777777778 * Float64(-1.0 / x)))) + Float64(log(x) * Float64(x - 0.5))))) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 3e-66) tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x; else tmp = (0.91893853320467 + ((0.083333333333333 * (1.0 / x)) + ((z * ((z * ((0.0007936500793651 * (1.0 / x)) + (y / x))) + (0.0027777777777778 * (-1.0 / x)))) + (log(x) * (x - 0.5))))) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 3e-66], N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(0.91893853320467 + N[(N[(0.083333333333333 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(N[(z * N[(N[(z * N[(N[(0.0007936500793651 * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.0027777777777778 * N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3 \cdot 10^{-66}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(0.083333333333333 \cdot \frac{1}{x} + \left(z \cdot \left(z \cdot \left(0.0007936500793651 \cdot \frac{1}{x} + \frac{y}{x}\right) + 0.0027777777777778 \cdot \frac{-1}{x}\right) + \log x \cdot \left(x - 0.5\right)\right)\right)\right) - x\\
\end{array}
\end{array}
if x < 3.0000000000000002e-66Initial program 99.8%
sub-neg99.8%
associate-+l+99.8%
fma-define99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
unsub-neg99.8%
*-commutative99.8%
fma-define99.8%
fma-neg99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 99.8%
if 3.0000000000000002e-66 < x Initial program 93.1%
sub-neg93.1%
associate-+l+93.1%
fma-define93.1%
sub-neg93.1%
metadata-eval93.1%
+-commutative93.1%
unsub-neg93.1%
*-commutative93.1%
fma-define93.1%
fma-neg93.1%
metadata-eval93.1%
Simplified93.1%
Taylor expanded in z around 0 99.7%
Final simplification99.7%
(FPCore (x y z)
:precision binary64
(+
(+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x)))
double code(double x, double y, double z) {
return (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((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 = (0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)) + ((0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / 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 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x);
}
def code(x, y, z): return (0.91893853320467 + ((math.log(x) * (x - 0.5)) - x)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x)
function code(x, y, z) return Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x)) end
function tmp = code(x, y, z) tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / 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[(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}
\\
\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}
\end{array}
Initial program 95.7%
Final simplification95.7%
(FPCore (x y z)
:precision binary64
(+
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x)
(* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
return ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / 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 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x) + (x * (log(x) + (-1.0d0)))
end function
public static double code(double x, double y, double z) {
return ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + (x * (Math.log(x) + -1.0));
}
def code(x, y, z): return ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + (x * (math.log(x) + -1.0))
function code(x, y, z) return Float64(Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x) + Float64(x * Float64(log(x) + -1.0))) end
function tmp = code(x, y, z) tmp = ((0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x) + (x * (log(x) + -1.0)); end
code[x_, y_, z_] := N[(N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x} + x \cdot \left(\log x + -1\right)
\end{array}
Initial program 95.7%
flip--77.9%
metadata-eval77.9%
metadata-eval77.9%
clear-num77.9%
fma-neg77.9%
metadata-eval77.9%
metadata-eval77.9%
Applied egg-rr77.9%
associate-+l-77.9%
associate-*l/77.9%
*-un-lft-identity77.9%
clear-num77.9%
metadata-eval77.9%
metadata-eval77.9%
fma-neg77.9%
flip--95.7%
sub-neg95.7%
metadata-eval95.7%
Applied egg-rr95.7%
clear-num95.6%
inv-pow95.6%
Applied egg-rr95.6%
Taylor expanded in x around inf 95.2%
sub-neg95.2%
log-rec95.2%
neg-mul-195.2%
remove-double-neg95.2%
metadata-eval95.2%
Simplified95.2%
Final simplification95.2%
(FPCore (x y z)
:precision binary64
(if (<= x 1.3e+78)
(/
(+
0.083333333333333
(* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778)))
x)
(* x (+ (log x) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.3e+78) {
tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x;
} else {
tmp = x * (log(x) + -1.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (x <= 1.3d+78) then
tmp = (0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x
else
tmp = x * (log(x) + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 1.3e+78) {
tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x;
} else {
tmp = x * (Math.log(x) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 1.3e+78: tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x else: tmp = x * (math.log(x) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 1.3e+78) tmp = Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x); else tmp = Float64(x * Float64(log(x) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 1.3e+78) tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x; else tmp = x * (log(x) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 1.3e+78], N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(x * N[(N[Log[x], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.3 \cdot 10^{+78}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\log x + -1\right)\\
\end{array}
\end{array}
if x < 1.3e78Initial program 99.2%
sub-neg99.2%
associate-+l+99.2%
fma-define99.2%
sub-neg99.2%
metadata-eval99.2%
+-commutative99.2%
unsub-neg99.2%
*-commutative99.2%
fma-define99.2%
fma-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 93.9%
if 1.3e78 < x Initial program 89.7%
sub-neg89.7%
associate-+l+89.7%
fma-define89.7%
sub-neg89.7%
metadata-eval89.7%
+-commutative89.7%
unsub-neg89.7%
*-commutative89.7%
fma-define89.7%
fma-neg89.7%
metadata-eval89.7%
Simplified89.7%
Taylor expanded in x around inf 84.5%
sub-neg84.5%
mul-1-neg84.5%
log-rec84.5%
remove-double-neg84.5%
metadata-eval84.5%
Simplified84.5%
(FPCore (x y z)
:precision binary64
(if (or (<= y -6.5e+18) (not (<= y 1e-11)))
(/ (+ 0.083333333333333 (* z (- (* z y) 0.0027777777777778))) x)
(/
(+ 0.083333333333333 (* z (- (* z 0.0007936500793651) 0.0027777777777778)))
x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e+18) || !(y <= 1e-11)) {
tmp = (0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x;
} else {
tmp = (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 <= (-6.5d+18)) .or. (.not. (y <= 1d-11))) then
tmp = (0.083333333333333d0 + (z * ((z * y) - 0.0027777777777778d0))) / x
else
tmp = (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 <= -6.5e+18) || !(y <= 1e-11)) {
tmp = (0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x;
} else {
tmp = (0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.5e+18) or not (y <= 1e-11): tmp = (0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x else: tmp = (0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.5e+18) || !(y <= 1e-11)) tmp = Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * y) - 0.0027777777777778))) / x); else tmp = 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 <= -6.5e+18) || ~((y <= 1e-11))) tmp = (0.083333333333333 + (z * ((z * y) - 0.0027777777777778))) / x; else tmp = (0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.5e+18], N[Not[LessEqual[y, 1e-11]], $MachinePrecision]], N[(N[(0.083333333333333 + N[(z * N[(N[(z * y), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(0.083333333333333 + N[(z * N[(N[(z * 0.0007936500793651), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+18} \lor \neg \left(y \leq 10^{-11}\right):\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot y - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right)}{x}\\
\end{array}
\end{array}
if y < -6.5e18 or 9.99999999999999939e-12 < y Initial program 94.7%
sub-neg94.7%
associate-+l+94.7%
fma-define94.7%
sub-neg94.7%
metadata-eval94.7%
+-commutative94.7%
unsub-neg94.7%
*-commutative94.7%
fma-define94.7%
fma-neg94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in x around 0 66.1%
Taylor expanded in y around inf 65.8%
*-commutative65.8%
Simplified65.8%
if -6.5e18 < y < 9.99999999999999939e-12Initial program 96.7%
sub-neg96.7%
associate-+l+96.7%
fma-define96.8%
sub-neg96.8%
metadata-eval96.8%
+-commutative96.8%
unsub-neg96.8%
*-commutative96.8%
fma-define96.8%
fma-neg96.7%
metadata-eval96.7%
Simplified96.7%
Taylor expanded in x around 0 64.1%
Taylor expanded in y around 0 63.9%
*-commutative63.9%
Simplified63.9%
Final simplification64.9%
(FPCore (x y z)
:precision binary64
(if (or (<= y -1.06e+28) (not (<= y 1.45e+188)))
(* y (/ (* z z) x))
(/
(+ 0.083333333333333 (* z (- (* z 0.0007936500793651) 0.0027777777777778)))
x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.06e+28) || !(y <= 1.45e+188)) {
tmp = y * ((z * z) / x);
} else {
tmp = (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 <= (-1.06d+28)) .or. (.not. (y <= 1.45d+188))) then
tmp = y * ((z * z) / x)
else
tmp = (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 <= -1.06e+28) || !(y <= 1.45e+188)) {
tmp = y * ((z * z) / x);
} else {
tmp = (0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.06e+28) or not (y <= 1.45e+188): tmp = y * ((z * z) / x) else: tmp = (0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.06e+28) || !(y <= 1.45e+188)) tmp = Float64(y * Float64(Float64(z * z) / x)); else tmp = 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 <= -1.06e+28) || ~((y <= 1.45e+188))) tmp = y * ((z * z) / x); else tmp = (0.083333333333333 + (z * ((z * 0.0007936500793651) - 0.0027777777777778))) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.06e+28], N[Not[LessEqual[y, 1.45e+188]], $MachinePrecision]], N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(0.083333333333333 + N[(z * N[(N[(z * 0.0007936500793651), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{+28} \lor \neg \left(y \leq 1.45 \cdot 10^{+188}\right):\\
\;\;\;\;y \cdot \frac{z \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot 0.0007936500793651 - 0.0027777777777778\right)}{x}\\
\end{array}
\end{array}
if y < -1.0600000000000001e28 or 1.45e188 < y Initial program 95.5%
sub-neg95.5%
associate-+l+95.5%
fma-define95.5%
sub-neg95.5%
metadata-eval95.5%
+-commutative95.5%
unsub-neg95.5%
*-commutative95.5%
fma-define95.5%
fma-neg95.5%
metadata-eval95.5%
Simplified95.5%
Taylor expanded in y around inf 51.6%
associate-/l*51.5%
Simplified51.5%
unpow251.5%
Applied egg-rr51.5%
if -1.0600000000000001e28 < y < 1.45e188Initial program 95.8%
sub-neg95.8%
associate-+l+95.8%
fma-define95.8%
sub-neg95.8%
metadata-eval95.8%
+-commutative95.8%
unsub-neg95.8%
*-commutative95.8%
fma-define95.8%
fma-neg95.8%
metadata-eval95.8%
Simplified95.8%
Taylor expanded in x around 0 65.2%
Taylor expanded in y around 0 62.9%
*-commutative62.9%
Simplified62.9%
Final simplification58.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -115000000.0) (not (<= z 2.5e-29))) (* y (/ (* z z) x)) (/ (+ 0.083333333333333 (* z -0.0027777777777778)) x)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -115000000.0) || !(z <= 2.5e-29)) {
tmp = y * ((z * z) / x);
} else {
tmp = (0.083333333333333 + (z * -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 ((z <= (-115000000.0d0)) .or. (.not. (z <= 2.5d-29))) then
tmp = y * ((z * z) / x)
else
tmp = (0.083333333333333d0 + (z * (-0.0027777777777778d0))) / x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -115000000.0) || !(z <= 2.5e-29)) {
tmp = y * ((z * z) / x);
} else {
tmp = (0.083333333333333 + (z * -0.0027777777777778)) / x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -115000000.0) or not (z <= 2.5e-29): tmp = y * ((z * z) / x) else: tmp = (0.083333333333333 + (z * -0.0027777777777778)) / x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -115000000.0) || !(z <= 2.5e-29)) tmp = Float64(y * Float64(Float64(z * z) / x)); else tmp = Float64(Float64(0.083333333333333 + Float64(z * -0.0027777777777778)) / x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -115000000.0) || ~((z <= 2.5e-29))) tmp = y * ((z * z) / x); else tmp = (0.083333333333333 + (z * -0.0027777777777778)) / x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -115000000.0], N[Not[LessEqual[z, 2.5e-29]], $MachinePrecision]], N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(0.083333333333333 + N[(z * -0.0027777777777778), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -115000000 \lor \neg \left(z \leq 2.5 \cdot 10^{-29}\right):\\
\;\;\;\;y \cdot \frac{z \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot -0.0027777777777778}{x}\\
\end{array}
\end{array}
if z < -1.15e8 or 2.49999999999999993e-29 < z Initial program 92.2%
sub-neg92.2%
associate-+l+92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
+-commutative92.2%
unsub-neg92.2%
*-commutative92.2%
fma-define92.2%
fma-neg92.2%
metadata-eval92.2%
Simplified92.2%
Taylor expanded in y around inf 51.5%
associate-/l*56.1%
Simplified56.1%
unpow256.1%
Applied egg-rr56.1%
if -1.15e8 < z < 2.49999999999999993e-29Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
unsub-neg99.6%
*-commutative99.6%
fma-define99.6%
fma-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 52.4%
Taylor expanded in z around 0 48.2%
*-commutative48.2%
Simplified48.2%
Final simplification52.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -115000000.0) (not (<= z 1.95e-26))) (* y (/ (* z z) x)) (/ 1.0 (* x 12.000000000000048))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -115000000.0) || !(z <= 1.95e-26)) {
tmp = y * ((z * z) / x);
} else {
tmp = 1.0 / (x * 12.000000000000048);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-115000000.0d0)) .or. (.not. (z <= 1.95d-26))) then
tmp = y * ((z * z) / x)
else
tmp = 1.0d0 / (x * 12.000000000000048d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -115000000.0) || !(z <= 1.95e-26)) {
tmp = y * ((z * z) / x);
} else {
tmp = 1.0 / (x * 12.000000000000048);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -115000000.0) or not (z <= 1.95e-26): tmp = y * ((z * z) / x) else: tmp = 1.0 / (x * 12.000000000000048) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -115000000.0) || !(z <= 1.95e-26)) tmp = Float64(y * Float64(Float64(z * z) / x)); else tmp = Float64(1.0 / Float64(x * 12.000000000000048)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -115000000.0) || ~((z <= 1.95e-26))) tmp = y * ((z * z) / x); else tmp = 1.0 / (x * 12.000000000000048); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -115000000.0], N[Not[LessEqual[z, 1.95e-26]], $MachinePrecision]], N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(x * 12.000000000000048), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -115000000 \lor \neg \left(z \leq 1.95 \cdot 10^{-26}\right):\\
\;\;\;\;y \cdot \frac{z \cdot z}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot 12.000000000000048}\\
\end{array}
\end{array}
if z < -1.15e8 or 1.94999999999999993e-26 < z Initial program 92.2%
sub-neg92.2%
associate-+l+92.2%
fma-define92.2%
sub-neg92.2%
metadata-eval92.2%
+-commutative92.2%
unsub-neg92.2%
*-commutative92.2%
fma-define92.2%
fma-neg92.2%
metadata-eval92.2%
Simplified92.2%
Taylor expanded in y around inf 51.5%
associate-/l*56.1%
Simplified56.1%
unpow256.1%
Applied egg-rr56.1%
if -1.15e8 < z < 1.94999999999999993e-26Initial program 99.6%
sub-neg99.6%
associate-+l+99.6%
fma-define99.6%
sub-neg99.6%
metadata-eval99.6%
+-commutative99.6%
unsub-neg99.6%
*-commutative99.6%
fma-define99.6%
fma-neg99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around 0 52.4%
Taylor expanded in z around 0 47.9%
clear-num47.9%
inv-pow47.9%
Applied egg-rr47.9%
unpow-147.9%
div-inv48.0%
metadata-eval48.0%
Applied egg-rr48.0%
Final simplification52.3%
(FPCore (x y z) :precision binary64 (/ (+ 0.083333333333333 (* z (- (* z (+ 0.0007936500793651 y)) 0.0027777777777778))) x))
double code(double x, double y, double z) {
return (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 = (0.083333333333333d0 + (z * ((z * (0.0007936500793651d0 + y)) - 0.0027777777777778d0))) / x
end function
public static double code(double x, double y, double z) {
return (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x;
}
def code(x, y, z): return (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x
function code(x, y, z) return Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(0.0007936500793651 + y)) - 0.0027777777777778))) / x) end
function tmp = code(x, y, z) tmp = (0.083333333333333 + (z * ((z * (0.0007936500793651 + y)) - 0.0027777777777778))) / x; end
code[x_, y_, z_] := N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(0.0007936500793651 + y), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.083333333333333 + z \cdot \left(z \cdot \left(0.0007936500793651 + y\right) - 0.0027777777777778\right)}{x}
\end{array}
Initial program 95.7%
sub-neg95.7%
associate-+l+95.7%
fma-define95.7%
sub-neg95.7%
metadata-eval95.7%
+-commutative95.7%
unsub-neg95.7%
*-commutative95.7%
fma-define95.7%
fma-neg95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in x around 0 65.1%
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) 12.000000000000048))
double code(double x, double y, double z) {
return (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 = (1.0d0 / x) / 12.000000000000048d0
end function
public static double code(double x, double y, double z) {
return (1.0 / x) / 12.000000000000048;
}
def code(x, y, z): return (1.0 / x) / 12.000000000000048
function code(x, y, z) return Float64(Float64(1.0 / x) / 12.000000000000048) end
function tmp = code(x, y, z) tmp = (1.0 / x) / 12.000000000000048; end
code[x_, y_, z_] := N[(N[(1.0 / x), $MachinePrecision] / 12.000000000000048), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x}}{12.000000000000048}
\end{array}
Initial program 95.7%
sub-neg95.7%
associate-+l+95.7%
fma-define95.7%
sub-neg95.7%
metadata-eval95.7%
+-commutative95.7%
unsub-neg95.7%
*-commutative95.7%
fma-define95.7%
fma-neg95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in x around 0 65.1%
Taylor expanded in z around 0 25.0%
clear-num24.9%
inv-pow24.9%
Applied egg-rr24.9%
unpow-124.9%
div-inv25.0%
associate-/r*25.0%
metadata-eval25.0%
Applied egg-rr25.0%
(FPCore (x y z) :precision binary64 (/ 1.0 (* x 12.000000000000048)))
double code(double x, double y, double z) {
return 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 = 1.0d0 / (x * 12.000000000000048d0)
end function
public static double code(double x, double y, double z) {
return 1.0 / (x * 12.000000000000048);
}
def code(x, y, z): return 1.0 / (x * 12.000000000000048)
function code(x, y, z) return Float64(1.0 / Float64(x * 12.000000000000048)) end
function tmp = code(x, y, z) tmp = 1.0 / (x * 12.000000000000048); end
code[x_, y_, z_] := N[(1.0 / N[(x * 12.000000000000048), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{x \cdot 12.000000000000048}
\end{array}
Initial program 95.7%
sub-neg95.7%
associate-+l+95.7%
fma-define95.7%
sub-neg95.7%
metadata-eval95.7%
+-commutative95.7%
unsub-neg95.7%
*-commutative95.7%
fma-define95.7%
fma-neg95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in x around 0 65.1%
Taylor expanded in z around 0 25.0%
clear-num24.9%
inv-pow24.9%
Applied egg-rr24.9%
unpow-124.9%
div-inv25.0%
metadata-eval25.0%
Applied egg-rr25.0%
(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 95.7%
sub-neg95.7%
associate-+l+95.7%
fma-define95.7%
sub-neg95.7%
metadata-eval95.7%
+-commutative95.7%
unsub-neg95.7%
*-commutative95.7%
fma-define95.7%
fma-neg95.7%
metadata-eval95.7%
Simplified95.7%
Taylor expanded in x around 0 65.1%
Taylor expanded in z around 0 25.0%
(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 2024139
(FPCore (x y z)
:name "Numeric.SpecFunctions:$slogFactorial from math-functions-0.1.5.2, B"
:precision binary64
:alt
(! :herbie-platform default (+ (+ (+ (* (- x 1/2) (log x)) (- 91893853320467/100000000000000 x)) (/ 83333333333333/1000000000000000 x)) (* (/ z x) (- (* z (+ y 7936500793651/10000000000000000)) 13888888888889/5000000000000000))))
(+ (+ (- (* (- x 0.5) (log x)) x) 0.91893853320467) (/ (+ (* (- (* (+ y 0.0007936500793651) z) 0.0027777777777778) z) 0.083333333333333) x)))