Alternative 1 | |
---|---|
Error | 30.0 |
Cost | 13184 |
\[{\left(1.002 + x\right)}^{0.5} - \sqrt{x}
\]
(FPCore (x) :precision binary64 (- (sqrt (+ x 1.002)) (sqrt x)))
(FPCore (x) :precision binary64 (/ 1.002 (+ (sqrt (+ 1.002 x)) (sqrt x))))
double code(double x) { return sqrt((x + 1.002)) - sqrt(x); }
double code(double x) { return 1.002 / (sqrt((1.002 + x)) + sqrt(x)); }
real(8) function code(x) real(8), intent (in) :: x code = sqrt((x + 1.002d0)) - sqrt(x) end function
real(8) function code(x) real(8), intent (in) :: x code = 1.002d0 / (sqrt((1.002d0 + x)) + sqrt(x)) end function
public static double code(double x) { return Math.sqrt((x + 1.002)) - Math.sqrt(x); }
public static double code(double x) { return 1.002 / (Math.sqrt((1.002 + x)) + Math.sqrt(x)); }
def code(x): return math.sqrt((x + 1.002)) - math.sqrt(x)
def code(x): return 1.002 / (math.sqrt((1.002 + x)) + math.sqrt(x))
function code(x) return Float64(sqrt(Float64(x + 1.002)) - sqrt(x)) end
function code(x) return Float64(1.002 / Float64(sqrt(Float64(1.002 + x)) + sqrt(x))) end
function tmp = code(x) tmp = sqrt((x + 1.002)) - sqrt(x); end
function tmp = code(x) tmp = 1.002 / (sqrt((1.002 + x)) + sqrt(x)); end
code[x_] := N[(N[Sqrt[N[(x + 1.002), $MachinePrecision]], $MachinePrecision] - N[Sqrt[x], $MachinePrecision]), $MachinePrecision]
code[x_] := N[(1.002 / N[(N[Sqrt[N[(1.002 + x), $MachinePrecision]], $MachinePrecision] + N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\sqrt{x + 1.002} - \sqrt{x}
\frac{1.002}{\sqrt{1.002 + x} + \sqrt{x}}
Results
Initial program 30.0
Applied egg-rr30.0
Taylor expanded in x around 0 0.1
Final simplification0.1
Alternative 1 | |
---|---|
Error | 30.0 |
Cost | 13184 |
Alternative 2 | |
---|---|
Error | 30.0 |
Cost | 13120 |
Alternative 3 | |
---|---|
Error | 31.2 |
Cost | 6464 |
herbie shell --seed 1
(FPCore (x)
:name "sqrt(x + 1.002) - sqrt(x)"
:precision binary64
:pre (and (<= 0.0 x) (<= x 1.79e+308))
(- (sqrt (+ x 1.002)) (sqrt x)))