(FPCore () :precision binary64 (+ 1.0 (sqrt 2.0)))
double code() { return 1.0 + sqrt(2.0); }
real(8) function code() code = 1.0d0 + sqrt(2.0d0) end function
public static double code() { return 1.0 + Math.sqrt(2.0); }
def code(): return 1.0 + math.sqrt(2.0)
function code() return Float64(1.0 + sqrt(2.0)) end
function tmp = code() tmp = 1.0 + sqrt(2.0); end
code[] := N[(1.0 + N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ 1 + \sqrt{2} \end{array}
Sampling outcomes in binary64 precision:
Herbie found 1 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore () :precision binary64 (+ 1.0 (sqrt 2.0)))
double code() { return 1.0 + sqrt(2.0); }
real(8) function code() code = 1.0d0 + sqrt(2.0d0) end function
public static double code() { return 1.0 + Math.sqrt(2.0); }
def code(): return 1.0 + math.sqrt(2.0)
function code() return Float64(1.0 + sqrt(2.0)) end
function tmp = code() tmp = 1.0 + sqrt(2.0); end
code[] := N[(1.0 + N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ 1 + \sqrt{2} \end{array}
(FPCore () :precision binary64 (+ 1.0 (sqrt 2.0)))
double code() { return 1.0 + sqrt(2.0); }
real(8) function code() code = 1.0d0 + sqrt(2.0d0) end function
public static double code() { return 1.0 + Math.sqrt(2.0); }
def code(): return 1.0 + math.sqrt(2.0)
function code() return Float64(1.0 + sqrt(2.0)) end
function tmp = code() tmp = 1.0 + sqrt(2.0); end
code[] := N[(1.0 + N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ 1 + \sqrt{2} \end{array}
Initial program 100.0%
herbie shell --seed 1
(FPCore ()
:name "1+sqrt(2)"
:precision binary64
(+ 1.0 (sqrt 2.0)))