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