Alternative 1 | |
---|---|
Error | 1.3 |
Cost | 6848 |
\[1 + \mathsf{fma}\left(x, x \cdot -0.5, x\right)
\]
(FPCore (x) :precision binary64 (+ (sin x) (cos x)))
(FPCore (x) :precision binary64 (+ (sin x) (cos x)))
double code(double x) { return 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
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); }
public static double code(double x) { return Math.sin(x) + Math.cos(x); }
def code(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 code(x) return Float64(sin(x) + cos(x)) end
function tmp = code(x) tmp = 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]
code[x_] := N[(N[Sin[x], $MachinePrecision] + N[Cos[x], $MachinePrecision]), $MachinePrecision]
\sin x + \cos x
\sin x + \cos x
Results
Initial program 0.0
Final simplification0.0
Alternative 1 | |
---|---|
Error | 1.3 |
Cost | 6848 |
Alternative 2 | |
---|---|
Error | 1.5 |
Cost | 192 |
Alternative 3 | |
---|---|
Error | 2.2 |
Cost | 64 |
herbie shell --seed 1
(FPCore (x)
:name "sin(x)+cos(x)"
:precision binary64
:pre (and (<= -1.0 x) (<= x 1000000000.0))
(+ (sin x) (cos x)))