| Alternative 1 | |
|---|---|
| Error | 28.8 |
| Cost | 64 |
\[1
\]
(FPCore (x) :precision binary64 (/ (- 1.0 (* (tan x) (tan x))) (+ 1.0 (* (tan x) (tan x)))))
(FPCore (x) :precision binary64 (cos (* 2.0 x)))
double code(double x) {
return (1.0 - (tan(x) * tan(x))) / (1.0 + (tan(x) * tan(x)));
}
double code(double x) {
return cos((2.0 * x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (1.0d0 - (tan(x) * tan(x))) / (1.0d0 + (tan(x) * tan(x)))
end function
real(8) function code(x)
real(8), intent (in) :: x
code = cos((2.0d0 * x))
end function
public static double code(double x) {
return (1.0 - (Math.tan(x) * Math.tan(x))) / (1.0 + (Math.tan(x) * Math.tan(x)));
}
public static double code(double x) {
return Math.cos((2.0 * x));
}
def code(x): return (1.0 - (math.tan(x) * math.tan(x))) / (1.0 + (math.tan(x) * math.tan(x)))
def code(x): return math.cos((2.0 * x))
function code(x) return Float64(Float64(1.0 - Float64(tan(x) * tan(x))) / Float64(1.0 + Float64(tan(x) * tan(x)))) end
function code(x) return cos(Float64(2.0 * x)) end
function tmp = code(x) tmp = (1.0 - (tan(x) * tan(x))) / (1.0 + (tan(x) * tan(x))); end
function tmp = code(x) tmp = cos((2.0 * x)); end
code[x_] := N[(N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[Tan[x], $MachinePrecision] * N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\cos \left(2 \cdot x\right)
Results
Initial program 0.3
Simplified0.3
Applied egg-rr0.3
Applied egg-rr0.4
Applied egg-rr0.0
Simplified0.0
| Alternative 1 | |
|---|---|
| Error | 28.8 |
| Cost | 64 |
herbie shell --seed 2023033
(FPCore (x)
:name "Trigonometry B"
:precision binary64
(/ (- 1.0 (* (tan x) (tan x))) (+ 1.0 (* (tan x) (tan x)))))