| Alternative 1 | |
|---|---|
| Error | 0.02% |
| Cost | 13120 |
\[\cos x \cdot \frac{\sinh y}{y}
\]
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
(FPCore (x y) :precision binary64 (* (cos x) (/ (/ 1.0 y) (/ 1.0 (sinh y)))))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
double code(double x, double y) {
return cos(x) * ((1.0 / y) / (1.0 / sinh(y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * ((1.0d0 / y) / (1.0d0 / sinh(y)))
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
public static double code(double x, double y) {
return Math.cos(x) * ((1.0 / y) / (1.0 / Math.sinh(y)));
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
def code(x, y): return math.cos(x) * ((1.0 / y) / (1.0 / math.sinh(y)))
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function code(x, y) return Float64(cos(x) * Float64(Float64(1.0 / y) / Float64(1.0 / sinh(y)))) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
function tmp = code(x, y) tmp = cos(x) * ((1.0 / y) / (1.0 / sinh(y))); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] / N[(1.0 / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\cos x \cdot \frac{\sinh y}{y}
\cos x \cdot \frac{\frac{1}{y}}{\frac{1}{\sinh y}}
Results
Initial program 0.02
Applied egg-rr50.12
Applied egg-rr0.06
Final simplification0.06
| Alternative 1 | |
|---|---|
| Error | 0.02% |
| Cost | 13120 |
| Alternative 2 | |
|---|---|
| Error | 1.1% |
| Cost | 6976 |
| Alternative 3 | |
|---|---|
| Error | 1.66% |
| Cost | 6464 |
herbie shell --seed 2023103
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))