(FPCore (x) :precision binary64 (sin (* 1e+100 x)))
double code(double x) { return sin((1e+100 * x)); }
real(8) function code(x) real(8), intent (in) :: x code = sin((1d+100 * x)) end function
public static double code(double x) { return Math.sin((1e+100 * x)); }
def code(x): return math.sin((1e+100 * x))
function code(x) return sin(Float64(1e+100 * x)) end
function tmp = code(x) tmp = sin((1e+100 * x)); end
code[x_] := N[Sin[N[(1e+100 * x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l} \\ \sin \left(10^{+100} \cdot x\right) \end{array}
Sampling outcomes in binary64 precision:
Herbie found 2 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (x) :precision binary64 (sin (* 1e+100 x)))
double code(double x) { return sin((1e+100 * x)); }
real(8) function code(x) real(8), intent (in) :: x code = sin((1d+100 * x)) end function
public static double code(double x) { return Math.sin((1e+100 * x)); }
def code(x): return math.sin((1e+100 * x))
function code(x) return sin(Float64(1e+100 * x)) end
function tmp = code(x) tmp = sin((1e+100 * x)); end
code[x_] := N[Sin[N[(1e+100 * x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l} \\ \sin \left(10^{+100} \cdot x\right) \end{array}
(FPCore (x) :precision binary64 (sin (* 1e+100 x)))
double code(double x) { return sin((1e+100 * x)); }
real(8) function code(x) real(8), intent (in) :: x code = sin((1d+100 * x)) end function
public static double code(double x) { return Math.sin((1e+100 * x)); }
def code(x): return math.sin((1e+100 * x))
function code(x) return sin(Float64(1e+100 * x)) end
function tmp = code(x) tmp = sin((1e+100 * x)); end
code[x_] := N[Sin[N[(1e+100 * x), $MachinePrecision]], $MachinePrecision]
\begin{array}{l} \\ \sin \left(10^{+100} \cdot x\right) \end{array}
Initial program 71.7%
(FPCore (x) :precision binary64 (* 1e+100 x))
double code(double x) { return 1e+100 * x; }
real(8) function code(x) real(8), intent (in) :: x code = 1d+100 * x end function
public static double code(double x) { return 1e+100 * x; }
def code(x): return 1e+100 * x
function code(x) return Float64(1e+100 * x) end
function tmp = code(x) tmp = 1e+100 * x; end
code[x_] := N[(1e+100 * x), $MachinePrecision]
\begin{array}{l} \\ 10^{+100} \cdot x \end{array}
Initial program 71.7%
Taylor expanded in x around 0
lower-*.f64
66.9
Applied rewrites66.9%
herbie shell --seed 1
(FPCore (x)
:name "sin(1e100 * x)"
:precision binary64
:pre (and (<= -1.0 x) (<= x 1.0))
(sin (* 1e+100 x)))