Alternative 1 | |
---|---|
Error | 0.4 |
Cost | 704 |
\[\left(2 + x \cdot \left(x \cdot -0.125 + -0.5\right)\right) + -1
\]
(FPCore (x) :precision binary64 (sqrt (- 1.0 x)))
(FPCore (x) :precision binary64 (sqrt (- 1.0 x)))
double code(double x) { return sqrt((1.0 - x)); }
double code(double x) { return sqrt((1.0 - x)); }
real(8) function code(x) real(8), intent (in) :: x code = sqrt((1.0d0 - x)) end function
real(8) function code(x) real(8), intent (in) :: x code = sqrt((1.0d0 - x)) end function
public static double code(double x) { return Math.sqrt((1.0 - x)); }
public static double code(double x) { return Math.sqrt((1.0 - x)); }
def code(x): return math.sqrt((1.0 - x))
def code(x): return math.sqrt((1.0 - x))
function code(x) return sqrt(Float64(1.0 - x)) end
function code(x) return sqrt(Float64(1.0 - x)) end
function tmp = code(x) tmp = sqrt((1.0 - x)); end
function tmp = code(x) tmp = sqrt((1.0 - x)); end
code[x_] := N[Sqrt[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]
code[x_] := N[Sqrt[N[(1.0 - x), $MachinePrecision]], $MachinePrecision]
\sqrt{1 - x}
\sqrt{1 - x}
Results
Initial program 0.0
Final simplification0.0
Alternative 1 | |
---|---|
Error | 0.4 |
Cost | 704 |
Alternative 2 | |
---|---|
Error | 0.6 |
Cost | 320 |
Alternative 3 | |
---|---|
Error | 1.4 |
Cost | 64 |
herbie shell --seed 1
(FPCore (x)
:name "sqrt(1-x)"
:precision binary64
:pre (and (<= 0.0 x) (<= x 1.79e+308))
(sqrt (- 1.0 x)))