
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
double code(double x) {
return sqrt((x + 1.0)) - sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
public static double code(double x) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
def code(x): return math.sqrt((x + 1.0)) - math.sqrt(x)
function code(x) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
function tmp = code(x) tmp = sqrt((x + 1.0)) - sqrt(x); end
code[x_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.0)) (sqrt x)))
double code(double x) {
return sqrt((x + 1.0)) - sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((x + 1.0d0)) - sqrt(x)
end function
public static double code(double x) {
return Math.sqrt((x + 1.0)) - Math.sqrt(x);
}
def code(x): return math.sqrt((x + 1.0)) - math.sqrt(x)
function code(x) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) end
function tmp = code(x) tmp = sqrt((x + 1.0)) - sqrt(x); end
code[x_] := N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x + 1} - \sqrt{x}
\end{array}
(FPCore (x) :precision binary64 (/ 1.0 (+ (sqrt (+ 1.0 x)) (sqrt x))))
double code(double x) {
return 1.0 / (sqrt((1.0 + x)) + sqrt(x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / (sqrt((1.0d0 + x)) + sqrt(x))
end function
public static double code(double x) {
return 1.0 / (Math.sqrt((1.0 + x)) + Math.sqrt(x));
}
def code(x): return 1.0 / (math.sqrt((1.0 + x)) + math.sqrt(x))
function code(x) return Float64(1.0 / Float64(sqrt(Float64(1.0 + x)) + sqrt(x))) end
function tmp = code(x) tmp = 1.0 / (sqrt((1.0 + x)) + sqrt(x)); end
code[x_] := N[(1.0 / N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{1 + x} + \sqrt{x}}
\end{array}
Initial program 52.0%
flip--52.2%
div-inv52.2%
add-sqr-sqrt52.8%
add-sqr-sqrt53.0%
associate--l+53.0%
Applied egg-rr53.0%
associate-*r/53.0%
*-rgt-identity53.0%
+-commutative53.0%
associate-+l-99.8%
+-inverses99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x) :precision binary64 (if (<= x 38000000.0) (- (sqrt (+ 1.0 x)) (sqrt x)) (* 0.5 (pow x -0.5))))
double code(double x) {
double tmp;
if (x <= 38000000.0) {
tmp = sqrt((1.0 + x)) - sqrt(x);
} else {
tmp = 0.5 * pow(x, -0.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 38000000.0d0) then
tmp = sqrt((1.0d0 + x)) - sqrt(x)
else
tmp = 0.5d0 * (x ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 38000000.0) {
tmp = Math.sqrt((1.0 + x)) - Math.sqrt(x);
} else {
tmp = 0.5 * Math.pow(x, -0.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 38000000.0: tmp = math.sqrt((1.0 + x)) - math.sqrt(x) else: tmp = 0.5 * math.pow(x, -0.5) return tmp
function code(x) tmp = 0.0 if (x <= 38000000.0) tmp = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)); else tmp = Float64(0.5 * (x ^ -0.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 38000000.0) tmp = sqrt((1.0 + x)) - sqrt(x); else tmp = 0.5 * (x ^ -0.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 38000000.0], N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 38000000:\\
\;\;\;\;\sqrt{1 + x} - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-0.5}\\
\end{array}
\end{array}
if x < 3.8e7Initial program 99.4%
if 3.8e7 < x Initial program 4.6%
flip--4.6%
div-inv4.6%
add-sqr-sqrt6.0%
add-sqr-sqrt6.0%
associate--l+6.0%
Applied egg-rr6.0%
associate-*r/6.0%
*-rgt-identity6.0%
+-commutative6.0%
associate-+l-99.7%
+-inverses99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 99.4%
rem-exp-log92.5%
exp-neg92.5%
unpow1/292.5%
exp-prod92.5%
distribute-lft-neg-out92.5%
distribute-rgt-neg-in92.5%
metadata-eval92.5%
exp-to-pow99.6%
Simplified99.6%
Final simplification99.5%
(FPCore (x) :precision binary64 (if (<= x 1.22) (+ 1.0 (- (* x (+ 0.5 (* x -0.125))) (sqrt x))) (* 0.5 (pow x -0.5))))
double code(double x) {
double tmp;
if (x <= 1.22) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x));
} else {
tmp = 0.5 * pow(x, -0.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.22d0) then
tmp = 1.0d0 + ((x * (0.5d0 + (x * (-0.125d0)))) - sqrt(x))
else
tmp = 0.5d0 * (x ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.22) {
tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.pow(x, -0.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.22: tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - math.sqrt(x)) else: tmp = 0.5 * math.pow(x, -0.5) return tmp
function code(x) tmp = 0.0 if (x <= 1.22) tmp = Float64(1.0 + Float64(Float64(x * Float64(0.5 + Float64(x * -0.125))) - sqrt(x))); else tmp = Float64(0.5 * (x ^ -0.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.22) tmp = 1.0 + ((x * (0.5 + (x * -0.125))) - sqrt(x)); else tmp = 0.5 * (x ^ -0.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.22], N[(1.0 + N[(N[(x * N[(0.5 + N[(x * -0.125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.22:\\
\;\;\;\;1 + \left(x \cdot \left(0.5 + x \cdot -0.125\right) - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-0.5}\\
\end{array}
\end{array}
if x < 1.21999999999999997Initial program 100.0%
Taylor expanded in x around 0 100.0%
associate--l+100.0%
*-commutative100.0%
Simplified100.0%
if 1.21999999999999997 < x Initial program 6.3%
flip--6.6%
div-inv6.6%
add-sqr-sqrt7.9%
add-sqr-sqrt8.2%
associate--l+8.2%
Applied egg-rr8.2%
associate-*r/8.2%
*-rgt-identity8.2%
+-commutative8.2%
associate-+l-99.7%
+-inverses99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 98.1%
rem-exp-log91.4%
exp-neg91.4%
unpow1/291.4%
exp-prod91.4%
distribute-lft-neg-out91.4%
distribute-rgt-neg-in91.4%
metadata-eval91.4%
exp-to-pow98.4%
Simplified98.4%
Final simplification99.2%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ (* x 0.5) (- 1.0 (sqrt x))) (* 0.5 (pow x -0.5))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = (x * 0.5) + (1.0 - sqrt(x));
} else {
tmp = 0.5 * 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 = (x * 0.5d0) + (1.0d0 - sqrt(x))
else
tmp = 0.5d0 * (x ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = (x * 0.5) + (1.0 - Math.sqrt(x));
} else {
tmp = 0.5 * Math.pow(x, -0.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = (x * 0.5) + (1.0 - math.sqrt(x)) else: tmp = 0.5 * math.pow(x, -0.5) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(Float64(x * 0.5) + Float64(1.0 - sqrt(x))); else tmp = Float64(0.5 * (x ^ -0.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = (x * 0.5) + (1.0 - sqrt(x)); else tmp = 0.5 * (x ^ -0.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(N[(x * 0.5), $MachinePrecision] + N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;x \cdot 0.5 + \left(1 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-0.5}\\
\end{array}
\end{array}
if x < 1Initial program 100.0%
Taylor expanded in x around 0 99.9%
*-commutative99.9%
Simplified99.9%
+-commutative99.9%
associate--l+99.9%
Applied egg-rr99.9%
if 1 < x Initial program 6.3%
flip--6.6%
div-inv6.6%
add-sqr-sqrt7.9%
add-sqr-sqrt8.2%
associate--l+8.2%
Applied egg-rr8.2%
associate-*r/8.2%
*-rgt-identity8.2%
+-commutative8.2%
associate-+l-99.7%
+-inverses99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 98.1%
rem-exp-log91.4%
exp-neg91.4%
unpow1/291.4%
exp-prod91.4%
distribute-lft-neg-out91.4%
distribute-rgt-neg-in91.4%
metadata-eval91.4%
exp-to-pow98.4%
Simplified98.4%
Final simplification99.1%
(FPCore (x) :precision binary64 (if (<= x 1.0) (+ 1.0 (- (* x 0.5) (sqrt x))) (* 0.5 (pow x -0.5))))
double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 + ((x * 0.5) - sqrt(x));
} else {
tmp = 0.5 * 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 = 1.0d0 + ((x * 0.5d0) - sqrt(x))
else
tmp = 0.5d0 * (x ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 1.0) {
tmp = 1.0 + ((x * 0.5) - Math.sqrt(x));
} else {
tmp = 0.5 * Math.pow(x, -0.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 1.0: tmp = 1.0 + ((x * 0.5) - math.sqrt(x)) else: tmp = 0.5 * math.pow(x, -0.5) return tmp
function code(x) tmp = 0.0 if (x <= 1.0) tmp = Float64(1.0 + Float64(Float64(x * 0.5) - sqrt(x))); else tmp = Float64(0.5 * (x ^ -0.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 1.0) tmp = 1.0 + ((x * 0.5) - sqrt(x)); else tmp = 0.5 * (x ^ -0.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 1.0], N[(1.0 + N[(N[(x * 0.5), $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1:\\
\;\;\;\;1 + \left(x \cdot 0.5 - \sqrt{x}\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-0.5}\\
\end{array}
\end{array}
if x < 1Initial program 100.0%
Taylor expanded in x around 0 99.9%
*-commutative99.9%
Simplified99.9%
associate--l+99.9%
+-commutative99.9%
Applied egg-rr99.9%
if 1 < x Initial program 6.3%
flip--6.6%
div-inv6.6%
add-sqr-sqrt7.9%
add-sqr-sqrt8.2%
associate--l+8.2%
Applied egg-rr8.2%
associate-*r/8.2%
*-rgt-identity8.2%
+-commutative8.2%
associate-+l-99.7%
+-inverses99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 98.1%
rem-exp-log91.4%
exp-neg91.4%
unpow1/291.4%
exp-prod91.4%
distribute-lft-neg-out91.4%
distribute-rgt-neg-in91.4%
metadata-eval91.4%
exp-to-pow98.4%
Simplified98.4%
Final simplification99.1%
(FPCore (x) :precision binary64 (if (<= x 0.36) (- 1.0 (sqrt x)) (* 0.5 (pow x -0.5))))
double code(double x) {
double tmp;
if (x <= 0.36) {
tmp = 1.0 - sqrt(x);
} else {
tmp = 0.5 * pow(x, -0.5);
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.36d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = 0.5d0 * (x ** (-0.5d0))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.36) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = 0.5 * Math.pow(x, -0.5);
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.36: tmp = 1.0 - math.sqrt(x) else: tmp = 0.5 * math.pow(x, -0.5) return tmp
function code(x) tmp = 0.0 if (x <= 0.36) tmp = Float64(1.0 - sqrt(x)); else tmp = Float64(0.5 * (x ^ -0.5)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.36) tmp = 1.0 - sqrt(x); else tmp = 0.5 * (x ^ -0.5); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.36], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[x, -0.5], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.36:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {x}^{-0.5}\\
\end{array}
\end{array}
if x < 0.35999999999999999Initial program 100.0%
Taylor expanded in x around 0 98.8%
if 0.35999999999999999 < x Initial program 6.3%
flip--6.6%
div-inv6.6%
add-sqr-sqrt7.9%
add-sqr-sqrt8.2%
associate--l+8.2%
Applied egg-rr8.2%
associate-*r/8.2%
*-rgt-identity8.2%
+-commutative8.2%
associate-+l-99.7%
+-inverses99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 98.1%
rem-exp-log91.4%
exp-neg91.4%
unpow1/291.4%
exp-prod91.4%
distribute-lft-neg-out91.4%
distribute-rgt-neg-in91.4%
metadata-eval91.4%
exp-to-pow98.4%
Simplified98.4%
Final simplification98.6%
(FPCore (x) :precision binary64 (if (<= x 0.135) (+ 1.0 (sqrt x)) (sqrt (/ 0.25 x))))
double code(double x) {
double tmp;
if (x <= 0.135) {
tmp = 1.0 + sqrt(x);
} else {
tmp = sqrt((0.25 / x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.135d0) then
tmp = 1.0d0 + sqrt(x)
else
tmp = sqrt((0.25d0 / x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.135) {
tmp = 1.0 + Math.sqrt(x);
} else {
tmp = Math.sqrt((0.25 / x));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.135: tmp = 1.0 + math.sqrt(x) else: tmp = math.sqrt((0.25 / x)) return tmp
function code(x) tmp = 0.0 if (x <= 0.135) tmp = Float64(1.0 + sqrt(x)); else tmp = sqrt(Float64(0.25 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.135) tmp = 1.0 + sqrt(x); else tmp = sqrt((0.25 / x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.135], N[(1.0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(0.25 / x), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.135:\\
\;\;\;\;1 + \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{0.25}{x}}\\
\end{array}
\end{array}
if x < 0.13500000000000001Initial program 100.0%
Taylor expanded in x around 0 98.8%
sub-neg98.8%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt96.7%
rem-sqrt-square96.7%
sqr-neg96.7%
rem-square-sqrt96.7%
Simplified96.7%
if 0.13500000000000001 < x Initial program 6.3%
flip--6.6%
div-inv6.6%
add-sqr-sqrt7.9%
add-sqr-sqrt8.2%
associate--l+8.2%
Applied egg-rr8.2%
associate-*r/8.2%
*-rgt-identity8.2%
+-commutative8.2%
associate-+l-99.7%
+-inverses99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 98.0%
*-commutative98.0%
Simplified98.0%
frac-2neg98.0%
metadata-eval98.0%
div-inv98.0%
distribute-rgt-neg-in98.0%
metadata-eval98.0%
Applied egg-rr98.0%
associate-*r/98.0%
metadata-eval98.0%
*-commutative98.0%
associate-/r*98.0%
metadata-eval98.0%
Simplified98.0%
*-un-lft-identity98.0%
*-commutative98.0%
add-sqr-sqrt97.5%
sqrt-unprod98.0%
frac-times97.9%
metadata-eval97.9%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
*-rgt-identity98.1%
Simplified98.1%
Final simplification97.4%
(FPCore (x) :precision binary64 (if (<= x 0.36) (- 1.0 (sqrt x)) (sqrt (/ 0.25 x))))
double code(double x) {
double tmp;
if (x <= 0.36) {
tmp = 1.0 - sqrt(x);
} else {
tmp = sqrt((0.25 / x));
}
return tmp;
}
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.36d0) then
tmp = 1.0d0 - sqrt(x)
else
tmp = sqrt((0.25d0 / x))
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (x <= 0.36) {
tmp = 1.0 - Math.sqrt(x);
} else {
tmp = Math.sqrt((0.25 / x));
}
return tmp;
}
def code(x): tmp = 0 if x <= 0.36: tmp = 1.0 - math.sqrt(x) else: tmp = math.sqrt((0.25 / x)) return tmp
function code(x) tmp = 0.0 if (x <= 0.36) tmp = Float64(1.0 - sqrt(x)); else tmp = sqrt(Float64(0.25 / x)); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (x <= 0.36) tmp = 1.0 - sqrt(x); else tmp = sqrt((0.25 / x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[x, 0.36], N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(0.25 / x), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.36:\\
\;\;\;\;1 - \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{0.25}{x}}\\
\end{array}
\end{array}
if x < 0.35999999999999999Initial program 100.0%
Taylor expanded in x around 0 98.8%
if 0.35999999999999999 < x Initial program 6.3%
flip--6.6%
div-inv6.6%
add-sqr-sqrt7.9%
add-sqr-sqrt8.2%
associate--l+8.2%
Applied egg-rr8.2%
associate-*r/8.2%
*-rgt-identity8.2%
+-commutative8.2%
associate-+l-99.7%
+-inverses99.7%
metadata-eval99.7%
+-commutative99.7%
Simplified99.7%
Taylor expanded in x around inf 98.0%
*-commutative98.0%
Simplified98.0%
frac-2neg98.0%
metadata-eval98.0%
div-inv98.0%
distribute-rgt-neg-in98.0%
metadata-eval98.0%
Applied egg-rr98.0%
associate-*r/98.0%
metadata-eval98.0%
*-commutative98.0%
associate-/r*98.0%
metadata-eval98.0%
Simplified98.0%
*-un-lft-identity98.0%
*-commutative98.0%
add-sqr-sqrt97.5%
sqrt-unprod98.0%
frac-times97.9%
metadata-eval97.9%
add-sqr-sqrt98.1%
Applied egg-rr98.1%
*-rgt-identity98.1%
Simplified98.1%
Final simplification98.5%
(FPCore (x) :precision binary64 (sqrt (/ 0.25 x)))
double code(double x) {
return sqrt((0.25 / x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt((0.25d0 / x))
end function
public static double code(double x) {
return Math.sqrt((0.25 / x));
}
def code(x): return math.sqrt((0.25 / x))
function code(x) return sqrt(Float64(0.25 / x)) end
function tmp = code(x) tmp = sqrt((0.25 / x)); end
code[x_] := N[Sqrt[N[(0.25 / x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{\frac{0.25}{x}}
\end{array}
Initial program 52.0%
flip--52.2%
div-inv52.2%
add-sqr-sqrt52.8%
add-sqr-sqrt53.0%
associate--l+53.0%
Applied egg-rr53.0%
associate-*r/53.0%
*-rgt-identity53.0%
+-commutative53.0%
associate-+l-99.8%
+-inverses99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 53.4%
*-commutative53.4%
Simplified53.4%
frac-2neg53.4%
metadata-eval53.4%
div-inv53.4%
distribute-rgt-neg-in53.4%
metadata-eval53.4%
Applied egg-rr53.4%
associate-*r/53.4%
metadata-eval53.4%
*-commutative53.4%
associate-/r*53.4%
metadata-eval53.4%
Simplified53.4%
*-un-lft-identity53.4%
*-commutative53.4%
add-sqr-sqrt53.1%
sqrt-unprod53.4%
frac-times53.3%
metadata-eval53.3%
add-sqr-sqrt53.4%
Applied egg-rr53.4%
*-rgt-identity53.4%
Simplified53.4%
Final simplification53.4%
(FPCore (x) :precision binary64 (sqrt x))
double code(double x) {
return sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = sqrt(x)
end function
public static double code(double x) {
return Math.sqrt(x);
}
def code(x): return math.sqrt(x)
function code(x) return sqrt(x) end
function tmp = code(x) tmp = sqrt(x); end
code[x_] := N[Sqrt[x], $MachinePrecision]
\begin{array}{l}
\\
\sqrt{x}
\end{array}
Initial program 52.0%
Taylor expanded in x around 0 49.1%
sub-neg49.1%
rem-square-sqrt0.0%
fabs-sqr0.0%
rem-square-sqrt50.1%
rem-sqrt-square50.1%
sqr-neg50.1%
rem-square-sqrt50.1%
Simplified50.1%
Taylor expanded in x around inf 6.1%
Final simplification6.1%
(FPCore (x) :precision binary64 (/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x))))
double code(double x) {
return 1.0 / (sqrt((x + 1.0)) + sqrt(x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / (sqrt((x + 1.0d0)) + sqrt(x))
end function
public static double code(double x) {
return 1.0 / (Math.sqrt((x + 1.0)) + Math.sqrt(x));
}
def code(x): return 1.0 / (math.sqrt((x + 1.0)) + math.sqrt(x))
function code(x) return Float64(1.0 / Float64(sqrt(Float64(x + 1.0)) + sqrt(x))) end
function tmp = code(x) tmp = 1.0 / (sqrt((x + 1.0)) + sqrt(x)); end
code[x_] := N[(1.0 / N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{x + 1} + \sqrt{x}}
\end{array}
herbie shell --seed 2024095
(FPCore (x)
:name "Main:bigenough3 from C"
:precision binary64
:alt
(/ 1.0 (+ (sqrt (+ x 1.0)) (sqrt x)))
(- (sqrt (+ x 1.0)) (sqrt x)))