(FPCore (x) :precision binary64 (/ x 3.14159))
double code(double x) { return x / 3.14159; }
real(8) function code(x) real(8), intent (in) :: x code = x / 3.14159d0 end function
public static double code(double x) { return x / 3.14159; }
def code(x): return x / 3.14159
function code(x) return Float64(x / 3.14159) end
function tmp = code(x) tmp = x / 3.14159; end
code[x_] := N[(x / 3.14159), $MachinePrecision]
\begin{array}{l} \\ \frac{x}{3.14159} \end{array}
Sampling outcomes in binary64 precision:
Herbie found 2 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (x) :precision binary64 (/ x 3.14159))
double code(double x) { return x / 3.14159; }
real(8) function code(x) real(8), intent (in) :: x code = x / 3.14159d0 end function
public static double code(double x) { return x / 3.14159; }
def code(x): return x / 3.14159
function code(x) return Float64(x / 3.14159) end
function tmp = code(x) tmp = x / 3.14159; end
code[x_] := N[(x / 3.14159), $MachinePrecision]
\begin{array}{l} \\ \frac{x}{3.14159} \end{array}
(FPCore (x) :precision binary64 (/ x 3.14159))
double code(double x) { return x / 3.14159; }
real(8) function code(x) real(8), intent (in) :: x code = x / 3.14159d0 end function
public static double code(double x) { return x / 3.14159; }
def code(x): return x / 3.14159
function code(x) return Float64(x / 3.14159) end
function tmp = code(x) tmp = x / 3.14159; end
code[x_] := N[(x / 3.14159), $MachinePrecision]
\begin{array}{l} \\ \frac{x}{3.14159} \end{array}
Initial program 100.0%
(FPCore (x) :precision binary64 (* x 0.31831015504887655))
double code(double x) { return x * 0.31831015504887655; }
real(8) function code(x) real(8), intent (in) :: x code = x * 0.31831015504887655d0 end function
public static double code(double x) { return x * 0.31831015504887655; }
def code(x): return x * 0.31831015504887655
function code(x) return Float64(x * 0.31831015504887655) end
function tmp = code(x) tmp = x * 0.31831015504887655; end
code[x_] := N[(x * 0.31831015504887655), $MachinePrecision]
\begin{array}{l} \\ x \cdot 0.31831015504887655 \end{array}
Initial program 100.0%
lift-/.f64
N/A
div-inv
N/A
lower-*.f64
N/A
metadata-eval
99.5
Applied rewrites99.5%
herbie shell --seed 1
(FPCore (x)
:name "x/3.14159"
:precision binary64
:pre (and (<= 0.0 x) (<= x 1.0))
(/ x 3.14159))