
(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 1.9e-48)
(+
(fma -0.5 (log x) 0.91893853320467)
(/
1.0
(/
x
(fma
z
(fma (+ y 0.0007936500793651) z -0.0027777777777778)
0.083333333333333))))
(+
0.91893853320467
(fma
z
(fma z (/ y x) (/ (fma z 0.0007936500793651 -0.0027777777777778) x))
(fma (log x) (+ x -0.5) (- (/ 0.083333333333333 x) x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1.9e-48) {
tmp = fma(-0.5, log(x), 0.91893853320467) + (1.0 / (x / fma(z, fma((y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333)));
} else {
tmp = 0.91893853320467 + fma(z, fma(z, (y / x), (fma(z, 0.0007936500793651, -0.0027777777777778) / x)), fma(log(x), (x + -0.5), ((0.083333333333333 / x) - x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1.9e-48) tmp = Float64(fma(-0.5, log(x), 0.91893853320467) + Float64(1.0 / Float64(x / fma(z, fma(Float64(y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333)))); else tmp = Float64(0.91893853320467 + fma(z, fma(z, Float64(y / x), Float64(fma(z, 0.0007936500793651, -0.0027777777777778) / x)), fma(log(x), Float64(x + -0.5), Float64(Float64(0.083333333333333 / x) - x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1.9e-48], N[(N[(-0.5 * N[Log[x], $MachinePrecision] + 0.91893853320467), $MachinePrecision] + N[(1.0 / N[(x / N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.91893853320467 + N[(z * N[(z * N[(y / x), $MachinePrecision] + N[(N[(z * 0.0007936500793651 + -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.9 \cdot 10^{-48}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, \log x, 0.91893853320467\right) + \frac{1}{\frac{x}{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}}\\
\mathbf{else}:\\
\;\;\;\;0.91893853320467 + \mathsf{fma}\left(z, \mathsf{fma}\left(z, \frac{y}{x}, \frac{\mathsf{fma}\left(z, 0.0007936500793651, -0.0027777777777778\right)}{x}\right), \mathsf{fma}\left(\log x, x + -0.5, \frac{0.083333333333333}{x} - x\right)\right)\\
\end{array}
\end{array}
if x < 1.90000000000000001e-48Initial program 99.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.7
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.7
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
metadata-eval99.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
remove-double-negN/A
log-recN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f6499.7
Applied rewrites99.7%
if 1.90000000000000001e-48 < x Initial program 90.9%
Taylor expanded in z around 0
Applied rewrites99.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 0.91893853320467 (- (* (log x) (- x 0.5)) x)))
(t_1
(+
t_0
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x))))
(if (<= t_1 -2e+44)
(* z (/ (* z y) x))
(if (<= t_1 5e+306)
(+ t_0 (/ 1.0 (* x 12.000000000000048)))
(* (+ (/ y x) (/ 0.0007936500793651 x)) (* z z))))))
double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x);
double t_1 = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
double tmp;
if (t_1 <= -2e+44) {
tmp = z * ((z * y) / x);
} else if (t_1 <= 5e+306) {
tmp = t_0 + (1.0 / (x * 12.000000000000048));
} else {
tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)
t_1 = t_0 + ((0.083333333333333d0 + (z * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))) / x)
if (t_1 <= (-2d+44)) then
tmp = z * ((z * y) / x)
else if (t_1 <= 5d+306) then
tmp = t_0 + (1.0d0 / (x * 12.000000000000048d0))
else
tmp = ((y / x) + (0.0007936500793651d0 / x)) * (z * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x);
double t_1 = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
double tmp;
if (t_1 <= -2e+44) {
tmp = z * ((z * y) / x);
} else if (t_1 <= 5e+306) {
tmp = t_0 + (1.0 / (x * 12.000000000000048));
} else {
tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z);
}
return tmp;
}
def code(x, y, z): t_0 = 0.91893853320467 + ((math.log(x) * (x - 0.5)) - x) t_1 = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) tmp = 0 if t_1 <= -2e+44: tmp = z * ((z * y) / x) elif t_1 <= 5e+306: tmp = t_0 + (1.0 / (x * 12.000000000000048)) else: tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z) return tmp
function code(x, y, z) t_0 = Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) t_1 = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x)) tmp = 0.0 if (t_1 <= -2e+44) tmp = Float64(z * Float64(Float64(z * y) / x)); elseif (t_1 <= 5e+306) tmp = Float64(t_0 + Float64(1.0 / Float64(x * 12.000000000000048))); else tmp = Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * Float64(z * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x); t_1 = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x); tmp = 0.0; if (t_1 <= -2e+44) tmp = z * ((z * y) / x); elseif (t_1 <= 5e+306) tmp = t_0 + (1.0 / (x * 12.000000000000048)); else tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+44], N[(z * N[(N[(z * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+306], N[(t$95$0 + N[(1.0 / N[(x * 12.000000000000048), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\\
t_1 := t\_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+44}:\\
\;\;\;\;z \cdot \frac{z \cdot y}{x}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;t\_0 + \frac{1}{x \cdot 12.000000000000048}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -2.0000000000000002e44Initial program 90.8%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6490.7
Applied rewrites90.7%
Applied rewrites94.5%
if -2.0000000000000002e44 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.99999999999999993e306Initial program 99.5%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.5
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6499.5
lift--.f64N/A
sub-negN/A
lift-*.f64N/A
lower-fma.f64N/A
metadata-eval99.5
Applied rewrites99.5%
Taylor expanded in z around 0
*-commutativeN/A
lower-*.f6488.4
Applied rewrites88.4%
if 4.99999999999999993e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 83.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6486.2
Applied rewrites86.2%
Final simplification88.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x))))
(if (<= t_0 -2e+44)
(* z (/ (* z y) x))
(if (<= t_0 5e+306)
(+
0.91893853320467
(fma (log x) (+ x -0.5) (- (/ 0.083333333333333 x) x)))
(* (+ (/ y x) (/ 0.0007936500793651 x)) (* z z))))))
double code(double x, double y, double z) {
double t_0 = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
double tmp;
if (t_0 <= -2e+44) {
tmp = z * ((z * y) / x);
} else if (t_0 <= 5e+306) {
tmp = 0.91893853320467 + fma(log(x), (x + -0.5), ((0.083333333333333 / x) - x));
} else {
tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x)) tmp = 0.0 if (t_0 <= -2e+44) tmp = Float64(z * Float64(Float64(z * y) / x)); elseif (t_0 <= 5e+306) tmp = Float64(0.91893853320467 + fma(log(x), Float64(x + -0.5), Float64(Float64(0.083333333333333 / x) - x))); else tmp = Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * Float64(z * z)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = 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[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+44], N[(z * N[(N[(z * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+306], N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+44}:\\
\;\;\;\;z \cdot \frac{z \cdot y}{x}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;0.91893853320467 + \mathsf{fma}\left(\log x, x + -0.5, \frac{0.083333333333333}{x} - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -2.0000000000000002e44Initial program 90.8%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6490.7
Applied rewrites90.7%
Applied rewrites94.5%
if -2.0000000000000002e44 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.99999999999999993e306Initial program 99.5%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f645.1
Applied rewrites5.1%
Applied rewrites4.7%
Taylor expanded in z around 0
associate--l+N/A
lower-+.f64N/A
+-commutativeN/A
associate--l+N/A
lower-fma.f64N/A
lower-log.f64N/A
sub-negN/A
metadata-evalN/A
lower-+.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6488.4
Applied rewrites88.4%
if 4.99999999999999993e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 83.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6486.2
Applied rewrites86.2%
Final simplification88.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x))))
(if (<= t_0 -2e+44)
(* z (/ (* z y) x))
(if (<= t_0 5e+306)
(+ (+ 0.91893853320467 (- (* x (log x)) x)) (/ 0.083333333333333 x))
(* (+ (/ y x) (/ 0.0007936500793651 x)) (* z z))))))
double code(double x, double y, double z) {
double t_0 = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
double tmp;
if (t_0 <= -2e+44) {
tmp = z * ((z * y) / x);
} else if (t_0 <= 5e+306) {
tmp = (0.91893853320467 + ((x * log(x)) - x)) + (0.083333333333333 / x);
} else {
tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = (0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)) + ((0.083333333333333d0 + (z * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))) / x)
if (t_0 <= (-2d+44)) then
tmp = z * ((z * y) / x)
else if (t_0 <= 5d+306) then
tmp = (0.91893853320467d0 + ((x * log(x)) - x)) + (0.083333333333333d0 / x)
else
tmp = ((y / x) + (0.0007936500793651d0 / x)) * (z * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x)) + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
double tmp;
if (t_0 <= -2e+44) {
tmp = z * ((z * y) / x);
} else if (t_0 <= 5e+306) {
tmp = (0.91893853320467 + ((x * Math.log(x)) - x)) + (0.083333333333333 / x);
} else {
tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z);
}
return tmp;
}
def code(x, y, z): t_0 = (0.91893853320467 + ((math.log(x) * (x - 0.5)) - x)) + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) tmp = 0 if t_0 <= -2e+44: tmp = z * ((z * y) / x) elif t_0 <= 5e+306: tmp = (0.91893853320467 + ((x * math.log(x)) - x)) + (0.083333333333333 / x) else: tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z) return tmp
function code(x, y, z) t_0 = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x)) tmp = 0.0 if (t_0 <= -2e+44) tmp = Float64(z * Float64(Float64(z * y) / x)); elseif (t_0 <= 5e+306) tmp = Float64(Float64(0.91893853320467 + Float64(Float64(x * log(x)) - x)) + Float64(0.083333333333333 / x)); else tmp = Float64(Float64(Float64(y / x) + Float64(0.0007936500793651 / x)) * Float64(z * z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x); tmp = 0.0; if (t_0 <= -2e+44) tmp = z * ((z * y) / x); elseif (t_0 <= 5e+306) tmp = (0.91893853320467 + ((x * log(x)) - x)) + (0.083333333333333 / x); else tmp = ((y / x) + (0.0007936500793651 / x)) * (z * z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = 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[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e+44], N[(z * N[(N[(z * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+306], N[(N[(0.91893853320467 + N[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(0.083333333333333 / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / x), $MachinePrecision] + N[(0.0007936500793651 / x), $MachinePrecision]), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{+44}:\\
\;\;\;\;z \cdot \frac{z \cdot y}{x}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+306}:\\
\;\;\;\;\left(0.91893853320467 + \left(x \cdot \log x - x\right)\right) + \frac{0.083333333333333}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{y}{x} + \frac{0.0007936500793651}{x}\right) \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < -2.0000000000000002e44Initial program 90.8%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6490.7
Applied rewrites90.7%
Applied rewrites94.5%
if -2.0000000000000002e44 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) < 4.99999999999999993e306Initial program 99.5%
Taylor expanded in z around 0
Applied rewrites88.4%
Taylor expanded in x around inf
mul-1-negN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f6486.9
Applied rewrites86.9%
if 4.99999999999999993e306 < (+.f64 (+.f64 (-.f64 (*.f64 (-.f64 x #s(literal 1/2 binary64)) (log.f64 x)) x) #s(literal 91893853320467/100000000000000 binary64)) (/.f64 (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) x)) Initial program 83.6%
Taylor expanded in z around inf
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6486.2
Applied rewrites86.2%
Final simplification87.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))))
(if (<= x 430.0)
(+
t_0
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x))
(+ t_0 (* z (* z (/ (+ y 0.0007936500793651) x)))))))
double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x);
double tmp;
if (x <= 430.0) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
} else {
tmp = t_0 + (z * (z * ((y + 0.0007936500793651) / x)));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = 0.91893853320467d0 + ((log(x) * (x - 0.5d0)) - x)
if (x <= 430.0d0) then
tmp = t_0 + ((0.083333333333333d0 + (z * ((z * (y + 0.0007936500793651d0)) - 0.0027777777777778d0))) / x)
else
tmp = t_0 + (z * (z * ((y + 0.0007936500793651d0) / x)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 0.91893853320467 + ((Math.log(x) * (x - 0.5)) - x);
double tmp;
if (x <= 430.0) {
tmp = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
} else {
tmp = t_0 + (z * (z * ((y + 0.0007936500793651) / x)));
}
return tmp;
}
def code(x, y, z): t_0 = 0.91893853320467 + ((math.log(x) * (x - 0.5)) - x) tmp = 0 if x <= 430.0: tmp = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) else: tmp = t_0 + (z * (z * ((y + 0.0007936500793651) / x))) return tmp
function code(x, y, z) t_0 = Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) tmp = 0.0 if (x <= 430.0) tmp = Float64(t_0 + Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x)); else tmp = Float64(t_0 + Float64(z * Float64(z * Float64(Float64(y + 0.0007936500793651) / x)))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = 0.91893853320467 + ((log(x) * (x - 0.5)) - x); tmp = 0.0; if (x <= 430.0) tmp = t_0 + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x); else tmp = t_0 + (z * (z * ((y + 0.0007936500793651) / x))); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 430.0], N[(t$95$0 + N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(z * N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\\
\mathbf{if}\;x \leq 430:\\
\;\;\;\;t\_0 + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + z \cdot \left(z \cdot \frac{y + 0.0007936500793651}{x}\right)\\
\end{array}
\end{array}
if x < 430Initial program 99.7%
if 430 < x Initial program 89.6%
Taylor expanded in y around inf
Applied rewrites92.9%
Taylor expanded in y around inf
Applied rewrites86.0%
Taylor expanded in z around inf
Applied rewrites99.6%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(if (<= x 3e+15)
(/
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
(fma
x
(+ 0.91893853320467 (fma (log x) (+ x -0.5) (- x)))
0.083333333333333))
x)
(+
(+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))
(* z (* z (/ (+ y 0.0007936500793651) x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 3e+15) {
tmp = fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), fma(x, (0.91893853320467 + fma(log(x), (x + -0.5), -x)), 0.083333333333333)) / x;
} else {
tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + (z * (z * ((y + 0.0007936500793651) / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 3e+15) tmp = Float64(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), fma(x, Float64(0.91893853320467 + fma(log(x), Float64(x + -0.5), Float64(-x))), 0.083333333333333)) / x); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(z * Float64(z * Float64(Float64(y + 0.0007936500793651) / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 3e+15], N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + N[(x * N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision] + (-x)), $MachinePrecision]), $MachinePrecision] + 0.083333333333333), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(z * N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3 \cdot 10^{+15}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), \mathsf{fma}\left(x, 0.91893853320467 + \mathsf{fma}\left(\log x, x + -0.5, -x\right), 0.083333333333333\right)\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + z \cdot \left(z \cdot \frac{y + 0.0007936500793651}{x}\right)\\
\end{array}
\end{array}
if x < 3e15Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites99.7%
if 3e15 < x Initial program 89.2%
Taylor expanded in y around inf
Applied rewrites92.6%
Taylor expanded in y around inf
Applied rewrites86.9%
Taylor expanded in z around inf
Applied rewrites99.6%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(if (<= x 2e-7)
(+
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x)
(fma (log x) -0.5 0.91893853320467))
(+
(+ 0.91893853320467 (- (* (log x) (- x 0.5)) x))
(* z (* z (/ (+ y 0.0007936500793651) x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2e-7) {
tmp = ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x) + fma(log(x), -0.5, 0.91893853320467);
} else {
tmp = (0.91893853320467 + ((log(x) * (x - 0.5)) - x)) + (z * (z * ((y + 0.0007936500793651) / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 2e-7) tmp = Float64(Float64(Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) / x) + fma(log(x), -0.5, 0.91893853320467)); else tmp = Float64(Float64(0.91893853320467 + Float64(Float64(log(x) * Float64(x - 0.5)) - x)) + Float64(z * Float64(z * Float64(Float64(y + 0.0007936500793651) / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 2e-7], N[(N[(N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] + N[(N[Log[x], $MachinePrecision] * -0.5 + 0.91893853320467), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 + N[(N[(N[Log[x], $MachinePrecision] * N[(x - 0.5), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision] + N[(z * N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x} + \mathsf{fma}\left(\log x, -0.5, 0.91893853320467\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 + \left(\log x \cdot \left(x - 0.5\right) - x\right)\right) + z \cdot \left(z \cdot \frac{y + 0.0007936500793651}{x}\right)\\
\end{array}
\end{array}
if x < 1.9999999999999999e-7Initial program 99.7%
Taylor expanded in x around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f6499.7
Applied rewrites99.7%
if 1.9999999999999999e-7 < x Initial program 90.1%
Taylor expanded in y around inf
Applied rewrites93.2%
Taylor expanded in y around inf
Applied rewrites85.2%
Taylor expanded in z around inf
Applied rewrites98.7%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(if (<= x 2.8e+38)
(/
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
0.083333333333333)
x)
(fma x (log x) (- x))))
double code(double x, double y, double z) {
double tmp;
if (x <= 2.8e+38) {
tmp = fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x;
} else {
tmp = fma(x, log(x), -x);
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 2.8e+38) tmp = Float64(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x); else tmp = fma(x, log(x), Float64(-x)); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 2.8e+38], N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(x * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.8 \cdot 10^{+38}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \log x, -x\right)\\
\end{array}
\end{array}
if x < 2.8e38Initial program 99.7%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-+.f6494.3
Applied rewrites94.3%
if 2.8e38 < x Initial program 87.7%
Taylor expanded in x around inf
sub-negN/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
metadata-evalN/A
distribute-lft-inN/A
*-commutativeN/A
neg-mul-1N/A
lower-fma.f64N/A
lower-log.f64N/A
lower-neg.f6475.0
Applied rewrites75.0%
Final simplification85.6%
(FPCore (x y z) :precision binary64 (/ (fma z (fma z (+ y 0.0007936500793651) -0.0027777777777778) 0.083333333333333) x))
double code(double x, double y, double z) {
return fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x;
}
function code(x, y, z) return Float64(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x) end
code[x_, y_, z_] := N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), 0.083333333333333\right)}{x}
\end{array}
Initial program 94.3%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
lower-+.f6461.7
Applied rewrites61.7%
Final simplification61.7%
(FPCore (x y z) :precision binary64 (* y (/ (* z z) x)))
double code(double x, double y, double z) {
return y * ((z * z) / x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = y * ((z * z) / x)
end function
public static double code(double x, double y, double z) {
return y * ((z * z) / x);
}
def code(x, y, z): return y * ((z * z) / x)
function code(x, y, z) return Float64(y * Float64(Float64(z * z) / x)) end
function tmp = code(x, y, z) tmp = y * ((z * z) / x); end
code[x_, y_, z_] := N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{z \cdot z}{x}
\end{array}
Initial program 94.3%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6425.9
Applied rewrites25.9%
Applied rewrites27.0%
Applied rewrites29.1%
Final simplification29.1%
(FPCore (x y z) :precision binary64 (* (/ y x) (* z z)))
double code(double x, double y, double z) {
return (y / x) * (z * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (y / x) * (z * z)
end function
public static double code(double x, double y, double z) {
return (y / x) * (z * z);
}
def code(x, y, z): return (y / x) * (z * z)
function code(x, y, z) return Float64(Float64(y / x) * Float64(z * z)) end
function tmp = code(x, y, z) tmp = (y / x) * (z * z); end
code[x_, y_, z_] := N[(N[(y / x), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{x} \cdot \left(z \cdot z\right)
\end{array}
Initial program 94.3%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6425.9
Applied rewrites25.9%
Applied rewrites28.1%
Final simplification28.1%
(FPCore (x y z) :precision binary64 (* (* z y) (/ z x)))
double code(double x, double y, double z) {
return (z * y) * (z / x);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z * y) * (z / x)
end function
public static double code(double x, double y, double z) {
return (z * y) * (z / x);
}
def code(x, y, z): return (z * y) * (z / x)
function code(x, y, z) return Float64(Float64(z * y) * Float64(z / x)) end
function tmp = code(x, y, z) tmp = (z * y) * (z / x); end
code[x_, y_, z_] := N[(N[(z * y), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(z \cdot y\right) \cdot \frac{z}{x}
\end{array}
Initial program 94.3%
Taylor expanded in y around inf
lower-/.f64N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6425.9
Applied rewrites25.9%
Applied rewrites27.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 2024228
(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)))