| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 13568 |
\[\frac{0}{\frac{1}{x}} - \sin x \cdot \frac{-\sinh y}{x}
\]
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (* (sin x) (sinh y)) x))) (if (<= x -2.1e-8) t_0 (if (<= x 4.1e-60) (sinh y) t_0))))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
double code(double x, double y) {
double t_0 = (sin(x) * sinh(y)) / x;
double tmp;
if (x <= -2.1e-8) {
tmp = t_0;
} else if (x <= 4.1e-60) {
tmp = sinh(y);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (sin(x) * sinh(y)) / x
if (x <= (-2.1d-8)) then
tmp = t_0
else if (x <= 4.1d-60) then
tmp = sinh(y)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
public static double code(double x, double y) {
double t_0 = (Math.sin(x) * Math.sinh(y)) / x;
double tmp;
if (x <= -2.1e-8) {
tmp = t_0;
} else if (x <= 4.1e-60) {
tmp = Math.sinh(y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
def code(x, y): t_0 = (math.sin(x) * math.sinh(y)) / x tmp = 0 if x <= -2.1e-8: tmp = t_0 elif x <= 4.1e-60: tmp = math.sinh(y) else: tmp = t_0 return tmp
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function code(x, y) t_0 = Float64(Float64(sin(x) * sinh(y)) / x) tmp = 0.0 if (x <= -2.1e-8) tmp = t_0; elseif (x <= 4.1e-60) tmp = sinh(y); else tmp = t_0; end return tmp end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
function tmp_2 = code(x, y) t_0 = (sin(x) * sinh(y)) / x; tmp = 0.0; if (x <= -2.1e-8) tmp = t_0; elseif (x <= 4.1e-60) tmp = sinh(y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]}, If[LessEqual[x, -2.1e-8], t$95$0, If[LessEqual[x, 4.1e-60], N[Sinh[y], $MachinePrecision], t$95$0]]]
\frac{\sin x \cdot \sinh y}{x}
\begin{array}{l}
t_0 := \frac{\sin x \cdot \sinh y}{x}\\
\mathbf{if}\;x \leq -2.1 \cdot 10^{-8}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-60}:\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
Results
| Original | 14.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if x < -2.09999999999999994e-8 or 4.10000000000000013e-60 < x Initial program 0.6
if -2.09999999999999994e-8 < x < 4.10000000000000013e-60Initial program 31.0
Taylor expanded in x around 0 31.0
Applied egg-rr0.0
Simplified0.0
[Start]0.0 | \[ \sinh y + 0
\] |
|---|---|
rational_best-simplify-3 [<=]0.0 | \[ \color{blue}{0 + \sinh y}
\] |
rational_best-simplify-6 [=>]0.0 | \[ \color{blue}{\sinh y}
\] |
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 13568 |
| Alternative 2 | |
|---|---|
| Error | 0.8 |
| Cost | 6984 |
| Alternative 3 | |
|---|---|
| Error | 16.6 |
| Cost | 6728 |
| Alternative 4 | |
|---|---|
| Error | 18.2 |
| Cost | 320 |
| Alternative 5 | |
|---|---|
| Error | 31.0 |
| Cost | 64 |
herbie shell --seed 2023099
(FPCore (x y)
:name "Linear.Quaternion:$ccosh from linear-1.19.1.3"
:precision binary64
:herbie-target
(* (sin x) (/ (sinh y) x))
(/ (* (sin x) (sinh y)) x))