
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* (sin x) (sinh y)) x))
double code(double x, double y) {
return (sin(x) * sinh(y)) / x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(x) * sinh(y)) / x
end function
public static double code(double x, double y) {
return (Math.sin(x) * Math.sinh(y)) / x;
}
def code(x, y): return (math.sin(x) * math.sinh(y)) / x
function code(x, y) return Float64(Float64(sin(x) * sinh(y)) / x) end
function tmp = code(x, y) tmp = (sin(x) * sinh(y)) / x; end
code[x_, y_] := N[(N[(N[Sin[x], $MachinePrecision] * N[Sinh[y], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x \cdot \sinh y}{x}
\end{array}
(FPCore (x y) :precision binary64 (/ (sinh y) (/ x (sin x))))
double code(double x, double y) {
return sinh(y) / (x / sin(x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sinh(y) / (x / sin(x))
end function
public static double code(double x, double y) {
return Math.sinh(y) / (x / Math.sin(x));
}
def code(x, y): return math.sinh(y) / (x / math.sin(x))
function code(x, y) return Float64(sinh(y) / Float64(x / sin(x))) end
function tmp = code(x, y) tmp = sinh(y) / (x / sin(x)); end
code[x_, y_] := N[(N[Sinh[y], $MachinePrecision] / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sinh y}{\frac{x}{\sin x}}
\end{array}
Initial program 87.7%
*-commutative87.7%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= (sinh y) (- INFINITY)) (not (<= (sinh y) 1e-58))) (sinh y) (* (sin x) (/ y x))))
double code(double x, double y) {
double tmp;
if ((sinh(y) <= -((double) INFINITY)) || !(sinh(y) <= 1e-58)) {
tmp = sinh(y);
} else {
tmp = sin(x) * (y / x);
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if ((Math.sinh(y) <= -Double.POSITIVE_INFINITY) || !(Math.sinh(y) <= 1e-58)) {
tmp = Math.sinh(y);
} else {
tmp = Math.sin(x) * (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (math.sinh(y) <= -math.inf) or not (math.sinh(y) <= 1e-58): tmp = math.sinh(y) else: tmp = math.sin(x) * (y / x) return tmp
function code(x, y) tmp = 0.0 if ((sinh(y) <= Float64(-Inf)) || !(sinh(y) <= 1e-58)) tmp = sinh(y); else tmp = Float64(sin(x) * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((sinh(y) <= -Inf) || ~((sinh(y) <= 1e-58))) tmp = sinh(y); else tmp = sin(x) * (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[N[Sinh[y], $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[Sinh[y], $MachinePrecision], 1e-58]], $MachinePrecision]], N[Sinh[y], $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -\infty \lor \neg \left(\sinh y \leq 10^{-58}\right):\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1e-58 < (sinh.f64 y) Initial program 99.9%
*-commutative99.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 72.1%
if -inf.0 < (sinh.f64 y) < 1e-58Initial program 71.3%
*-commutative71.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 71.3%
associate-/l*99.9%
Simplified99.9%
associate-/r/99.7%
Applied egg-rr99.7%
Final simplification83.9%
(FPCore (x y) :precision binary64 (if (or (<= (sinh y) (- INFINITY)) (not (<= (sinh y) 1e-58))) (sinh y) (* y (/ (sin x) x))))
double code(double x, double y) {
double tmp;
if ((sinh(y) <= -((double) INFINITY)) || !(sinh(y) <= 1e-58)) {
tmp = sinh(y);
} else {
tmp = y * (sin(x) / x);
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if ((Math.sinh(y) <= -Double.POSITIVE_INFINITY) || !(Math.sinh(y) <= 1e-58)) {
tmp = Math.sinh(y);
} else {
tmp = y * (Math.sin(x) / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (math.sinh(y) <= -math.inf) or not (math.sinh(y) <= 1e-58): tmp = math.sinh(y) else: tmp = y * (math.sin(x) / x) return tmp
function code(x, y) tmp = 0.0 if ((sinh(y) <= Float64(-Inf)) || !(sinh(y) <= 1e-58)) tmp = sinh(y); else tmp = Float64(y * Float64(sin(x) / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((sinh(y) <= -Inf) || ~((sinh(y) <= 1e-58))) tmp = sinh(y); else tmp = y * (sin(x) / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[N[Sinh[y], $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[Sinh[y], $MachinePrecision], 1e-58]], $MachinePrecision]], N[Sinh[y], $MachinePrecision], N[(y * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -\infty \lor \neg \left(\sinh y \leq 10^{-58}\right):\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{\sin x}{x}\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1e-58 < (sinh.f64 y) Initial program 99.9%
*-commutative99.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 72.1%
if -inf.0 < (sinh.f64 y) < 1e-58Initial program 71.3%
*-commutative71.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 71.3%
associate-/l*99.9%
Simplified99.9%
associate-/l*71.3%
*-commutative71.3%
associate-*l/99.8%
Applied egg-rr99.8%
Final simplification83.9%
(FPCore (x y) :precision binary64 (if (or (<= (sinh y) (- INFINITY)) (not (<= (sinh y) 1e-58))) (sinh y) (/ y (/ x (sin x)))))
double code(double x, double y) {
double tmp;
if ((sinh(y) <= -((double) INFINITY)) || !(sinh(y) <= 1e-58)) {
tmp = sinh(y);
} else {
tmp = y / (x / sin(x));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if ((Math.sinh(y) <= -Double.POSITIVE_INFINITY) || !(Math.sinh(y) <= 1e-58)) {
tmp = Math.sinh(y);
} else {
tmp = y / (x / Math.sin(x));
}
return tmp;
}
def code(x, y): tmp = 0 if (math.sinh(y) <= -math.inf) or not (math.sinh(y) <= 1e-58): tmp = math.sinh(y) else: tmp = y / (x / math.sin(x)) return tmp
function code(x, y) tmp = 0.0 if ((sinh(y) <= Float64(-Inf)) || !(sinh(y) <= 1e-58)) tmp = sinh(y); else tmp = Float64(y / Float64(x / sin(x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((sinh(y) <= -Inf) || ~((sinh(y) <= 1e-58))) tmp = sinh(y); else tmp = y / (x / sin(x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[N[Sinh[y], $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[Sinh[y], $MachinePrecision], 1e-58]], $MachinePrecision]], N[Sinh[y], $MachinePrecision], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -\infty \lor \neg \left(\sinh y \leq 10^{-58}\right):\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1e-58 < (sinh.f64 y) Initial program 99.9%
*-commutative99.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 72.1%
if -inf.0 < (sinh.f64 y) < 1e-58Initial program 71.3%
*-commutative71.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 71.3%
associate-/l*99.9%
Simplified99.9%
Final simplification83.9%
(FPCore (x y) :precision binary64 (if (or (<= (sinh y) (- INFINITY)) (not (<= (sinh y) 1e-58))) (sinh y) (/ y (+ 1.0 (* x (* x 0.16666666666666666))))))
double code(double x, double y) {
double tmp;
if ((sinh(y) <= -((double) INFINITY)) || !(sinh(y) <= 1e-58)) {
tmp = sinh(y);
} else {
tmp = y / (1.0 + (x * (x * 0.16666666666666666)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if ((Math.sinh(y) <= -Double.POSITIVE_INFINITY) || !(Math.sinh(y) <= 1e-58)) {
tmp = Math.sinh(y);
} else {
tmp = y / (1.0 + (x * (x * 0.16666666666666666)));
}
return tmp;
}
def code(x, y): tmp = 0 if (math.sinh(y) <= -math.inf) or not (math.sinh(y) <= 1e-58): tmp = math.sinh(y) else: tmp = y / (1.0 + (x * (x * 0.16666666666666666))) return tmp
function code(x, y) tmp = 0.0 if ((sinh(y) <= Float64(-Inf)) || !(sinh(y) <= 1e-58)) tmp = sinh(y); else tmp = Float64(y / Float64(1.0 + Float64(x * Float64(x * 0.16666666666666666)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((sinh(y) <= -Inf) || ~((sinh(y) <= 1e-58))) tmp = sinh(y); else tmp = y / (1.0 + (x * (x * 0.16666666666666666))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[N[Sinh[y], $MachinePrecision], (-Infinity)], N[Not[LessEqual[N[Sinh[y], $MachinePrecision], 1e-58]], $MachinePrecision]], N[Sinh[y], $MachinePrecision], N[(y / N[(1.0 + N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sinh y \leq -\infty \lor \neg \left(\sinh y \leq 10^{-58}\right):\\
\;\;\;\;\sinh y\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{1 + x \cdot \left(x \cdot 0.16666666666666666\right)}\\
\end{array}
\end{array}
if (sinh.f64 y) < -inf.0 or 1e-58 < (sinh.f64 y) Initial program 99.9%
*-commutative99.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around 0 72.1%
if -inf.0 < (sinh.f64 y) < 1e-58Initial program 71.3%
*-commutative71.3%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 99.8%
Taylor expanded in x around 0 76.7%
*-commutative76.7%
distribute-rgt-in76.8%
*-commutative76.8%
lft-mult-inverse76.9%
Applied egg-rr76.9%
Final simplification74.1%
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) x)))
double code(double x, double y) {
return sin(x) * (sinh(y) / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / x)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / x);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / x)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / x)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / x); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{x}
\end{array}
Initial program 87.7%
*-commutative87.7%
associate-/l*99.9%
Simplified99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ y (* x (* x 0.16666666666666666)))))
(if (<= y -160000.0)
t_0
(if (<= y 430.0)
(/ x (/ x y))
(if (<= y 4.8e+187)
t_0
(if (<= y 1.1e+248) (/ (* y x) x) (* x (/ y x))))))))
double code(double x, double y) {
double t_0 = y / (x * (x * 0.16666666666666666));
double tmp;
if (y <= -160000.0) {
tmp = t_0;
} else if (y <= 430.0) {
tmp = x / (x / y);
} else if (y <= 4.8e+187) {
tmp = t_0;
} else if (y <= 1.1e+248) {
tmp = (y * x) / x;
} else {
tmp = x * (y / x);
}
return tmp;
}
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 = y / (x * (x * 0.16666666666666666d0))
if (y <= (-160000.0d0)) then
tmp = t_0
else if (y <= 430.0d0) then
tmp = x / (x / y)
else if (y <= 4.8d+187) then
tmp = t_0
else if (y <= 1.1d+248) then
tmp = (y * x) / x
else
tmp = x * (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y / (x * (x * 0.16666666666666666));
double tmp;
if (y <= -160000.0) {
tmp = t_0;
} else if (y <= 430.0) {
tmp = x / (x / y);
} else if (y <= 4.8e+187) {
tmp = t_0;
} else if (y <= 1.1e+248) {
tmp = (y * x) / x;
} else {
tmp = x * (y / x);
}
return tmp;
}
def code(x, y): t_0 = y / (x * (x * 0.16666666666666666)) tmp = 0 if y <= -160000.0: tmp = t_0 elif y <= 430.0: tmp = x / (x / y) elif y <= 4.8e+187: tmp = t_0 elif y <= 1.1e+248: tmp = (y * x) / x else: tmp = x * (y / x) return tmp
function code(x, y) t_0 = Float64(y / Float64(x * Float64(x * 0.16666666666666666))) tmp = 0.0 if (y <= -160000.0) tmp = t_0; elseif (y <= 430.0) tmp = Float64(x / Float64(x / y)); elseif (y <= 4.8e+187) tmp = t_0; elseif (y <= 1.1e+248) tmp = Float64(Float64(y * x) / x); else tmp = Float64(x * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) t_0 = y / (x * (x * 0.16666666666666666)); tmp = 0.0; if (y <= -160000.0) tmp = t_0; elseif (y <= 430.0) tmp = x / (x / y); elseif (y <= 4.8e+187) tmp = t_0; elseif (y <= 1.1e+248) tmp = (y * x) / x; else tmp = x * (y / x); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -160000.0], t$95$0, If[LessEqual[y, 430.0], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+187], t$95$0, If[LessEqual[y, 1.1e+248], N[(N[(y * x), $MachinePrecision] / x), $MachinePrecision], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x \cdot 0.16666666666666666\right)}\\
\mathbf{if}\;y \leq -160000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 430:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+187}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+248}:\\
\;\;\;\;\frac{y \cdot x}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if y < -1.6e5 or 430 < y < 4.79999999999999971e187Initial program 100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 4.1%
Taylor expanded in x around 0 3.3%
Taylor expanded in x around inf 43.1%
*-commutative43.1%
Simplified43.1%
if -1.6e5 < y < 430Initial program 72.7%
Taylor expanded in y around 0 69.7%
Taylor expanded in x around 0 33.1%
div-inv32.9%
associate-*l*72.2%
Applied egg-rr72.2%
un-div-inv72.3%
associate-*r/33.1%
associate-/l*74.0%
Applied egg-rr74.0%
if 4.79999999999999971e187 < y < 1.1e248Initial program 100.0%
Taylor expanded in y around 0 4.5%
Taylor expanded in x around 0 49.0%
if 1.1e248 < y Initial program 100.0%
Taylor expanded in y around 0 6.6%
Taylor expanded in x around 0 37.0%
div-inv37.0%
associate-*l*44.6%
Applied egg-rr44.6%
Taylor expanded in y around 0 44.6%
Final simplification57.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* x (* x 0.16666666666666666))) (t_1 (/ y t_0)))
(if (<= y -160000.0)
t_1
(if (<= y 320.0)
(/ y (+ 1.0 t_0))
(if (<= y 8e+187)
t_1
(if (<= y 1.95e+247) (/ (* y x) x) (* x (/ y x))))))))
double code(double x, double y) {
double t_0 = x * (x * 0.16666666666666666);
double t_1 = y / t_0;
double tmp;
if (y <= -160000.0) {
tmp = t_1;
} else if (y <= 320.0) {
tmp = y / (1.0 + t_0);
} else if (y <= 8e+187) {
tmp = t_1;
} else if (y <= 1.95e+247) {
tmp = (y * x) / x;
} else {
tmp = x * (y / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x * (x * 0.16666666666666666d0)
t_1 = y / t_0
if (y <= (-160000.0d0)) then
tmp = t_1
else if (y <= 320.0d0) then
tmp = y / (1.0d0 + t_0)
else if (y <= 8d+187) then
tmp = t_1
else if (y <= 1.95d+247) then
tmp = (y * x) / x
else
tmp = x * (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * (x * 0.16666666666666666);
double t_1 = y / t_0;
double tmp;
if (y <= -160000.0) {
tmp = t_1;
} else if (y <= 320.0) {
tmp = y / (1.0 + t_0);
} else if (y <= 8e+187) {
tmp = t_1;
} else if (y <= 1.95e+247) {
tmp = (y * x) / x;
} else {
tmp = x * (y / x);
}
return tmp;
}
def code(x, y): t_0 = x * (x * 0.16666666666666666) t_1 = y / t_0 tmp = 0 if y <= -160000.0: tmp = t_1 elif y <= 320.0: tmp = y / (1.0 + t_0) elif y <= 8e+187: tmp = t_1 elif y <= 1.95e+247: tmp = (y * x) / x else: tmp = x * (y / x) return tmp
function code(x, y) t_0 = Float64(x * Float64(x * 0.16666666666666666)) t_1 = Float64(y / t_0) tmp = 0.0 if (y <= -160000.0) tmp = t_1; elseif (y <= 320.0) tmp = Float64(y / Float64(1.0 + t_0)); elseif (y <= 8e+187) tmp = t_1; elseif (y <= 1.95e+247) tmp = Float64(Float64(y * x) / x); else tmp = Float64(x * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) t_0 = x * (x * 0.16666666666666666); t_1 = y / t_0; tmp = 0.0; if (y <= -160000.0) tmp = t_1; elseif (y <= 320.0) tmp = y / (1.0 + t_0); elseif (y <= 8e+187) tmp = t_1; elseif (y <= 1.95e+247) tmp = (y * x) / x; else tmp = x * (y / x); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y / t$95$0), $MachinePrecision]}, If[LessEqual[y, -160000.0], t$95$1, If[LessEqual[y, 320.0], N[(y / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8e+187], t$95$1, If[LessEqual[y, 1.95e+247], N[(N[(y * x), $MachinePrecision] / x), $MachinePrecision], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot 0.16666666666666666\right)\\
t_1 := \frac{y}{t_0}\\
\mathbf{if}\;y \leq -160000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 320:\\
\;\;\;\;\frac{y}{1 + t_0}\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+187}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.95 \cdot 10^{+247}:\\
\;\;\;\;\frac{y \cdot x}{x}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if y < -1.6e5 or 320 < y < 7.99999999999999926e187Initial program 100.0%
*-commutative100.0%
associate-/l*100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 4.1%
Taylor expanded in x around 0 3.3%
Taylor expanded in x around inf 43.1%
*-commutative43.1%
Simplified43.1%
if -1.6e5 < y < 320Initial program 72.7%
*-commutative72.7%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 96.8%
Taylor expanded in x around 0 74.9%
*-commutative74.9%
distribute-rgt-in74.9%
*-commutative74.9%
lft-mult-inverse75.0%
Applied egg-rr75.0%
if 7.99999999999999926e187 < y < 1.95000000000000001e247Initial program 100.0%
Taylor expanded in y around 0 4.5%
Taylor expanded in x around 0 49.0%
if 1.95000000000000001e247 < y Initial program 100.0%
Taylor expanded in y around 0 6.6%
Taylor expanded in x around 0 37.0%
div-inv37.0%
associate-*l*44.6%
Applied egg-rr44.6%
Taylor expanded in y around 0 44.6%
Final simplification58.0%
(FPCore (x y) :precision binary64 (* x (/ 1.0 (/ x y))))
double code(double x, double y) {
return x * (1.0 / (x / y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (1.0d0 / (x / y))
end function
public static double code(double x, double y) {
return x * (1.0 / (x / y));
}
def code(x, y): return x * (1.0 / (x / y))
function code(x, y) return Float64(x * Float64(1.0 / Float64(x / y))) end
function tmp = code(x, y) tmp = x * (1.0 / (x / y)); end
code[x_, y_] := N[(x * N[(1.0 / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{1}{\frac{x}{y}}
\end{array}
Initial program 87.7%
Taylor expanded in y around 0 33.7%
Taylor expanded in x around 0 24.7%
associate-/l*47.1%
div-inv48.5%
Applied egg-rr48.5%
Final simplification48.5%
(FPCore (x y) :precision binary64 (* x (/ y x)))
double code(double x, double y) {
return x * (y / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (y / x)
end function
public static double code(double x, double y) {
return x * (y / x);
}
def code(x, y): return x * (y / x)
function code(x, y) return Float64(x * Float64(y / x)) end
function tmp = code(x, y) tmp = x * (y / x); end
code[x_, y_] := N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{y}{x}
\end{array}
Initial program 87.7%
Taylor expanded in y around 0 33.7%
Taylor expanded in x around 0 24.7%
div-inv24.6%
associate-*l*47.7%
Applied egg-rr47.7%
Taylor expanded in y around 0 47.8%
Final simplification47.8%
(FPCore (x y) :precision binary64 y)
double code(double x, double y) {
return y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = y
end function
public static double code(double x, double y) {
return y;
}
def code(x, y): return y
function code(x, y) return y end
function tmp = code(x, y) tmp = y; end
code[x_, y_] := y
\begin{array}{l}
\\
y
\end{array}
Initial program 87.7%
*-commutative87.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 33.7%
associate-/l*45.9%
Simplified45.9%
Taylor expanded in x around 0 28.8%
Final simplification28.8%
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) x)))
double code(double x, double y) {
return sin(x) * (sinh(y) / x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / x)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / x);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / x)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / x)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / x); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{x}
\end{array}
herbie shell --seed 2023310
(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))