(FPCore (x) :precision binary64 (- (+ x 1000000.0) 1000000.0))
double code(double x) { return (x + 1000000.0) - 1000000.0; }
real(8) function code(x) real(8), intent (in) :: x code = (x + 1000000.0d0) - 1000000.0d0 end function
public static double code(double x) { return (x + 1000000.0) - 1000000.0; }
def code(x): return (x + 1000000.0) - 1000000.0
function code(x) return Float64(Float64(x + 1000000.0) - 1000000.0) end
function tmp = code(x) tmp = (x + 1000000.0) - 1000000.0; end
code[x_] := N[(N[(x + 1000000.0), $MachinePrecision] - 1000000.0), $MachinePrecision]
\begin{array}{l} \\ \left(x + 1000000\right) - 1000000 \end{array}
Sampling outcomes in binary64 precision:
Herbie found 1 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (x) :precision binary64 (- (+ x 1000000.0) 1000000.0))
double code(double x) { return (x + 1000000.0) - 1000000.0; }
real(8) function code(x) real(8), intent (in) :: x code = (x + 1000000.0d0) - 1000000.0d0 end function
public static double code(double x) { return (x + 1000000.0) - 1000000.0; }
def code(x): return (x + 1000000.0) - 1000000.0
function code(x) return Float64(Float64(x + 1000000.0) - 1000000.0) end
function tmp = code(x) tmp = (x + 1000000.0) - 1000000.0; end
code[x_] := N[(N[(x + 1000000.0), $MachinePrecision] - 1000000.0), $MachinePrecision]
\begin{array}{l} \\ \left(x + 1000000\right) - 1000000 \end{array}
(FPCore (x) :precision binary64 x)
double code(double x) { return x; }
real(8) function code(x) real(8), intent (in) :: x code = x end function
public static double code(double x) { return x; }
def code(x): return x
function code(x) return x end
function tmp = code(x) tmp = x; end
code[x_] := x
\begin{array}{l} \\ x \end{array}
Initial program 54.1%
lift--.f64
N/A
lift-+.f64
N/A
associate--l+
N/A
metadata-eval
N/A
+-rgt-identity
100.0
Applied rewrites100.0%
herbie shell --seed 1
(FPCore (x)
:name "(x+1000000)-1000000"
:precision binary64
:pre (and (<= -1.79e+308 x) (<= x 1.79e+308))
(- (+ x 1000000.0) 1000000.0))