(FPCore (x) :precision binary64 (pow 4.0 x))
double code(double x) { return pow(4.0, x); }
real(8) function code(x) real(8), intent (in) :: x code = 4.0d0 ** x end function
public static double code(double x) { return Math.pow(4.0, x); }
def code(x): return math.pow(4.0, x)
function code(x) return 4.0 ^ x end
function tmp = code(x) tmp = 4.0 ^ x; end
code[x_] := N[Power[4.0, x], $MachinePrecision]
\begin{array}{l} \\ {4}^{x} \end{array}
Sampling outcomes in binary64 precision:
Herbie found 2 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (x) :precision binary64 (pow 4.0 x))
double code(double x) { return pow(4.0, x); }
real(8) function code(x) real(8), intent (in) :: x code = 4.0d0 ** x end function
public static double code(double x) { return Math.pow(4.0, x); }
def code(x): return math.pow(4.0, x)
function code(x) return 4.0 ^ x end
function tmp = code(x) tmp = 4.0 ^ x; end
code[x_] := N[Power[4.0, x], $MachinePrecision]
\begin{array}{l} \\ {4}^{x} \end{array}
(FPCore (x) :precision binary64 (pow 4.0 x))
double code(double x) { return pow(4.0, x); }
real(8) function code(x) real(8), intent (in) :: x code = 4.0d0 ** x end function
public static double code(double x) { return Math.pow(4.0, x); }
def code(x): return math.pow(4.0, x)
function code(x) return 4.0 ^ x end
function tmp = code(x) tmp = 4.0 ^ x; end
code[x_] := N[Power[4.0, x], $MachinePrecision]
\begin{array}{l} \\ {4}^{x} \end{array}
Initial program 100.0%
(FPCore (x) :precision binary64 1.0)
double code(double x) { return 1.0; }
real(8) function code(x) real(8), intent (in) :: x code = 1.0d0 end function
public static double code(double x) { return 1.0; }
def code(x): return 1.0
function code(x) return 1.0 end
function tmp = code(x) tmp = 1.0; end
code[x_] := 1.0
\begin{array}{l} \\ 1 \end{array}
Initial program 100.0%
Taylor expanded in x around 0
Applied rewrites3.1%
herbie shell --seed 5
(FPCore (x)
:name "pow(4,x)"
:precision binary64
:pre (and (<= -1000.0 x) (<= x -1000.0))
(pow 4.0 x))