
(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 18 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 5e+24)
(/
1.0
(/
x
(fma
x
(- (fma (+ x -0.5) (log x) 0.91893853320467) x)
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
0.083333333333333))))
(+
(- 0.91893853320467 (+ x (* (log x) (- 0.5 x))))
(* z (* z (/ (+ y 0.0007936500793651) x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5e+24) {
tmp = 1.0 / (x / fma(x, (fma((x + -0.5), log(x), 0.91893853320467) - x), fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333)));
} else {
tmp = (0.91893853320467 - (x + (log(x) * (0.5 - x)))) + (z * (z * ((y + 0.0007936500793651) / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 5e+24) tmp = Float64(1.0 / Float64(x / fma(x, Float64(fma(Float64(x + -0.5), log(x), 0.91893853320467) - x), fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333)))); else tmp = Float64(Float64(0.91893853320467 - Float64(x + Float64(log(x) * Float64(0.5 - x)))) + Float64(z * Float64(z * Float64(Float64(y + 0.0007936500793651) / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 5e+24], N[(1.0 / N[(x / N[(x * N[(N[(N[(x + -0.5), $MachinePrecision] * N[Log[x], $MachinePrecision] + 0.91893853320467), $MachinePrecision] - x), $MachinePrecision] + N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 - N[(x + N[(N[Log[x], $MachinePrecision] * N[(0.5 - x), $MachinePrecision]), $MachinePrecision]), $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 5 \cdot 10^{+24}:\\
\;\;\;\;\frac{1}{\frac{x}{\mathsf{fma}\left(x, \mathsf{fma}\left(x + -0.5, \log x, 0.91893853320467\right) - x, \mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), 0.083333333333333\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 - \left(x + \log x \cdot \left(0.5 - x\right)\right)\right) + z \cdot \left(z \cdot \frac{y + 0.0007936500793651}{x}\right)\\
\end{array}
\end{array}
if x < 5.00000000000000045e24Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites99.6%
Applied rewrites99.7%
if 5.00000000000000045e24 < x Initial program 87.2%
Taylor expanded in z around inf
associate-/l*N/A
unpow2N/A
associate-*l*N/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
(- 0.91893853320467 (+ x (* (log x) (- 0.5 x))))
(/
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
x))))
(if (<= t_0 -1e+163)
(* (* y z) (/ z x))
(if (<= t_0 INFINITY)
(+
0.91893853320467
(fma (log x) (+ x -0.5) (- (/ 0.083333333333333 x) x)))
(* z (* z (+ (/ 0.0007936500793651 x) (/ y x))))))))
double code(double x, double y, double z) {
double t_0 = (0.91893853320467 - (x + (log(x) * (0.5 - x)))) + ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) / x);
double tmp;
if (t_0 <= -1e+163) {
tmp = (y * z) * (z / x);
} else if (t_0 <= ((double) INFINITY)) {
tmp = 0.91893853320467 + fma(log(x), (x + -0.5), ((0.083333333333333 / x) - x));
} else {
tmp = z * (z * ((0.0007936500793651 / x) + (y / x)));
}
return tmp;
}
function code(x, y, z) t_0 = Float64(Float64(0.91893853320467 - Float64(x + Float64(log(x) * Float64(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 <= -1e+163) tmp = Float64(Float64(y * z) * Float64(z / x)); elseif (t_0 <= Inf) tmp = Float64(0.91893853320467 + fma(log(x), Float64(x + -0.5), Float64(Float64(0.083333333333333 / x) - x))); else tmp = Float64(z * Float64(z * Float64(Float64(0.0007936500793651 / x) + Float64(y / x)))); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(0.91893853320467 - N[(x + N[(N[Log[x], $MachinePrecision] * N[(0.5 - x), $MachinePrecision]), $MachinePrecision]), $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, -1e+163], N[(N[(y * z), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, Infinity], N[(0.91893853320467 + N[(N[Log[x], $MachinePrecision] * N[(x + -0.5), $MachinePrecision] + N[(N[(0.083333333333333 / x), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(z * N[(N[(0.0007936500793651 / x), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(0.91893853320467 - \left(x + \log x \cdot \left(0.5 - x\right)\right)\right) + \frac{0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)}{x}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+163}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \frac{z}{x}\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;0.91893853320467 + \mathsf{fma}\left(\log x, x + -0.5, \frac{0.083333333333333}{x} - x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(\frac{0.0007936500793651}{x} + \frac{y}{x}\right)\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)) < -9.9999999999999994e162Initial program 83.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-*.f6483.8
Applied rewrites83.8%
Applied rewrites83.8%
if -9.9999999999999994e162 < (+.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)) < +inf.0Initial program 95.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
+-commutativeN/A
lower-+.f64N/A
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f6472.0
Applied rewrites72.0%
if +inf.0 < (+.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 0.0%
Taylor expanded in x around 0
Applied rewrites0.0%
Taylor expanded in z around inf
Applied rewrites0.0%
Taylor expanded in z around 0
Applied rewrites1.2%
Taylor expanded in z around inf
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f640.2
Applied rewrites0.2%
Final simplification73.4%
(FPCore (x y z)
:precision binary64
(if (<= x 1e+110)
(+
(* (+ x -0.5) (log x))
(-
(/
(fma
z
(fma (+ y 0.0007936500793651) z -0.0027777777777778)
0.083333333333333)
x)
(+ x -0.91893853320467)))
(+
(- 0.91893853320467 (+ x (* (log x) (- 0.5 x))))
(* z (* z (/ (+ y 0.0007936500793651) x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 1e+110) {
tmp = ((x + -0.5) * log(x)) + ((fma(z, fma((y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x) - (x + -0.91893853320467));
} else {
tmp = (0.91893853320467 - (x + (log(x) * (0.5 - x)))) + (z * (z * ((y + 0.0007936500793651) / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 1e+110) tmp = Float64(Float64(Float64(x + -0.5) * log(x)) + Float64(Float64(fma(z, fma(Float64(y + 0.0007936500793651), z, -0.0027777777777778), 0.083333333333333) / x) - Float64(x + -0.91893853320467))); else tmp = Float64(Float64(0.91893853320467 - Float64(x + Float64(log(x) * Float64(0.5 - x)))) + Float64(z * Float64(z * Float64(Float64(y + 0.0007936500793651) / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 1e+110], N[(N[(N[(x + -0.5), $MachinePrecision] * N[Log[x], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(z * N[(N[(y + 0.0007936500793651), $MachinePrecision] * z + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision] - N[(x + -0.91893853320467), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 - N[(x + N[(N[Log[x], $MachinePrecision] * N[(0.5 - x), $MachinePrecision]), $MachinePrecision]), $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 10^{+110}:\\
\;\;\;\;\left(x + -0.5\right) \cdot \log x + \left(\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(y + 0.0007936500793651, z, -0.0027777777777778\right), 0.083333333333333\right)}{x} - \left(x + -0.91893853320467\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 - \left(x + \log x \cdot \left(0.5 - x\right)\right)\right) + z \cdot \left(z \cdot \frac{y + 0.0007936500793651}{x}\right)\\
\end{array}
\end{array}
if x < 1e110Initial program 99.6%
lift-+.f64N/A
lift-+.f64N/A
lift--.f64N/A
associate-+l-N/A
associate-+l-N/A
lower--.f64N/A
lift--.f64N/A
sub-negN/A
lower-+.f64N/A
metadata-evalN/A
lower--.f64N/A
sub-negN/A
lower-+.f64N/A
metadata-eval99.7
Applied rewrites99.7%
if 1e110 < x Initial program 83.1%
Taylor expanded in z around inf
associate-/l*N/A
unpow2N/A
associate-*l*N/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6499.6
Applied rewrites99.6%
Final simplification99.6%
(FPCore (x y z)
:precision binary64
(if (<= x 0.2)
(fma
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
0.083333333333333)
(/ 1.0 x)
(fma -0.5 (log x) 0.91893853320467))
(+
(- 0.91893853320467 (+ x (* (log x) (- 0.5 x))))
(* z (* z (/ (+ y 0.0007936500793651) x))))))
double code(double x, double y, double z) {
double tmp;
if (x <= 0.2) {
tmp = fma(fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333), (1.0 / x), fma(-0.5, log(x), 0.91893853320467));
} else {
tmp = (0.91893853320467 - (x + (log(x) * (0.5 - x)))) + (z * (z * ((y + 0.0007936500793651) / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 0.2) tmp = fma(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333), Float64(1.0 / x), fma(-0.5, log(x), 0.91893853320467)); else tmp = Float64(Float64(0.91893853320467 - Float64(x + Float64(log(x) * Float64(0.5 - x)))) + Float64(z * Float64(z * Float64(Float64(y + 0.0007936500793651) / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 0.2], N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] * N[(1.0 / x), $MachinePrecision] + N[(-0.5 * N[Log[x], $MachinePrecision] + 0.91893853320467), $MachinePrecision]), $MachinePrecision], N[(N[(0.91893853320467 - N[(x + N[(N[Log[x], $MachinePrecision] * N[(0.5 - x), $MachinePrecision]), $MachinePrecision]), $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 0.2:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), 0.083333333333333\right), \frac{1}{x}, \mathsf{fma}\left(-0.5, \log x, 0.91893853320467\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.91893853320467 - \left(x + \log x \cdot \left(0.5 - x\right)\right)\right) + z \cdot \left(z \cdot \frac{y + 0.0007936500793651}{x}\right)\\
\end{array}
\end{array}
if x < 0.20000000000000001Initial program 99.6%
lift-/.f64N/A
div-invN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites68.9%
Applied rewrites99.6%
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.0
Applied rewrites99.0%
if 0.20000000000000001 < x Initial program 87.8%
Taylor expanded in z around inf
associate-/l*N/A
unpow2N/A
associate-*l*N/A
associate-*r/N/A
lower-*.f64N/A
associate-*r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6499.2
Applied rewrites99.2%
Final simplification99.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fma x (log x) (- x))))
(if (<= x 1.06e+111)
(/
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
(fma x t_0 0.083333333333333))
x)
(+ t_0 (* y (/ (* z z) x))))))
double code(double x, double y, double z) {
double t_0 = fma(x, log(x), -x);
double tmp;
if (x <= 1.06e+111) {
tmp = fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), fma(x, t_0, 0.083333333333333)) / x;
} else {
tmp = t_0 + (y * ((z * z) / x));
}
return tmp;
}
function code(x, y, z) t_0 = fma(x, log(x), Float64(-x)) tmp = 0.0 if (x <= 1.06e+111) tmp = Float64(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), fma(x, t_0, 0.083333333333333)) / x); else tmp = Float64(t_0 + Float64(y * Float64(Float64(z * z) / x))); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision]}, If[LessEqual[x, 1.06e+111], N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + N[(x * t$95$0 + 0.083333333333333), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(t$95$0 + N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(x, \log x, -x\right)\\
\mathbf{if}\;x \leq 1.06 \cdot 10^{+111}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), \mathsf{fma}\left(x, t\_0, 0.083333333333333\right)\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_0 + y \cdot \frac{z \cdot z}{x}\\
\end{array}
\end{array}
if x < 1.06e111Initial program 99.6%
Taylor expanded in x around 0
Applied rewrites99.6%
Taylor expanded in x around inf
Applied rewrites98.4%
if 1.06e111 < x Initial program 83.1%
Taylor expanded in z around 0
Applied rewrites81.5%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6491.3
Applied rewrites91.3%
Taylor expanded in x around inf
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
neg-mul-1N/A
lower-fma.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower-neg.f6491.4
Applied rewrites91.4%
Final simplification95.9%
(FPCore (x y z)
:precision binary64
(if (<= x 4.6e+49)
(fma
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
0.083333333333333)
(/ 1.0 x)
(fma -0.5 (log x) 0.91893853320467))
(+ (fma x (log x) (- x)) (* y (/ (* z z) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.6e+49) {
tmp = fma(fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333), (1.0 / x), fma(-0.5, log(x), 0.91893853320467));
} else {
tmp = fma(x, log(x), -x) + (y * ((z * z) / x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 4.6e+49) tmp = fma(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333), Float64(1.0 / x), fma(-0.5, log(x), 0.91893853320467)); else tmp = Float64(fma(x, log(x), Float64(-x)) + Float64(y * Float64(Float64(z * z) / x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 4.6e+49], N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] * N[(1.0 / x), $MachinePrecision] + N[(-0.5 * N[Log[x], $MachinePrecision] + 0.91893853320467), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision] + N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), 0.083333333333333\right), \frac{1}{x}, \mathsf{fma}\left(-0.5, \log x, 0.91893853320467\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \log x, -x\right) + y \cdot \frac{z \cdot z}{x}\\
\end{array}
\end{array}
if x < 4.60000000000000004e49Initial program 99.7%
lift-/.f64N/A
div-invN/A
lift-+.f64N/A
flip-+N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites67.0%
Applied rewrites99.6%
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.f6494.2
Applied rewrites94.2%
if 4.60000000000000004e49 < x Initial program 86.0%
Taylor expanded in z around 0
Applied rewrites79.0%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6492.5
Applied rewrites92.5%
Taylor expanded in x around inf
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
neg-mul-1N/A
lower-fma.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower-neg.f6492.6
Applied rewrites92.6%
(FPCore (x y z)
:precision binary64
(if (<= x 4.6e+49)
(/
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
0.083333333333333)
x)
(+ (fma x (log x) (- x)) (* y (/ (* z z) x)))))
double code(double x, double y, double z) {
double tmp;
if (x <= 4.6e+49) {
tmp = fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x;
} else {
tmp = fma(x, log(x), -x) + (y * ((z * z) / x));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 4.6e+49) tmp = Float64(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x); else tmp = Float64(fma(x, log(x), Float64(-x)) + Float64(y * Float64(Float64(z * z) / x))); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 4.6e+49], N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(x * N[Log[x], $MachinePrecision] + (-x)), $MachinePrecision] + N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 4.6 \cdot 10^{+49}:\\
\;\;\;\;\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) + y \cdot \frac{z \cdot z}{x}\\
\end{array}
\end{array}
if x < 4.60000000000000004e49Initial 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.1
Applied rewrites94.1%
if 4.60000000000000004e49 < x Initial program 86.0%
Taylor expanded in z around 0
Applied rewrites79.0%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6492.5
Applied rewrites92.5%
Taylor expanded in x around inf
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
neg-mul-1N/A
lower-fma.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower-neg.f6492.6
Applied rewrites92.6%
Final simplification93.4%
(FPCore (x y z)
:precision binary64
(if (<= x 7.8e+49)
(/
(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 <= 7.8e+49) {
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 <= 7.8e+49) 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, 7.8e+49], 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 7.8 \cdot 10^{+49}:\\
\;\;\;\;\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 < 7.8000000000000002e49Initial 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.1
Applied rewrites94.1%
if 7.8000000000000002e49 < x Initial program 86.0%
Taylor expanded in y around inf
Applied rewrites97.1%
Taylor expanded in x around inf
sub-negN/A
metadata-evalN/A
distribute-rgt-inN/A
mul-1-negN/A
distribute-lft-neg-inN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
mul-1-negN/A
neg-mul-1N/A
lower-fma.f64N/A
mul-1-negN/A
log-recN/A
remove-double-negN/A
lower-log.f64N/A
lower-neg.f6479.0
Applied rewrites79.0%
Final simplification87.4%
(FPCore (x y z)
:precision binary64
(if (<= x 7.8e+49)
(/
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
0.083333333333333)
x)
(- (* x (log x)) x)))
double code(double x, double y, double z) {
double tmp;
if (x <= 7.8e+49) {
tmp = fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x;
} else {
tmp = (x * log(x)) - x;
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (x <= 7.8e+49) tmp = Float64(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x); else tmp = Float64(Float64(x * log(x)) - x); end return tmp end
code[x_, y_, z_] := If[LessEqual[x, 7.8e+49], N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(x * N[Log[x], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 7.8 \cdot 10^{+49}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \log x - x\\
\end{array}
\end{array}
if x < 7.8000000000000002e49Initial 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.1
Applied rewrites94.1%
if 7.8000000000000002e49 < x Initial program 86.0%
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
unsub-negN/A
lower--.f64N/A
lower-*.f64N/A
lower-log.f6479.0
Applied rewrites79.0%
Final simplification87.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))))
(if (<= t_0 -1e+33)
(* (* y z) (/ z x))
(if (<= t_0 0.1)
(/ (fma -0.0027777777777778 z 0.083333333333333) x)
(* (/ (+ y 0.0007936500793651) x) (* z z))))))
double code(double x, double y, double z) {
double t_0 = 0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
double tmp;
if (t_0 <= -1e+33) {
tmp = (y * z) * (z / x);
} else if (t_0 <= 0.1) {
tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
} else {
tmp = ((y + 0.0007936500793651) / x) * (z * z);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) tmp = 0.0 if (t_0 <= -1e+33) tmp = Float64(Float64(y * z) * Float64(z / x)); elseif (t_0 <= 0.1) tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); else tmp = Float64(Float64(Float64(y + 0.0007936500793651) / x) * Float64(z * z)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+33], N[(N[(y * z), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.1], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(N[(y + 0.0007936500793651), $MachinePrecision] / x), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+33}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \frac{z}{x}\\
\mathbf{elif}\;t\_0 \leq 0.1:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{y + 0.0007936500793651}{x} \cdot \left(z \cdot z\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -9.9999999999999995e32Initial program 84.4%
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-*.f6469.1
Applied rewrites69.1%
Applied rewrites69.1%
if -9.9999999999999995e32 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 99.5%
Taylor expanded in y around inf
Applied rewrites95.1%
Applied rewrites95.1%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites98.4%
Taylor expanded in x around 0
Applied rewrites52.2%
if 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 89.6%
Taylor expanded in x around 0
Applied rewrites76.3%
Taylor expanded in z around inf
Applied rewrites67.7%
Taylor expanded in z around inf
Applied rewrites71.0%
Final simplification61.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))))
(if (<= t_0 -1e+33)
(* (* y z) (/ z x))
(if (<= t_0 5e+33)
(/ (fma -0.0027777777777778 z 0.083333333333333) x)
(/ (* z (fma z 0.0007936500793651 -0.0027777777777778)) x)))))
double code(double x, double y, double z) {
double t_0 = 0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
double tmp;
if (t_0 <= -1e+33) {
tmp = (y * z) * (z / x);
} else if (t_0 <= 5e+33) {
tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
} else {
tmp = (z * fma(z, 0.0007936500793651, -0.0027777777777778)) / x;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) tmp = 0.0 if (t_0 <= -1e+33) tmp = Float64(Float64(y * z) * Float64(z / x)); elseif (t_0 <= 5e+33) tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); else tmp = Float64(Float64(z * fma(z, 0.0007936500793651, -0.0027777777777778)) / x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+33], N[(N[(y * z), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+33], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(z * N[(z * 0.0007936500793651 + -0.0027777777777778), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+33}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \frac{z}{x}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+33}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \mathsf{fma}\left(z, 0.0007936500793651, -0.0027777777777778\right)}{x}\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -9.9999999999999995e32Initial program 84.4%
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-*.f6469.1
Applied rewrites69.1%
Applied rewrites69.1%
if -9.9999999999999995e32 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 4.99999999999999973e33Initial program 99.5%
Taylor expanded in y around inf
Applied rewrites94.4%
Applied rewrites94.5%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites97.7%
Taylor expanded in x around 0
Applied rewrites50.8%
if 4.99999999999999973e33 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 89.2%
Taylor expanded in x around 0
Applied rewrites75.1%
Taylor expanded in z around inf
Applied rewrites69.6%
Taylor expanded in y around 0
Applied rewrites59.7%
Taylor expanded in z around 0
Applied rewrites59.7%
Final simplification56.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))))
(if (<= t_0 -1e+33)
(* (* y z) (/ z x))
(if (<= t_0 0.1)
(/ (fma -0.0027777777777778 z 0.083333333333333) x)
(/ (* z (* 0.0007936500793651 z)) x)))))
double code(double x, double y, double z) {
double t_0 = 0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
double tmp;
if (t_0 <= -1e+33) {
tmp = (y * z) * (z / x);
} else if (t_0 <= 0.1) {
tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
} else {
tmp = (z * (0.0007936500793651 * z)) / x;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) tmp = 0.0 if (t_0 <= -1e+33) tmp = Float64(Float64(y * z) * Float64(z / x)); elseif (t_0 <= 0.1) tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); else tmp = Float64(Float64(z * Float64(0.0007936500793651 * z)) / x); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+33], N[(N[(y * z), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.1], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(N[(z * N[(0.0007936500793651 * z), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+33}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \frac{z}{x}\\
\mathbf{elif}\;t\_0 \leq 0.1:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{z \cdot \left(0.0007936500793651 \cdot z\right)}{x}\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -9.9999999999999995e32Initial program 84.4%
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-*.f6469.1
Applied rewrites69.1%
Applied rewrites69.1%
if -9.9999999999999995e32 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 0.10000000000000001Initial program 99.5%
Taylor expanded in y around inf
Applied rewrites95.1%
Applied rewrites95.1%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites98.4%
Taylor expanded in x around 0
Applied rewrites52.2%
if 0.10000000000000001 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 89.6%
Taylor expanded in x around 0
Applied rewrites76.3%
Taylor expanded in z around inf
Applied rewrites67.7%
Taylor expanded in y around 0
Applied rewrites57.0%
Taylor expanded in z around inf
Applied rewrites57.0%
Final simplification56.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))))
(if (<= t_0 -1e+33)
(* (* y z) (/ z x))
(if (<= t_0 5e+29)
(/ (fma -0.0027777777777778 z 0.083333333333333) x)
(* y (/ (* z z) x))))))
double code(double x, double y, double z) {
double t_0 = 0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778));
double tmp;
if (t_0 <= -1e+33) {
tmp = (y * z) * (z / x);
} else if (t_0 <= 5e+29) {
tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
} else {
tmp = y * ((z * z) / x);
}
return tmp;
}
function code(x, y, z) t_0 = Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) tmp = 0.0 if (t_0 <= -1e+33) tmp = Float64(Float64(y * z) * Float64(z / x)); elseif (t_0 <= 5e+29) tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); else tmp = Float64(y * Float64(Float64(z * z) / x)); end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+33], N[(N[(y * z), $MachinePrecision] * N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+29], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+33}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \frac{z}{x}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+29}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z \cdot z}{x}\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < -9.9999999999999995e32Initial program 84.4%
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-*.f6469.1
Applied rewrites69.1%
Applied rewrites69.1%
if -9.9999999999999995e32 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 5.0000000000000001e29Initial program 99.5%
Taylor expanded in y around inf
Applied rewrites94.4%
Applied rewrites94.5%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites98.4%
Taylor expanded in x around 0
Applied rewrites51.1%
if 5.0000000000000001e29 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 89.3%
Taylor expanded in y around inf
Applied rewrites91.5%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6451.3
Applied rewrites51.3%
Final simplification54.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
(t_1 (* y (/ (* z z) x))))
(if (<= t_0 -1e+33)
t_1
(if (<= t_0 5e+29)
(/ (fma -0.0027777777777778 z 0.083333333333333) x)
t_1))))
double code(double x, double y, double z) {
double t_0 = z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778);
double t_1 = y * ((z * z) / x);
double tmp;
if (t_0 <= -1e+33) {
tmp = t_1;
} else if (t_0 <= 5e+29) {
tmp = fma(-0.0027777777777778, z, 0.083333333333333) / x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z) t_0 = Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778)) t_1 = Float64(y * Float64(Float64(z * z) / x)) tmp = 0.0 if (t_0 <= -1e+33) tmp = t_1; elseif (t_0 <= 5e+29) tmp = Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x); else tmp = t_1; end return tmp end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(N[(z * z), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e+33], t$95$1, If[LessEqual[t$95$0, 5e+29], N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right)\\
t_1 := y \cdot \frac{z \cdot z}{x}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+29}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < -9.9999999999999995e32 or 5.0000000000000001e29 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) Initial program 87.5%
Taylor expanded in y around inf
Applied rewrites94.4%
Taylor expanded in y around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f6457.7
Applied rewrites57.7%
if -9.9999999999999995e32 < (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) < 5.0000000000000001e29Initial program 99.5%
Taylor expanded in y around inf
Applied rewrites94.4%
Applied rewrites94.5%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites98.4%
Taylor expanded in x around 0
Applied rewrites51.1%
Final simplification54.3%
(FPCore (x y z)
:precision binary64
(if (<=
(+
0.083333333333333
(* z (- (* z (+ y 0.0007936500793651)) 0.0027777777777778)))
2e+251)
(/
(fma
z
(fma z (+ y 0.0007936500793651) -0.0027777777777778)
0.083333333333333)
x)
(* z (* z (+ (/ 0.0007936500793651 x) (/ y x))))))
double code(double x, double y, double z) {
double tmp;
if ((0.083333333333333 + (z * ((z * (y + 0.0007936500793651)) - 0.0027777777777778))) <= 2e+251) {
tmp = fma(z, fma(z, (y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x;
} else {
tmp = z * (z * ((0.0007936500793651 / x) + (y / x)));
}
return tmp;
}
function code(x, y, z) tmp = 0.0 if (Float64(0.083333333333333 + Float64(z * Float64(Float64(z * Float64(y + 0.0007936500793651)) - 0.0027777777777778))) <= 2e+251) tmp = Float64(fma(z, fma(z, Float64(y + 0.0007936500793651), -0.0027777777777778), 0.083333333333333) / x); else tmp = Float64(z * Float64(z * Float64(Float64(0.0007936500793651 / x) + Float64(y / x)))); end return tmp end
code[x_, y_, z_] := If[LessEqual[N[(0.083333333333333 + N[(z * N[(N[(z * N[(y + 0.0007936500793651), $MachinePrecision]), $MachinePrecision] - 0.0027777777777778), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+251], N[(N[(z * N[(z * N[(y + 0.0007936500793651), $MachinePrecision] + -0.0027777777777778), $MachinePrecision] + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision], N[(z * N[(z * N[(N[(0.0007936500793651 / x), $MachinePrecision] + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;0.083333333333333 + z \cdot \left(z \cdot \left(y + 0.0007936500793651\right) - 0.0027777777777778\right) \leq 2 \cdot 10^{+251}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, \mathsf{fma}\left(z, y + 0.0007936500793651, -0.0027777777777778\right), 0.083333333333333\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(z \cdot \left(\frac{0.0007936500793651}{x} + \frac{y}{x}\right)\right)\\
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) < 2.0000000000000001e251Initial program 96.2%
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-+.f6456.7
Applied rewrites56.7%
if 2.0000000000000001e251 < (+.f64 (*.f64 (-.f64 (*.f64 (+.f64 y #s(literal 7936500793651/10000000000000000 binary64)) z) #s(literal 13888888888889/5000000000000000 binary64)) z) #s(literal 83333333333333/1000000000000000 binary64)) Initial program 83.1%
Taylor expanded in x around 0
Applied rewrites77.5%
Taylor expanded in z around inf
Applied rewrites77.4%
Taylor expanded in z around 0
Applied rewrites14.2%
Taylor expanded in z around inf
unpow2N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-+.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
lower-/.f6486.7
Applied rewrites86.7%
Final simplification62.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 93.6%
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-+.f6460.8
Applied rewrites60.8%
Final simplification60.8%
(FPCore (x y z) :precision binary64 (/ (fma -0.0027777777777778 z 0.083333333333333) x))
double code(double x, double y, double z) {
return fma(-0.0027777777777778, z, 0.083333333333333) / x;
}
function code(x, y, z) return Float64(fma(-0.0027777777777778, z, 0.083333333333333) / x) end
code[x_, y_, z_] := N[(N[(-0.0027777777777778 * z + 0.083333333333333), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\mathsf{fma}\left(-0.0027777777777778, z, 0.083333333333333\right)}{x}
\end{array}
Initial program 93.6%
Taylor expanded in y around inf
Applied rewrites94.4%
Applied rewrites94.5%
Taylor expanded in z around 0
+-commutativeN/A
associate--l+N/A
lower-+.f64N/A
Applied rewrites68.8%
Taylor expanded in x around 0
Applied rewrites32.4%
(FPCore (x y z) :precision binary64 (/ (* z -0.0027777777777778) x))
double code(double x, double y, double z) {
return (z * -0.0027777777777778) / x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = (z * (-0.0027777777777778d0)) / x
end function
public static double code(double x, double y, double z) {
return (z * -0.0027777777777778) / x;
}
def code(x, y, z): return (z * -0.0027777777777778) / x
function code(x, y, z) return Float64(Float64(z * -0.0027777777777778) / x) end
function tmp = code(x, y, z) tmp = (z * -0.0027777777777778) / x; end
code[x_, y_, z_] := N[(N[(z * -0.0027777777777778), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{z \cdot -0.0027777777777778}{x}
\end{array}
Initial program 93.6%
Taylor expanded in x around 0
Applied rewrites73.9%
Taylor expanded in z around inf
Applied rewrites35.4%
Taylor expanded in z around 0
Applied rewrites7.5%
(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 2024233
(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)))