
(FPCore (x) :precision binary64 (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (6.0d0 * (x - 1.0d0)) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))
end function
public static double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * Math.sqrt(x)));
}
def code(x): return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * math.sqrt(x)))
function code(x) return Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) end
function tmp = code(x) tmp = (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x))); end
code[x_] := N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (6.0d0 * (x - 1.0d0)) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))
end function
public static double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * Math.sqrt(x)));
}
def code(x): return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * math.sqrt(x)))
function code(x) return Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) end
function tmp = code(x) tmp = (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x))); end
code[x_] := N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
\end{array}
(FPCore (x) :precision binary64 (* (/ (+ x -1.0) (+ x (fma 4.0 (sqrt x) 1.0))) 6.0))
double code(double x) {
return ((x + -1.0) / (x + fma(4.0, sqrt(x), 1.0))) * 6.0;
}
function code(x) return Float64(Float64(Float64(x + -1.0) / Float64(x + fma(4.0, sqrt(x), 1.0))) * 6.0) end
code[x_] := N[(N[(N[(x + -1.0), $MachinePrecision] / N[(x + N[(4.0 * N[Sqrt[x], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 6.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + -1}{x + \mathsf{fma}\left(4, \sqrt{x}, 1\right)} \cdot 6
\end{array}
Initial program 99.5%
associate-/l*99.9%
*-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
associate-+l+99.9%
+-commutative99.9%
fma-define99.9%
Applied egg-rr99.9%
(FPCore (x) :precision binary64 (if (<= x 0.078) (* (- (* x -78.0) 6.0) (+ 1.0 (+ x (* (sqrt x) -4.0)))) (/ 6.0 (+ 1.0 (* 4.0 (pow x -0.5))))))
double code(double x) {
double tmp;
if (x <= 0.078) {
tmp = ((x * -78.0) - 6.0) * (1.0 + (x + (sqrt(x) * -4.0)));
} else {
tmp = 6.0 / (1.0 + (4.0 * pow(x, -0.5)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.078d0) then
tmp = ((x * (-78.0d0)) - 6.0d0) * (1.0d0 + (x + (sqrt(x) * (-4.0d0))))
else
tmp = 6.0d0 / (1.0d0 + (4.0d0 * (x ** (-0.5d0))))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.078) {
tmp = ((x * -78.0) - 6.0) * (1.0 + (x + (Math.sqrt(x) * -4.0)));
} else {
tmp = 6.0 / (1.0 + (4.0 * Math.pow(x, -0.5)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.078: tmp = ((x * -78.0) - 6.0) * (1.0 + (x + (math.sqrt(x) * -4.0))) else: tmp = 6.0 / (1.0 + (4.0 * math.pow(x, -0.5))) return tmp
function code(x) tmp = 0.0 if (x <= 0.078) tmp = Float64(Float64(Float64(x * -78.0) - 6.0) * Float64(1.0 + Float64(x + Float64(sqrt(x) * -4.0)))); else tmp = Float64(6.0 / Float64(1.0 + Float64(4.0 * (x ^ -0.5)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.078) tmp = ((x * -78.0) - 6.0) * (1.0 + (x + (sqrt(x) * -4.0))); else tmp = 6.0 / (1.0 + (4.0 * (x ^ -0.5))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.078], N[(N[(N[(x * -78.0), $MachinePrecision] - 6.0), $MachinePrecision] * N[(1.0 + N[(x + N[(N[Sqrt[x], $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(1.0 + N[(4.0 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.078:\\
\;\;\;\;\left(x \cdot -78 - 6\right) \cdot \left(1 + \left(x + \sqrt{x} \cdot -4\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{1 + 4 \cdot {x}^{-0.5}}\\
\end{array}
\end{array}
if x < 0.0779999999999999999Initial program 99.9%
flip-+99.9%
associate-/r/99.9%
Applied egg-rr99.9%
fma-define99.9%
*-commutative99.9%
fma-define99.9%
+-commutative99.9%
associate-+l+99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 99.6%
Taylor expanded in x around 0 99.6%
*-commutative99.6%
Simplified99.6%
if 0.0779999999999999999 < x Initial program 99.0%
Taylor expanded in x around inf 98.4%
*-un-lft-identity98.4%
inv-pow98.4%
sqrt-pow198.4%
metadata-eval98.4%
Applied egg-rr98.4%
*-lft-identity98.4%
Simplified98.4%
Final simplification99.0%
(FPCore (x) :precision binary64 (if (<= x 1.0) (/ -6.0 (+ (+ x 1.0) (* 4.0 (sqrt x)))) (/ 6.0 (+ 1.0 (* 4.0 (pow x -0.5))))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = -6.0 / ((x + 1.0) + (4.0 * sqrt(x)));
} else {
tmp = 6.0 / (1.0 + (4.0 * pow(x, -0.5)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = (-6.0d0) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))
else
tmp = 6.0d0 / (1.0d0 + (4.0d0 * (x ** (-0.5d0))))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = -6.0 / ((x + 1.0) + (4.0 * Math.sqrt(x)));
} else {
tmp = 6.0 / (1.0 + (4.0 * Math.pow(x, -0.5)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = -6.0 / ((x + 1.0) + (4.0 * math.sqrt(x))) else: tmp = 6.0 / (1.0 + (4.0 * math.pow(x, -0.5))) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(-6.0 / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))); else tmp = Float64(6.0 / Float64(1.0 + Float64(4.0 * (x ^ -0.5)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = -6.0 / ((x + 1.0) + (4.0 * sqrt(x))); else tmp = 6.0 / (1.0 + (4.0 * (x ^ -0.5))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(-6.0 / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(1.0 + N[(4.0 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{-6}{\left(x + 1\right) + 4 \cdot \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{1 + 4 \cdot {x}^{-0.5}}\\
\end{array}
\end{array}
if x < 1Initial program 99.9%
Taylor expanded in x around 0 98.8%
if 1 < x Initial program 99.0%
Taylor expanded in x around inf 98.4%
*-un-lft-identity98.4%
inv-pow98.4%
sqrt-pow198.4%
metadata-eval98.4%
Applied egg-rr98.4%
*-lft-identity98.4%
Simplified98.4%
(FPCore (x) :precision binary64 (if (<= x 1.0) (/ -6.0 (+ 1.0 (* 4.0 (sqrt x)))) (/ 6.0 (+ 1.0 (* 4.0 (pow x -0.5))))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = -6.0 / (1.0 + (4.0 * sqrt(x)));
} else {
tmp = 6.0 / (1.0 + (4.0 * pow(x, -0.5)));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.0d0) then
tmp = (-6.0d0) / (1.0d0 + (4.0d0 * sqrt(x)))
else
tmp = 6.0d0 / (1.0d0 + (4.0d0 * (x ** (-0.5d0))))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = -6.0 / (1.0 + (4.0 * Math.sqrt(x)));
} else {
tmp = 6.0 / (1.0 + (4.0 * Math.pow(x, -0.5)));
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = -6.0 / (1.0 + (4.0 * math.sqrt(x))) else: tmp = 6.0 / (1.0 + (4.0 * math.pow(x, -0.5))) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(-6.0 / Float64(1.0 + Float64(4.0 * sqrt(x)))); else tmp = Float64(6.0 / Float64(1.0 + Float64(4.0 * (x ^ -0.5)))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = -6.0 / (1.0 + (4.0 * sqrt(x))); else tmp = 6.0 / (1.0 + (4.0 * (x ^ -0.5))); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(-6.0 / N[(1.0 + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(1.0 + N[(4.0 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;\frac{-6}{1 + 4 \cdot \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{1 + 4 \cdot {x}^{-0.5}}\\
\end{array}
\end{array}
if x < 1Initial program 99.9%
Taylor expanded in x around 0 98.7%
if 1 < x Initial program 99.0%
Taylor expanded in x around inf 98.4%
*-un-lft-identity98.4%
inv-pow98.4%
sqrt-pow198.4%
metadata-eval98.4%
Applied egg-rr98.4%
*-lft-identity98.4%
Simplified98.4%
(FPCore (x) :precision binary64 (/ (* 6.0 (+ x -1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
double code(double x) {
return (6.0 * (x + -1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (6.0d0 * (x + (-1.0d0))) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))
end function
public static double code(double x) {
return (6.0 * (x + -1.0)) / ((x + 1.0) + (4.0 * Math.sqrt(x)));
}
def code(x): return (6.0 * (x + -1.0)) / ((x + 1.0) + (4.0 * math.sqrt(x)))
function code(x) return Float64(Float64(6.0 * Float64(x + -1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) end
function tmp = code(x) tmp = (6.0 * (x + -1.0)) / ((x + 1.0) + (4.0 * sqrt(x))); end
code[x_] := N[(N[(6.0 * N[(x + -1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{6 \cdot \left(x + -1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
\end{array}
Initial program 99.5%
Final simplification99.5%
(FPCore (x) :precision binary64 (if (<= x 14.2) (/ -6.0 (+ 1.0 (* 4.0 (sqrt x)))) (+ 6.0 (/ -24.0 (sqrt x)))))
double code(double x) {
double tmp;
if (x <= 14.2) {
tmp = -6.0 / (1.0 + (4.0 * sqrt(x)));
} else {
tmp = 6.0 + (-24.0 / sqrt(x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 14.2d0) then
tmp = (-6.0d0) / (1.0d0 + (4.0d0 * sqrt(x)))
else
tmp = 6.0d0 + ((-24.0d0) / sqrt(x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 14.2) {
tmp = -6.0 / (1.0 + (4.0 * Math.sqrt(x)));
} else {
tmp = 6.0 + (-24.0 / Math.sqrt(x));
}
return tmp;
}
def code(x): tmp = 0 if x <= 14.2: tmp = -6.0 / (1.0 + (4.0 * math.sqrt(x))) else: tmp = 6.0 + (-24.0 / math.sqrt(x)) return tmp
function code(x) tmp = 0.0 if (x <= 14.2) tmp = Float64(-6.0 / Float64(1.0 + Float64(4.0 * sqrt(x)))); else tmp = Float64(6.0 + Float64(-24.0 / sqrt(x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 14.2) tmp = -6.0 / (1.0 + (4.0 * sqrt(x))); else tmp = 6.0 + (-24.0 / sqrt(x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 14.2], N[(-6.0 / N[(1.0 + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 + N[(-24.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 14.2:\\
\;\;\;\;\frac{-6}{1 + 4 \cdot \sqrt{x}}\\
\mathbf{else}:\\
\;\;\;\;6 + \frac{-24}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 14.199999999999999Initial program 99.9%
Taylor expanded in x around 0 98.7%
if 14.199999999999999 < x Initial program 99.0%
flip-+45.6%
associate-/r/45.5%
Applied egg-rr45.5%
fma-define45.5%
*-commutative45.5%
fma-define45.5%
+-commutative45.5%
associate-+l+45.5%
*-commutative45.5%
Simplified45.5%
Taylor expanded in x around inf 98.3%
distribute-lft-in98.3%
metadata-eval98.3%
associate-*r*98.3%
metadata-eval98.3%
Simplified98.3%
sqrt-div98.3%
metadata-eval98.3%
un-div-inv98.3%
Applied egg-rr98.3%
(FPCore (x) :precision binary64 (if (<= x 16.5) (+ -6.0 (* (sqrt x) 24.0)) (+ 6.0 (/ -24.0 (sqrt x)))))
double code(double x) {
double tmp;
if (x <= 16.5) {
tmp = -6.0 + (sqrt(x) * 24.0);
} else {
tmp = 6.0 + (-24.0 / sqrt(x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 16.5d0) then
tmp = (-6.0d0) + (sqrt(x) * 24.0d0)
else
tmp = 6.0d0 + ((-24.0d0) / sqrt(x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 16.5) {
tmp = -6.0 + (Math.sqrt(x) * 24.0);
} else {
tmp = 6.0 + (-24.0 / Math.sqrt(x));
}
return tmp;
}
def code(x): tmp = 0 if x <= 16.5: tmp = -6.0 + (math.sqrt(x) * 24.0) else: tmp = 6.0 + (-24.0 / math.sqrt(x)) return tmp
function code(x) tmp = 0.0 if (x <= 16.5) tmp = Float64(-6.0 + Float64(sqrt(x) * 24.0)); else tmp = Float64(6.0 + Float64(-24.0 / sqrt(x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 16.5) tmp = -6.0 + (sqrt(x) * 24.0); else tmp = 6.0 + (-24.0 / sqrt(x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 16.5], N[(-6.0 + N[(N[Sqrt[x], $MachinePrecision] * 24.0), $MachinePrecision]), $MachinePrecision], N[(6.0 + N[(-24.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 16.5:\\
\;\;\;\;-6 + \sqrt{x} \cdot 24\\
\mathbf{else}:\\
\;\;\;\;6 + \frac{-24}{\sqrt{x}}\\
\end{array}
\end{array}
if x < 16.5Initial program 99.9%
flip-+99.9%
associate-/r/99.9%
Applied egg-rr99.9%
fma-define99.9%
*-commutative99.9%
fma-define99.9%
+-commutative99.9%
associate-+l+99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 98.5%
metadata-eval98.5%
distribute-lft-neg-in98.5%
distribute-lft-in98.5%
metadata-eval98.5%
distribute-lft-neg-in98.5%
metadata-eval98.5%
associate-*r*98.5%
metadata-eval98.5%
Simplified98.5%
if 16.5 < x Initial program 99.0%
flip-+45.6%
associate-/r/45.5%
Applied egg-rr45.5%
fma-define45.5%
*-commutative45.5%
fma-define45.5%
+-commutative45.5%
associate-+l+45.5%
*-commutative45.5%
Simplified45.5%
Taylor expanded in x around inf 98.3%
distribute-lft-in98.3%
metadata-eval98.3%
associate-*r*98.3%
metadata-eval98.3%
Simplified98.3%
sqrt-div98.3%
metadata-eval98.3%
un-div-inv98.3%
Applied egg-rr98.3%
Final simplification98.4%
(FPCore (x) :precision binary64 (+ -6.0 (* (sqrt x) 24.0)))
double code(double x) {
return -6.0 + (sqrt(x) * 24.0);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (-6.0d0) + (sqrt(x) * 24.0d0)
end function
public static double code(double x) {
return -6.0 + (Math.sqrt(x) * 24.0);
}
def code(x): return -6.0 + (math.sqrt(x) * 24.0)
function code(x) return Float64(-6.0 + Float64(sqrt(x) * 24.0)) end
function tmp = code(x) tmp = -6.0 + (sqrt(x) * 24.0); end
code[x_] := N[(-6.0 + N[(N[Sqrt[x], $MachinePrecision] * 24.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-6 + \sqrt{x} \cdot 24
\end{array}
Initial program 99.5%
flip-+73.0%
associate-/r/73.0%
Applied egg-rr72.9%
fma-define73.0%
*-commutative73.0%
fma-define72.9%
+-commutative72.9%
associate-+l+72.9%
*-commutative72.9%
Simplified72.9%
Taylor expanded in x around 0 53.0%
metadata-eval53.0%
distribute-lft-neg-in53.0%
distribute-lft-in53.0%
metadata-eval53.0%
distribute-lft-neg-in53.0%
metadata-eval53.0%
associate-*r*53.0%
metadata-eval53.0%
Simplified53.0%
Final simplification53.0%
(FPCore (x) :precision binary64 (sqrt (* x 2.25)))
double code(double x) {
return sqrt((x * 2.25));
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((x * 2.25d0))
end function
public static double code(double x) {
return Math.sqrt((x * 2.25));
}
def code(x): return math.sqrt((x * 2.25))
function code(x) return sqrt(Float64(x * 2.25)) end
function tmp = code(x) tmp = sqrt((x * 2.25)); end
code[x_] := N[Sqrt[N[(x * 2.25), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x \cdot 2.25}
\end{array}
Initial program 99.5%
Taylor expanded in x around inf 49.8%
Taylor expanded in x around 0 4.3%
*-commutative4.3%
Simplified4.3%
add-sqr-sqrt4.3%
sqrt-unprod4.3%
swap-sqr4.3%
add-sqr-sqrt4.3%
metadata-eval4.3%
Applied egg-rr4.3%
(FPCore (x) :precision binary64 (/ 6.0 (/ (+ (+ x 1.0) (* 4.0 (sqrt x))) (- x 1.0))))
double code(double x) {
return 6.0 / (((x + 1.0) + (4.0 * sqrt(x))) / (x - 1.0));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 6.0d0 / (((x + 1.0d0) + (4.0d0 * sqrt(x))) / (x - 1.0d0))
end function
public static double code(double x) {
return 6.0 / (((x + 1.0) + (4.0 * Math.sqrt(x))) / (x - 1.0));
}
def code(x): return 6.0 / (((x + 1.0) + (4.0 * math.sqrt(x))) / (x - 1.0))
function code(x) return Float64(6.0 / Float64(Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x))) / Float64(x - 1.0))) end
function tmp = code(x) tmp = 6.0 / (((x + 1.0) + (4.0 * sqrt(x))) / (x - 1.0)); end
code[x_] := N[(6.0 / N[(N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{6}{\frac{\left(x + 1\right) + 4 \cdot \sqrt{x}}{x - 1}}
\end{array}
herbie shell --seed 2024087
(FPCore (x)
:name "Data.Approximate.Numerics:blog from approximate-0.2.2.1"
:precision binary64
:alt
(/ 6.0 (/ (+ (+ x 1.0) (* 4.0 (sqrt x))) (- x 1.0)))
(/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))