(FPCore (x) :precision binary64 (- x (* 1e-5 x)))
double code(double x) { return x - (1e-5 * x); }
real(8) function code(x) real(8), intent (in) :: x code = x - (1d-5 * x) end function
public static double code(double x) { return x - (1e-5 * x); }
def code(x): return x - (1e-5 * x)
function code(x) return Float64(x - Float64(1e-5 * x)) end
function tmp = code(x) tmp = x - (1e-5 * x); end
code[x_] := N[(x - N[(1e-5 * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ x - 10^{-5} \cdot x \end{array}
Sampling outcomes in binary64 precision:
Herbie found 2 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (x) :precision binary64 (- x (* 1e-5 x)))
double code(double x) { return x - (1e-5 * x); }
real(8) function code(x) real(8), intent (in) :: x code = x - (1d-5 * x) end function
public static double code(double x) { return x - (1e-5 * x); }
def code(x): return x - (1e-5 * x)
function code(x) return Float64(x - Float64(1e-5 * x)) end
function tmp = code(x) tmp = x - (1e-5 * x); end
code[x_] := N[(x - N[(1e-5 * x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ x - 10^{-5} \cdot x \end{array}
(FPCore (x) :precision binary64 (fma x -1e-5 x))
double code(double x) { return fma(x, -1e-5, x); }
function code(x) return fma(x, -1e-5, x) end
code[x_] := N[(x * -1e-5 + x), $MachinePrecision]
\begin{array}{l} \\ \mathsf{fma}\left(x, -1 \cdot 10^{-5}, x\right) \end{array}
Initial program 100.0%
lift--.f64
N/A
sub-neg
N/A
+-commutative
N/A
lift-*.f64
N/A
*-commutative
N/A
distribute-rgt-neg-in
N/A
lower-fma.f64
N/A
metadata-eval
100.0
Applied rewrites100.0%
(FPCore (x) :precision binary64 (* x 0.99999))
double code(double x) { return x * 0.99999; }
real(8) function code(x) real(8), intent (in) :: x code = x * 0.99999d0 end function
public static double code(double x) { return x * 0.99999; }
def code(x): return x * 0.99999
function code(x) return Float64(x * 0.99999) end
function tmp = code(x) tmp = x * 0.99999; end
code[x_] := N[(x * 0.99999), $MachinePrecision]
\begin{array}{l} \\ x \cdot 0.99999 \end{array}
Initial program 100.0%
lift--.f64
N/A
lift-*.f64
N/A
cancel-sign-sub-inv
N/A
distribute-rgt1-in
N/A
*-commutative
N/A
lower-*.f64
N/A
metadata-eval
N/A
metadata-eval
99.6
Applied rewrites99.6%
herbie shell --seed 1
(FPCore (x)
:name "x-0.00001x"
:precision binary64
:pre (and (<= -1.0 x) (<= x 1.0))
(- x (* 1e-5 x)))