
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
public static double code(double x) {
return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
def code(x): return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
function code(x) return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0)))) end
function tmp = code(x) tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0))); end
code[x_] := N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))
double code(double x) {
return (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 / sqrt(x)) - (1.0d0 / sqrt((x + 1.0d0)))
end function
public static double code(double x) {
return (1.0 / Math.sqrt(x)) - (1.0 / Math.sqrt((x + 1.0)));
}
def code(x): return (1.0 / math.sqrt(x)) - (1.0 / math.sqrt((x + 1.0)))
function code(x) return Float64(Float64(1.0 / sqrt(x)) - Float64(1.0 / sqrt(Float64(x + 1.0)))) end
function tmp = code(x) tmp = (1.0 / sqrt(x)) - (1.0 / sqrt((x + 1.0))); end
code[x_] := N[(N[(1.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - N[(1.0 / N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\sqrt{x}} - \frac{1}{\sqrt{x + 1}}
\end{array}
(FPCore (x) :precision binary64 (/ (* (/ 1.0 x) (+ 0.5 (/ (- (+ -0.125 (/ 0.0625 x)) (/ 0.0390625 (* x x))) x))) (pow (+ 1.0 x) 0.5)))
double code(double x) {
return ((1.0 / x) * (0.5 + (((-0.125 + (0.0625 / x)) - (0.0390625 / (x * x))) / x))) / pow((1.0 + x), 0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((1.0d0 / x) * (0.5d0 + ((((-0.125d0) + (0.0625d0 / x)) - (0.0390625d0 / (x * x))) / x))) / ((1.0d0 + x) ** 0.5d0)
end function
public static double code(double x) {
return ((1.0 / x) * (0.5 + (((-0.125 + (0.0625 / x)) - (0.0390625 / (x * x))) / x))) / Math.pow((1.0 + x), 0.5);
}
def code(x): return ((1.0 / x) * (0.5 + (((-0.125 + (0.0625 / x)) - (0.0390625 / (x * x))) / x))) / math.pow((1.0 + x), 0.5)
function code(x) return Float64(Float64(Float64(1.0 / x) * Float64(0.5 + Float64(Float64(Float64(-0.125 + Float64(0.0625 / x)) - Float64(0.0390625 / Float64(x * x))) / x))) / (Float64(1.0 + x) ^ 0.5)) end
function tmp = code(x) tmp = ((1.0 / x) * (0.5 + (((-0.125 + (0.0625 / x)) - (0.0390625 / (x * x))) / x))) / ((1.0 + x) ^ 0.5); end
code[x_] := N[(N[(N[(1.0 / x), $MachinePrecision] * N[(0.5 + N[(N[(N[(-0.125 + N[(0.0625 / x), $MachinePrecision]), $MachinePrecision] - N[(0.0390625 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{1}{x} \cdot \left(0.5 + \frac{\left(-0.125 + \frac{0.0625}{x}\right) - \frac{0.0390625}{x \cdot x}}{x}\right)}{{\left(1 + x\right)}^{0.5}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
Simplified99.2%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
associate-*r*N/A
associate-/r*N/A
sub-divN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6499.2%
Applied egg-rr99.2%
(FPCore (x) :precision binary64 (/ (+ (/ (/ (+ -0.125 (/ (- 0.0625 (/ 0.0390625 x)) x)) x) x) (/ 0.5 x)) (pow (+ 1.0 x) 0.5)))
double code(double x) {
return ((((-0.125 + ((0.0625 - (0.0390625 / x)) / x)) / x) / x) + (0.5 / x)) / pow((1.0 + x), 0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (((((-0.125d0) + ((0.0625d0 - (0.0390625d0 / x)) / x)) / x) / x) + (0.5d0 / x)) / ((1.0d0 + x) ** 0.5d0)
end function
public static double code(double x) {
return ((((-0.125 + ((0.0625 - (0.0390625 / x)) / x)) / x) / x) + (0.5 / x)) / Math.pow((1.0 + x), 0.5);
}
def code(x): return ((((-0.125 + ((0.0625 - (0.0390625 / x)) / x)) / x) / x) + (0.5 / x)) / math.pow((1.0 + x), 0.5)
function code(x) return Float64(Float64(Float64(Float64(Float64(-0.125 + Float64(Float64(0.0625 - Float64(0.0390625 / x)) / x)) / x) / x) + Float64(0.5 / x)) / (Float64(1.0 + x) ^ 0.5)) end
function tmp = code(x) tmp = ((((-0.125 + ((0.0625 - (0.0390625 / x)) / x)) / x) / x) + (0.5 / x)) / ((1.0 + x) ^ 0.5); end
code[x_] := N[(N[(N[(N[(N[(-0.125 + N[(N[(0.0625 - N[(0.0390625 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / x), $MachinePrecision] + N[(0.5 / x), $MachinePrecision]), $MachinePrecision] / N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\frac{-0.125 + \frac{0.0625 - \frac{0.0390625}{x}}{x}}{x}}{x} + \frac{0.5}{x}}{{\left(1 + x\right)}^{0.5}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
Simplified99.2%
clear-numN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
associate-*r*N/A
associate-/r*N/A
sub-divN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6499.2%
Applied egg-rr99.2%
+-commutativeN/A
distribute-lft-inN/A
associate-*l/N/A
metadata-evalN/A
+-lowering-+.f64N/A
Applied egg-rr99.2%
(FPCore (x) :precision binary64 (/ (/ (+ 0.5 (/ (+ -0.125 (/ (+ 0.0625 (/ -0.0390625 x)) x)) x)) x) (pow (+ 1.0 x) 0.5)))
double code(double x) {
return ((0.5 + ((-0.125 + ((0.0625 + (-0.0390625 / x)) / x)) / x)) / x) / pow((1.0 + x), 0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((0.5d0 + (((-0.125d0) + ((0.0625d0 + ((-0.0390625d0) / x)) / x)) / x)) / x) / ((1.0d0 + x) ** 0.5d0)
end function
public static double code(double x) {
return ((0.5 + ((-0.125 + ((0.0625 + (-0.0390625 / x)) / x)) / x)) / x) / Math.pow((1.0 + x), 0.5);
}
def code(x): return ((0.5 + ((-0.125 + ((0.0625 + (-0.0390625 / x)) / x)) / x)) / x) / math.pow((1.0 + x), 0.5)
function code(x) return Float64(Float64(Float64(0.5 + Float64(Float64(-0.125 + Float64(Float64(0.0625 + Float64(-0.0390625 / x)) / x)) / x)) / x) / (Float64(1.0 + x) ^ 0.5)) end
function tmp = code(x) tmp = ((0.5 + ((-0.125 + ((0.0625 + (-0.0390625 / x)) / x)) / x)) / x) / ((1.0 + x) ^ 0.5); end
code[x_] := N[(N[(N[(0.5 + N[(N[(-0.125 + N[(N[(0.0625 + N[(-0.0390625 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5 + \frac{-0.125 + \frac{0.0625 + \frac{-0.0390625}{x}}{x}}{x}}{x}}{{\left(1 + x\right)}^{0.5}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
Simplified99.2%
Taylor expanded in x around inf
Simplified99.2%
(FPCore (x) :precision binary64 (/ (/ (pow (+ 1.0 x) -0.5) x) (+ 2.0 (/ (+ 0.5 (/ -0.125 x)) x))))
double code(double x) {
return (pow((1.0 + x), -0.5) / x) / (2.0 + ((0.5 + (-0.125 / x)) / x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (((1.0d0 + x) ** (-0.5d0)) / x) / (2.0d0 + ((0.5d0 + ((-0.125d0) / x)) / x))
end function
public static double code(double x) {
return (Math.pow((1.0 + x), -0.5) / x) / (2.0 + ((0.5 + (-0.125 / x)) / x));
}
def code(x): return (math.pow((1.0 + x), -0.5) / x) / (2.0 + ((0.5 + (-0.125 / x)) / x))
function code(x) return Float64(Float64((Float64(1.0 + x) ^ -0.5) / x) / Float64(2.0 + Float64(Float64(0.5 + Float64(-0.125 / x)) / x))) end
function tmp = code(x) tmp = (((1.0 + x) ^ -0.5) / x) / (2.0 + ((0.5 + (-0.125 / x)) / x)); end
code[x_] := N[(N[(N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision] / x), $MachinePrecision] / N[(2.0 + N[(N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{{\left(1 + x\right)}^{-0.5}}{x}}{2 + \frac{0.5 + \frac{-0.125}{x}}{x}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
*-lowering-*.f64N/A
associate--l+N/A
unpow2N/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
*-commutativeN/A
cancel-sign-sub-invN/A
distribute-neg-frac2N/A
mul-1-negN/A
rem-square-sqrtN/A
unpow2N/A
*-commutativeN/A
*-commutativeN/A
Simplified38.4%
div-invN/A
associate-/r*N/A
associate-*l/N/A
associate--l+N/A
+-inversesN/A
metadata-evalN/A
/-lowering-/.f64N/A
Applied egg-rr97.0%
/-lowering-/.f64N/A
*-commutativeN/A
pow1/2N/A
metadata-evalN/A
pow-powN/A
pow2N/A
associate-/r*N/A
/-lowering-/.f64N/A
pow-flipN/A
metadata-evalN/A
metadata-evalN/A
pow-prod-downN/A
sqr-powN/A
pow-lowering-pow.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
/-lowering-/.f6498.8%
Applied egg-rr98.8%
(FPCore (x) :precision binary64 (/ (/ (+ 0.5 (/ (+ -0.125 (/ 0.0625 x)) x)) x) (pow (+ 1.0 x) 0.5)))
double code(double x) {
return ((0.5 + ((-0.125 + (0.0625 / x)) / x)) / x) / pow((1.0 + x), 0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((0.5d0 + (((-0.125d0) + (0.0625d0 / x)) / x)) / x) / ((1.0d0 + x) ** 0.5d0)
end function
public static double code(double x) {
return ((0.5 + ((-0.125 + (0.0625 / x)) / x)) / x) / Math.pow((1.0 + x), 0.5);
}
def code(x): return ((0.5 + ((-0.125 + (0.0625 / x)) / x)) / x) / math.pow((1.0 + x), 0.5)
function code(x) return Float64(Float64(Float64(0.5 + Float64(Float64(-0.125 + Float64(0.0625 / x)) / x)) / x) / (Float64(1.0 + x) ^ 0.5)) end
function tmp = code(x) tmp = ((0.5 + ((-0.125 + (0.0625 / x)) / x)) / x) / ((1.0 + x) ^ 0.5); end
code[x_] := N[(N[(N[(0.5 + N[(N[(-0.125 + N[(0.0625 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5 + \frac{-0.125 + \frac{0.0625}{x}}{x}}{x}}{{\left(1 + x\right)}^{0.5}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
Simplified98.8%
(FPCore (x) :precision binary64 (/ (pow (+ 1.0 x) -0.5) (+ (/ x 0.5) (+ 0.5 (/ -0.125 x)))))
double code(double x) {
return pow((1.0 + x), -0.5) / ((x / 0.5) + (0.5 + (-0.125 / x)));
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((1.0d0 + x) ** (-0.5d0)) / ((x / 0.5d0) + (0.5d0 + ((-0.125d0) / x)))
end function
public static double code(double x) {
return Math.pow((1.0 + x), -0.5) / ((x / 0.5) + (0.5 + (-0.125 / x)));
}
def code(x): return math.pow((1.0 + x), -0.5) / ((x / 0.5) + (0.5 + (-0.125 / x)))
function code(x) return Float64((Float64(1.0 + x) ^ -0.5) / Float64(Float64(x / 0.5) + Float64(0.5 + Float64(-0.125 / x)))) end
function tmp = code(x) tmp = ((1.0 + x) ^ -0.5) / ((x / 0.5) + (0.5 + (-0.125 / x))); end
code[x_] := N[(N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision] / N[(N[(x / 0.5), $MachinePrecision] + N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(1 + x\right)}^{-0.5}}{\frac{x}{0.5} + \left(0.5 + \frac{-0.125}{x}\right)}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
*-lowering-*.f64N/A
associate--l+N/A
unpow2N/A
associate-/r*N/A
metadata-evalN/A
associate-*r/N/A
associate-*r/N/A
metadata-evalN/A
div-subN/A
*-commutativeN/A
cancel-sign-sub-invN/A
distribute-neg-frac2N/A
mul-1-negN/A
rem-square-sqrtN/A
unpow2N/A
*-commutativeN/A
*-commutativeN/A
Simplified38.4%
associate-/l/N/A
associate--l+N/A
+-inversesN/A
metadata-evalN/A
associate-/r*N/A
/-lowering-/.f64N/A
pow-flipN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
distribute-lft-inN/A
metadata-evalN/A
div-invN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
*-commutativeN/A
div-invN/A
associate-*l*N/A
inv-powN/A
pow-plusN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x) :precision binary64 (/ (/ (+ 0.5 (/ -0.125 x)) x) (pow (+ 1.0 x) 0.5)))
double code(double x) {
return ((0.5 + (-0.125 / x)) / x) / pow((1.0 + x), 0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((0.5d0 + ((-0.125d0) / x)) / x) / ((1.0d0 + x) ** 0.5d0)
end function
public static double code(double x) {
return ((0.5 + (-0.125 / x)) / x) / Math.pow((1.0 + x), 0.5);
}
def code(x): return ((0.5 + (-0.125 / x)) / x) / math.pow((1.0 + x), 0.5)
function code(x) return Float64(Float64(Float64(0.5 + Float64(-0.125 / x)) / x) / (Float64(1.0 + x) ^ 0.5)) end
function tmp = code(x) tmp = ((0.5 + (-0.125 / x)) / x) / ((1.0 + x) ^ 0.5); end
code[x_] := N[(N[(N[(0.5 + N[(-0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] / N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5 + \frac{-0.125}{x}}{x}}{{\left(1 + x\right)}^{0.5}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
*-commutativeN/A
cancel-sign-sub-invN/A
distribute-neg-frac2N/A
mul-1-negN/A
rem-square-sqrtN/A
unpow2N/A
*-commutativeN/A
*-commutativeN/A
/-lowering-/.f64N/A
Simplified98.1%
(FPCore (x) :precision binary64 (/ (pow (+ 1.0 x) -0.5) (/ x 0.5)))
double code(double x) {
return pow((1.0 + x), -0.5) / (x / 0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = ((1.0d0 + x) ** (-0.5d0)) / (x / 0.5d0)
end function
public static double code(double x) {
return Math.pow((1.0 + x), -0.5) / (x / 0.5);
}
def code(x): return math.pow((1.0 + x), -0.5) / (x / 0.5)
function code(x) return Float64((Float64(1.0 + x) ^ -0.5) / Float64(x / 0.5)) end
function tmp = code(x) tmp = ((1.0 + x) ^ -0.5) / (x / 0.5); end
code[x_] := N[(N[Power[N[(1.0 + x), $MachinePrecision], -0.5], $MachinePrecision] / N[(x / 0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left(1 + x\right)}^{-0.5}}{\frac{x}{0.5}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
/-lowering-/.f6496.8%
Simplified96.8%
div-invN/A
clear-numN/A
associate-*l/N/A
div-invN/A
/-lowering-/.f64N/A
pow-flipN/A
metadata-evalN/A
pow-lowering-pow.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f6496.8%
Applied egg-rr96.8%
Final simplification96.8%
(FPCore (x) :precision binary64 (/ (/ 0.5 x) (pow (+ 1.0 x) 0.5)))
double code(double x) {
return (0.5 / x) / pow((1.0 + x), 0.5);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (0.5d0 / x) / ((1.0d0 + x) ** 0.5d0)
end function
public static double code(double x) {
return (0.5 / x) / Math.pow((1.0 + x), 0.5);
}
def code(x): return (0.5 / x) / math.pow((1.0 + x), 0.5)
function code(x) return Float64(Float64(0.5 / x) / (Float64(1.0 + x) ^ 0.5)) end
function tmp = code(x) tmp = (0.5 / x) / ((1.0 + x) ^ 0.5); end
code[x_] := N[(N[(0.5 / x), $MachinePrecision] / N[Power[N[(1.0 + x), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{x}}{{\left(1 + x\right)}^{0.5}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
/-lowering-/.f6496.8%
Simplified96.8%
(FPCore (x) :precision binary64 (/ (/ 0.5 (sqrt (+ 1.0 x))) x))
double code(double x) {
return (0.5 / sqrt((1.0 + x))) / x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = (0.5d0 / sqrt((1.0d0 + x))) / x
end function
public static double code(double x) {
return (0.5 / Math.sqrt((1.0 + x))) / x;
}
def code(x): return (0.5 / math.sqrt((1.0 + x))) / x
function code(x) return Float64(Float64(0.5 / sqrt(Float64(1.0 + x))) / x) end
function tmp = code(x) tmp = (0.5 / sqrt((1.0 + x))) / x; end
code[x_] := N[(N[(0.5 / N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{\sqrt{1 + x}}}{x}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
/-lowering-/.f6496.8%
Simplified96.8%
associate-/l/N/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
unpow1/2N/A
sqrt-lowering-sqrt.f64N/A
+-commutativeN/A
+-lowering-+.f6496.7%
Applied egg-rr96.7%
Final simplification96.7%
(FPCore (x) :precision binary64 (/ (/ 0.5 x) (sqrt x)))
double code(double x) {
return (0.5 / x) / sqrt(x);
}
real(8) function code(x)
real(8), intent (in) :: x
code = (0.5d0 / x) / sqrt(x)
end function
public static double code(double x) {
return (0.5 / x) / Math.sqrt(x);
}
def code(x): return (0.5 / x) / math.sqrt(x)
function code(x) return Float64(Float64(0.5 / x) / sqrt(x)) end
function tmp = code(x) tmp = (0.5 / x) / sqrt(x); end
code[x_] := N[(N[(0.5 / x), $MachinePrecision] / N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{x}}{\sqrt{x}}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
/-lowering-/.f6496.8%
Simplified96.8%
Taylor expanded in x around inf
sqrt-lowering-sqrt.f6496.6%
Simplified96.6%
(FPCore (x) :precision binary64 (/ (/ 0.5 x) (+ 1.0 (* x 0.5))))
double code(double x) {
return (0.5 / x) / (1.0 + (x * 0.5));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (0.5d0 / x) / (1.0d0 + (x * 0.5d0))
end function
public static double code(double x) {
return (0.5 / x) / (1.0 + (x * 0.5));
}
def code(x): return (0.5 / x) / (1.0 + (x * 0.5))
function code(x) return Float64(Float64(0.5 / x) / Float64(1.0 + Float64(x * 0.5))) end
function tmp = code(x) tmp = (0.5 / x) / (1.0 + (x * 0.5)); end
code[x_] := N[(N[(0.5 / x), $MachinePrecision] / N[(1.0 + N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{0.5}{x}}{1 + x \cdot 0.5}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
/-lowering-/.f6496.8%
Simplified96.8%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6435.3%
Simplified35.3%
(FPCore (x) :precision binary64 (/ 0.5 x))
double code(double x) {
return 0.5 / x;
}
real(8) function code(x)
real(8), intent (in) :: x
code = 0.5d0 / x
end function
public static double code(double x) {
return 0.5 / x;
}
def code(x): return 0.5 / x
function code(x) return Float64(0.5 / x) end
function tmp = code(x) tmp = 0.5 / x; end
code[x_] := N[(0.5 / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{0.5}{x}
\end{array}
Initial program 37.3%
Applied egg-rr39.2%
Taylor expanded in x around inf
/-lowering-/.f6496.8%
Simplified96.8%
Taylor expanded in x around 0
/-lowering-/.f647.9%
Simplified7.9%
(FPCore (x) :precision binary64 (/ 1.0 (+ (* (+ x 1.0) (sqrt x)) (* x (sqrt (+ x 1.0))))))
double code(double x) {
return 1.0 / (((x + 1.0) * sqrt(x)) + (x * sqrt((x + 1.0))));
}
real(8) function code(x)
real(8), intent (in) :: x
code = 1.0d0 / (((x + 1.0d0) * sqrt(x)) + (x * sqrt((x + 1.0d0))))
end function
public static double code(double x) {
return 1.0 / (((x + 1.0) * Math.sqrt(x)) + (x * Math.sqrt((x + 1.0))));
}
def code(x): return 1.0 / (((x + 1.0) * math.sqrt(x)) + (x * math.sqrt((x + 1.0))))
function code(x) return Float64(1.0 / Float64(Float64(Float64(x + 1.0) * sqrt(x)) + Float64(x * sqrt(Float64(x + 1.0))))) end
function tmp = code(x) tmp = 1.0 / (((x + 1.0) * sqrt(x)) + (x * sqrt((x + 1.0)))); end
code[x_] := N[(1.0 / N[(N[(N[(x + 1.0), $MachinePrecision] * N[Sqrt[x], $MachinePrecision]), $MachinePrecision] + N[(x * N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\left(x + 1\right) \cdot \sqrt{x} + x \cdot \sqrt{x + 1}}
\end{array}
herbie shell --seed 2024158
(FPCore (x)
:name "2isqrt (example 3.6)"
:precision binary64
:pre (and (> x 1.0) (< x 1e+308))
:alt
(! :herbie-platform default (/ 1 (+ (* (+ x 1) (sqrt x)) (* x (sqrt (+ x 1))))))
(- (/ 1.0 (sqrt x)) (/ 1.0 (sqrt (+ x 1.0)))))