(FPCore (x) :precision binary64 (pow (- (sqrt (+ x 1.0)) (sqrt x)) 2.0))
double code(double x) { return pow((sqrt((x + 1.0)) - sqrt(x)), 2.0); }
real(8) function code(x) real(8), intent (in) :: x code = (sqrt((x + 1.0d0)) - sqrt(x)) ** 2.0d0 end function
public static double code(double x) { return Math.pow((Math.sqrt((x + 1.0)) - Math.sqrt(x)), 2.0); }
def code(x): return math.pow((math.sqrt((x + 1.0)) - math.sqrt(x)), 2.0)
function code(x) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) ^ 2.0 end
function tmp = code(x) tmp = (sqrt((x + 1.0)) - sqrt(x)) ^ 2.0; end
code[x_] := N[Power[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l} \\ {\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2} \end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (x) :precision binary64 (pow (- (sqrt (+ x 1.0)) (sqrt x)) 2.0))
double code(double x) { return pow((sqrt((x + 1.0)) - sqrt(x)), 2.0); }
real(8) function code(x) real(8), intent (in) :: x code = (sqrt((x + 1.0d0)) - sqrt(x)) ** 2.0d0 end function
public static double code(double x) { return Math.pow((Math.sqrt((x + 1.0)) - Math.sqrt(x)), 2.0); }
def code(x): return math.pow((math.sqrt((x + 1.0)) - math.sqrt(x)), 2.0)
function code(x) return Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) ^ 2.0 end
function tmp = code(x) tmp = (sqrt((x + 1.0)) - sqrt(x)) ^ 2.0; end
code[x_] := N[Power[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l} \\ {\left(\sqrt{x + 1} - \sqrt{x}\right)}^{2} \end{array}
(FPCore (x) :precision binary64 (pow (* (/ (- (+ 1.0 x) x) (fma (sqrt x) x (pow (+ 1.0 x) 1.5))) (- (+ (+ 1.0 x) x) (sqrt (fma x x x)))) 2.0))
double code(double x) { return pow(((((1.0 + x) - x) / fma(sqrt(x), x, pow((1.0 + x), 1.5))) * (((1.0 + x) + x) - sqrt(fma(x, x, x)))), 2.0); }
function code(x) return Float64(Float64(Float64(Float64(1.0 + x) - x) / fma(sqrt(x), x, (Float64(1.0 + x) ^ 1.5))) * Float64(Float64(Float64(1.0 + x) + x) - sqrt(fma(x, x, x)))) ^ 2.0 end
code[x_] := N[Power[N[(N[(N[(N[(1.0 + x), $MachinePrecision] - x), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] * x + N[Power[N[(1.0 + x), $MachinePrecision], 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(1.0 + x), $MachinePrecision] + x), $MachinePrecision] - N[Sqrt[N[(x * x + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]
\begin{array}{l} \\ {\left(\frac{\left(1 + x\right) - x}{\mathsf{fma}\left(\sqrt{x}, x, {\left(1 + x\right)}^{1.5}\right)} \cdot \left(\left(\left(1 + x\right) + x\right) - \sqrt{\mathsf{fma}\left(x, x, x\right)}\right)\right)}^{2} \end{array}
Initial program 99.2%
Applied rewrites99.9%
lift-hypot.f64
N/A
lower-sqrt.f64
N/A
lift-sqrt.f64
N/A
lift-sqrt.f64
N/A
rem-square-sqrt
N/A
distribute-rgt1-in
N/A
distribute-lft1-in
N/A
lower-fma.f64
99.9
Applied rewrites99.9%
(FPCore (x) :precision binary64 (let* ((t_0 (+ (sqrt (+ x 1.0)) (sqrt x)))) (pow (* t_0 t_0) -1.0)))
double code(double x) { double t_0 = sqrt((x + 1.0)) + sqrt(x); return pow((t_0 * t_0), -1.0); }
real(8) function code(x) real(8), intent (in) :: x real(8) :: t_0 t_0 = sqrt((x + 1.0d0)) + sqrt(x) code = (t_0 * t_0) ** (-1.0d0) end function
public static double code(double x) { double t_0 = Math.sqrt((x + 1.0)) + Math.sqrt(x); return Math.pow((t_0 * t_0), -1.0); }
def code(x): t_0 = math.sqrt((x + 1.0)) + math.sqrt(x) return math.pow((t_0 * t_0), -1.0)
function code(x) t_0 = Float64(sqrt(Float64(x + 1.0)) + sqrt(x)) return Float64(t_0 * t_0) ^ -1.0 end
function tmp = code(x) t_0 = sqrt((x + 1.0)) + sqrt(x); tmp = (t_0 * t_0) ^ -1.0; end
code[x_] := Block[{t$95$0 = N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], -1.0], $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{x + 1} + \sqrt{x}\\ {\left(t\_0 \cdot t\_0\right)}^{-1} \end{array} \end{array}
Initial program 99.2%
lift-pow.f64
N/A
unpow2
N/A
lift--.f64
N/A
flip--
N/A
associate-*r/
N/A
clear-num
N/A
lower-/.f64
N/A
lower-/.f64
N/A
Applied rewrites99.2%
lift-/.f64
N/A
div-inv
N/A
lift--.f64
N/A
lift-+.f64
N/A
associate--l+
N/A
+-inverses
N/A
metadata-eval
N/A
lower-*.f64
N/A
associate-/r*
N/A
metadata-eval
N/A
Applied rewrites99.8%
Final simplification99.8%
(FPCore (x) :precision binary64 (let* ((t_0 (- 1.0 (sqrt x)))) (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.01) (/ (+ 0.25 (/ (- (/ 0.078125 x) 0.125) x)) x) (* (+ t_0 x) t_0))))
double code(double x) { double t_0 = 1.0 - sqrt(x); double tmp; if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01) { tmp = (0.25 + (((0.078125 / x) - 0.125) / x)) / x; } else { tmp = (t_0 + x) * t_0; } return tmp; }
real(8) function code(x) real(8), intent (in) :: x real(8) :: t_0 real(8) :: tmp t_0 = 1.0d0 - sqrt(x) if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.01d0) then tmp = (0.25d0 + (((0.078125d0 / x) - 0.125d0) / x)) / x else tmp = (t_0 + x) * t_0 end if code = tmp end function
public static double code(double x) { double t_0 = 1.0 - Math.sqrt(x); double tmp; if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.01) { tmp = (0.25 + (((0.078125 / x) - 0.125) / x)) / x; } else { tmp = (t_0 + x) * t_0; } return tmp; }
def code(x): t_0 = 1.0 - math.sqrt(x) tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.01: tmp = (0.25 + (((0.078125 / x) - 0.125) / x)) / x else: tmp = (t_0 + x) * t_0 return tmp
function code(x) t_0 = Float64(1.0 - sqrt(x)) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.01) tmp = Float64(Float64(0.25 + Float64(Float64(Float64(0.078125 / x) - 0.125) / x)) / x); else tmp = Float64(Float64(t_0 + x) * t_0); end return tmp end
function tmp_2 = code(x) t_0 = 1.0 - sqrt(x); tmp = 0.0; if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01) tmp = (0.25 + (((0.078125 / x) - 0.125) / x)) / x; else tmp = (t_0 + x) * t_0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.01], N[(N[(0.25 + N[(N[(N[(0.078125 / x), $MachinePrecision] - 0.125), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(t$95$0 + x), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \sqrt{x}\\ \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\ \;\;\;\;\frac{0.25 + \frac{\frac{0.078125}{x} - 0.125}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 + x\right) \cdot t\_0\\ \end{array} \end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0100000000000000002
Initial program 67.0%
Taylor expanded in x around inf
lower-/.f64
N/A
associate-+r+
N/A
associate--l+
N/A
+-commutative
N/A
associate-+l-
N/A
lower--.f64
N/A
lower-/.f64
N/A
lower--.f64
N/A
lower-fma.f64
N/A
lower-/.f64
N/A
unpow2
N/A
lower-*.f64
96.0
Applied rewrites96.0%
Taylor expanded in x around inf
Applied rewrites96.0%
if 0.0100000000000000002 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x))
Initial program 99.9%
Taylor expanded in x around 0
unpow2
N/A
distribute-rgt-out
N/A
*-commutative
N/A
lower-*.f64
N/A
+-commutative
N/A
lower-+.f64
N/A
lower--.f64
N/A
lower-sqrt.f64
N/A
lower--.f64
N/A
lower-sqrt.f64
99.1
Applied rewrites99.1%
Final simplification99.1%
(FPCore (x) :precision binary64 (let* ((t_0 (- 1.0 (sqrt x)))) (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.01) (/ (- 0.25 (/ 0.125 x)) x) (* (+ t_0 x) t_0))))
double code(double x) { double t_0 = 1.0 - sqrt(x); double tmp; if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01) { tmp = (0.25 - (0.125 / x)) / x; } else { tmp = (t_0 + x) * t_0; } return tmp; }
real(8) function code(x) real(8), intent (in) :: x real(8) :: t_0 real(8) :: tmp t_0 = 1.0d0 - sqrt(x) if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.01d0) then tmp = (0.25d0 - (0.125d0 / x)) / x else tmp = (t_0 + x) * t_0 end if code = tmp end function
public static double code(double x) { double t_0 = 1.0 - Math.sqrt(x); double tmp; if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.01) { tmp = (0.25 - (0.125 / x)) / x; } else { tmp = (t_0 + x) * t_0; } return tmp; }
def code(x): t_0 = 1.0 - math.sqrt(x) tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.01: tmp = (0.25 - (0.125 / x)) / x else: tmp = (t_0 + x) * t_0 return tmp
function code(x) t_0 = Float64(1.0 - sqrt(x)) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.01) tmp = Float64(Float64(0.25 - Float64(0.125 / x)) / x); else tmp = Float64(Float64(t_0 + x) * t_0); end return tmp end
function tmp_2 = code(x) t_0 = 1.0 - sqrt(x); tmp = 0.0; if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01) tmp = (0.25 - (0.125 / x)) / x; else tmp = (t_0 + x) * t_0; end tmp_2 = tmp; end
code[x_] := Block[{t$95$0 = N[(1.0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.01], N[(N[(0.25 - N[(0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(t$95$0 + x), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l} \\ \begin{array}{l} t_0 := 1 - \sqrt{x}\\ \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\ \;\;\;\;\frac{0.25 - \frac{0.125}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\left(t\_0 + x\right) \cdot t\_0\\ \end{array} \end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0100000000000000002
Initial program 67.0%
Taylor expanded in x around inf
unpow2
N/A
associate-/r*
N/A
lower-/.f64
N/A
div-sub
N/A
associate-/l*
N/A
*-rgt-identity
N/A
associate-*r/
N/A
rgt-mult-inverse
N/A
metadata-eval
N/A
lower--.f64
N/A
lower-/.f64
87.6
Applied rewrites87.6%
if 0.0100000000000000002 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x))
Initial program 99.9%
Taylor expanded in x around 0
unpow2
N/A
distribute-rgt-out
N/A
*-commutative
N/A
lower-*.f64
N/A
+-commutative
N/A
lower-+.f64
N/A
lower--.f64
N/A
lower-sqrt.f64
N/A
lower--.f64
N/A
lower-sqrt.f64
99.1
Applied rewrites99.1%
Final simplification98.9%
(FPCore (x) :precision binary64 (let* ((t_0 (sqrt (+ x 1.0)))) (/ (- t_0 (sqrt x)) (+ t_0 (sqrt x)))))
double code(double x) { double t_0 = sqrt((x + 1.0)); return (t_0 - sqrt(x)) / (t_0 + sqrt(x)); }
real(8) function code(x) real(8), intent (in) :: x real(8) :: t_0 t_0 = sqrt((x + 1.0d0)) code = (t_0 - sqrt(x)) / (t_0 + sqrt(x)) end function
public static double code(double x) { double t_0 = Math.sqrt((x + 1.0)); return (t_0 - Math.sqrt(x)) / (t_0 + Math.sqrt(x)); }
def code(x): t_0 = math.sqrt((x + 1.0)) return (t_0 - math.sqrt(x)) / (t_0 + math.sqrt(x))
function code(x) t_0 = sqrt(Float64(x + 1.0)) return Float64(Float64(t_0 - sqrt(x)) / Float64(t_0 + sqrt(x))) end
function tmp = code(x) t_0 = sqrt((x + 1.0)); tmp = (t_0 - sqrt(x)) / (t_0 + sqrt(x)); end
code[x_] := Block[{t$95$0 = N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision]}, N[(N[(t$95$0 - N[Sqrt[x], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{x + 1}\\ \frac{t\_0 - \sqrt{x}}{t\_0 + \sqrt{x}} \end{array} \end{array}
Initial program 99.2%
Applied rewrites99.9%
Applied rewrites99.3%
(FPCore (x) :precision binary64 (if (<= (- (sqrt (+ x 1.0)) (sqrt x)) 0.01) (/ (- 0.25 (/ 0.125 x)) x) (- 1.0 (* 2.0 (sqrt x)))))
double code(double x) { double tmp; if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01) { tmp = (0.25 - (0.125 / x)) / x; } else { tmp = 1.0 - (2.0 * sqrt(x)); } return tmp; }
real(8) function code(x) real(8), intent (in) :: x real(8) :: tmp if ((sqrt((x + 1.0d0)) - sqrt(x)) <= 0.01d0) then tmp = (0.25d0 - (0.125d0 / x)) / x else tmp = 1.0d0 - (2.0d0 * sqrt(x)) end if code = tmp end function
public static double code(double x) { double tmp; if ((Math.sqrt((x + 1.0)) - Math.sqrt(x)) <= 0.01) { tmp = (0.25 - (0.125 / x)) / x; } else { tmp = 1.0 - (2.0 * Math.sqrt(x)); } return tmp; }
def code(x): tmp = 0 if (math.sqrt((x + 1.0)) - math.sqrt(x)) <= 0.01: tmp = (0.25 - (0.125 / x)) / x else: tmp = 1.0 - (2.0 * math.sqrt(x)) return tmp
function code(x) tmp = 0.0 if (Float64(sqrt(Float64(x + 1.0)) - sqrt(x)) <= 0.01) tmp = Float64(Float64(0.25 - Float64(0.125 / x)) / x); else tmp = Float64(1.0 - Float64(2.0 * sqrt(x))); end return tmp end
function tmp_2 = code(x) tmp = 0.0; if ((sqrt((x + 1.0)) - sqrt(x)) <= 0.01) tmp = (0.25 - (0.125 / x)) / x; else tmp = 1.0 - (2.0 * sqrt(x)); end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[Sqrt[N[(x + 1.0), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision], 0.01], N[(N[(0.25 - N[(0.125 / x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(1.0 - N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\sqrt{x + 1} - \sqrt{x} \leq 0.01:\\ \;\;\;\;\frac{0.25 - \frac{0.125}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;1 - 2 \cdot \sqrt{x}\\ \end{array} \end{array}
if (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x)) < 0.0100000000000000002
Initial program 67.0%
Taylor expanded in x around inf
unpow2
N/A
associate-/r*
N/A
lower-/.f64
N/A
div-sub
N/A
associate-/l*
N/A
*-rgt-identity
N/A
associate-*r/
N/A
rgt-mult-inverse
N/A
metadata-eval
N/A
lower--.f64
N/A
lower-/.f64
87.6
Applied rewrites87.6%
if 0.0100000000000000002 < (-.f64 (sqrt.f64 (+.f64 x #s(literal 1 binary64))) (sqrt.f64 x))
Initial program 99.9%
lift-pow.f64
N/A
unpow2
N/A
lift--.f64
N/A
sub-neg
N/A
distribute-rgt-in
N/A
*-commutative
N/A
lift--.f64
N/A
sub-neg
N/A
+-commutative
N/A
distribute-lft-in
N/A
sqr-neg
N/A
lift-sqrt.f64
N/A
lift-sqrt.f64
N/A
rem-square-sqrt
N/A
cancel-sign-sub-inv
N/A
rem-square-sqrt
N/A
lift-sqrt.f64
N/A
lift-sqrt.f64
N/A
*-commutative
N/A
Applied rewrites99.9%
Taylor expanded in x around 0
lower--.f64
N/A
lower-*.f64
N/A
lower-sqrt.f64
97.7
Applied rewrites97.7%
Final simplification97.5%
(FPCore (x) :precision binary64 (let* ((t_0 (- (sqrt (+ 1.0 x)) (sqrt x)))) (* t_0 t_0)))
double code(double x) { double t_0 = sqrt((1.0 + x)) - sqrt(x); return t_0 * t_0; }
real(8) function code(x) real(8), intent (in) :: x real(8) :: t_0 t_0 = sqrt((1.0d0 + x)) - sqrt(x) code = t_0 * t_0 end function
public static double code(double x) { double t_0 = Math.sqrt((1.0 + x)) - Math.sqrt(x); return t_0 * t_0; }
def code(x): t_0 = math.sqrt((1.0 + x)) - math.sqrt(x) return t_0 * t_0
function code(x) t_0 = Float64(sqrt(Float64(1.0 + x)) - sqrt(x)) return Float64(t_0 * t_0) end
function tmp = code(x) t_0 = sqrt((1.0 + x)) - sqrt(x); tmp = t_0 * t_0; end
code[x_] := Block[{t$95$0 = N[(N[Sqrt[N[(1.0 + x), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]}, N[(t$95$0 * t$95$0), $MachinePrecision]]
\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{1 + x} - \sqrt{x}\\ t\_0 \cdot t\_0 \end{array} \end{array}
Initial program 99.2%
lift-pow.f64
N/A
unpow2
N/A
lower-*.f64
99.2
lift-+.f64
N/A
+-commutative
N/A
lower-+.f64
99.2
lift-+.f64
N/A
+-commutative
N/A
lower-+.f64
99.2
Applied rewrites99.2%
(FPCore (x) :precision binary64 (- 1.0 (* 2.0 (sqrt x))))
double code(double x) { return 1.0 - (2.0 * sqrt(x)); }
real(8) function code(x) real(8), intent (in) :: x code = 1.0d0 - (2.0d0 * sqrt(x)) end function
public static double code(double x) { return 1.0 - (2.0 * Math.sqrt(x)); }
def code(x): return 1.0 - (2.0 * math.sqrt(x))
function code(x) return Float64(1.0 - Float64(2.0 * sqrt(x))) end
function tmp = code(x) tmp = 1.0 - (2.0 * sqrt(x)); end
code[x_] := N[(1.0 - N[(2.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ 1 - 2 \cdot \sqrt{x} \end{array}
Initial program 99.2%
lift-pow.f64
N/A
unpow2
N/A
lift--.f64
N/A
sub-neg
N/A
distribute-rgt-in
N/A
*-commutative
N/A
lift--.f64
N/A
sub-neg
N/A
+-commutative
N/A
distribute-lft-in
N/A
sqr-neg
N/A
lift-sqrt.f64
N/A
lift-sqrt.f64
N/A
rem-square-sqrt
N/A
cancel-sign-sub-inv
N/A
rem-square-sqrt
N/A
lift-sqrt.f64
N/A
lift-sqrt.f64
N/A
*-commutative
N/A
Applied rewrites98.5%
Taylor expanded in x around 0
lower--.f64
N/A
lower-*.f64
N/A
lower-sqrt.f64
95.8
Applied rewrites95.8%
(FPCore (x) :precision binary64 (/ 0.25 x))
double code(double x) { return 0.25 / x; }
real(8) function code(x) real(8), intent (in) :: x code = 0.25d0 / x end function
public static double code(double x) { return 0.25 / x; }
def code(x): return 0.25 / x
function code(x) return Float64(0.25 / x) end
function tmp = code(x) tmp = 0.25 / x; end
code[x_] := N[(0.25 / x), $MachinePrecision]
\begin{array}{l} \\ \frac{0.25}{x} \end{array}
Initial program 99.2%
Taylor expanded in x around inf
lower-/.f64
6.3
Applied rewrites6.3%
Final simplification6.3%
(FPCore (x) :precision binary64 (/ 0.125 x))
double code(double x) { return 0.125 / x; }
real(8) function code(x) real(8), intent (in) :: x code = 0.125d0 / x end function
public static double code(double x) { return 0.125 / x; }
def code(x): return 0.125 / x
function code(x) return Float64(0.125 / x) end
function tmp = code(x) tmp = 0.125 / x; end
code[x_] := N[(0.125 / x), $MachinePrecision]
\begin{array}{l} \\ \frac{0.125}{x} \end{array}
Initial program 99.2%
lift-pow.f64
N/A
unpow2
N/A
lift--.f64
N/A
sub-neg
N/A
distribute-rgt-in
N/A
*-commutative
N/A
lift--.f64
N/A
sub-neg
N/A
+-commutative
N/A
distribute-lft-in
N/A
sqr-neg
N/A
lift-sqrt.f64
N/A
lift-sqrt.f64
N/A
rem-square-sqrt
N/A
cancel-sign-sub-inv
N/A
rem-square-sqrt
N/A
lift-sqrt.f64
N/A
lift-sqrt.f64
N/A
*-commutative
N/A
Applied rewrites98.5%
Taylor expanded in x around inf
lower-/.f64
5.7
Applied rewrites5.7%
herbie shell --seed 1
(FPCore (x)
:name "pow(sqrt(x + 1) - sqrt(x),2)"
:precision binary64
:pre (and (<= -1000000000.0 x) (<= x 1000000000.0))
(pow (- (sqrt (+ x 1.0)) (sqrt x)) 2.0))