(FPCore (x) :precision binary64 (/ (sin x) (cos x)))
double code(double x) { return sin(x) / cos(x); }
real(8) function code(x) real(8), intent (in) :: x code = sin(x) / cos(x) end function
public static double code(double x) { return Math.sin(x) / Math.cos(x); }
def code(x): return math.sin(x) / math.cos(x)
function code(x) return Float64(sin(x) / cos(x)) end
function tmp = code(x) tmp = sin(x) / cos(x); end
code[x_] := N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \frac{\sin x}{\cos x} \end{array}
Sampling outcomes in binary64 precision:
Herbie found 1 alternatives:
Alternative | Accuracy | Speedup |
---|
(FPCore (x) :precision binary64 (/ (sin x) (cos x)))
double code(double x) { return sin(x) / cos(x); }
real(8) function code(x) real(8), intent (in) :: x code = sin(x) / cos(x) end function
public static double code(double x) { return Math.sin(x) / Math.cos(x); }
def code(x): return math.sin(x) / math.cos(x)
function code(x) return Float64(sin(x) / cos(x)) end
function tmp = code(x) tmp = sin(x) / cos(x); end
code[x_] := N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l} \\ \frac{\sin x}{\cos x} \end{array}
(FPCore (x) :precision binary64 (tan x))
double code(double x) { return tan(x); }
real(8) function code(x) real(8), intent (in) :: x code = tan(x) end function
public static double code(double x) { return Math.tan(x); }
def code(x): return math.tan(x)
function code(x) return tan(x) end
function tmp = code(x) tmp = tan(x); end
code[x_] := N[Tan[x], $MachinePrecision]
\begin{array}{l} \\ \tan x \end{array}
Initial program 99.7%
lift-/.f64
N/A
lift-sin.f64
N/A
lift-cos.f64
N/A
quot-tan
N/A
lower-tan.f64
100.0
Applied rewrites100.0%
herbie shell --seed 1
(FPCore (x)
:name "sin(x)/cos(x)"
:precision binary64
:pre (and (<= -1.79e+308 x) (<= x 1.79e+308))
(/ (sin x) (cos x)))