
(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 10 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 (* (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.3%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (* -0.16666666666666666 (* y (pow x 2.0)))))
(t_1 (log1p (expm1 y))))
(if (<= y 6400.0)
(/ y (/ x (sin x)))
(if (<= y 4.8e+40)
t_1
(if (<= y 5.1e+46)
t_0
(if (<= y 1.35e+155)
t_1
(if (<= y 4.1e+180)
t_0
(+ y (* 0.16666666666666666 (pow y 3.0))))))))))
double code(double x, double y) {
double t_0 = y + (-0.16666666666666666 * (y * pow(x, 2.0)));
double t_1 = log1p(expm1(y));
double tmp;
if (y <= 6400.0) {
tmp = y / (x / sin(x));
} else if (y <= 4.8e+40) {
tmp = t_1;
} else if (y <= 5.1e+46) {
tmp = t_0;
} else if (y <= 1.35e+155) {
tmp = t_1;
} else if (y <= 4.1e+180) {
tmp = t_0;
} else {
tmp = y + (0.16666666666666666 * pow(y, 3.0));
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = y + (-0.16666666666666666 * (y * Math.pow(x, 2.0)));
double t_1 = Math.log1p(Math.expm1(y));
double tmp;
if (y <= 6400.0) {
tmp = y / (x / Math.sin(x));
} else if (y <= 4.8e+40) {
tmp = t_1;
} else if (y <= 5.1e+46) {
tmp = t_0;
} else if (y <= 1.35e+155) {
tmp = t_1;
} else if (y <= 4.1e+180) {
tmp = t_0;
} else {
tmp = y + (0.16666666666666666 * Math.pow(y, 3.0));
}
return tmp;
}
def code(x, y): t_0 = y + (-0.16666666666666666 * (y * math.pow(x, 2.0))) t_1 = math.log1p(math.expm1(y)) tmp = 0 if y <= 6400.0: tmp = y / (x / math.sin(x)) elif y <= 4.8e+40: tmp = t_1 elif y <= 5.1e+46: tmp = t_0 elif y <= 1.35e+155: tmp = t_1 elif y <= 4.1e+180: tmp = t_0 else: tmp = y + (0.16666666666666666 * math.pow(y, 3.0)) return tmp
function code(x, y) t_0 = Float64(y + Float64(-0.16666666666666666 * Float64(y * (x ^ 2.0)))) t_1 = log1p(expm1(y)) tmp = 0.0 if (y <= 6400.0) tmp = Float64(y / Float64(x / sin(x))); elseif (y <= 4.8e+40) tmp = t_1; elseif (y <= 5.1e+46) tmp = t_0; elseif (y <= 1.35e+155) tmp = t_1; elseif (y <= 4.1e+180) tmp = t_0; else tmp = Float64(y + Float64(0.16666666666666666 * (y ^ 3.0))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(y + N[(-0.16666666666666666 * N[(y * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[1 + N[(Exp[y] - 1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, 6400.0], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+40], t$95$1, If[LessEqual[y, 5.1e+46], t$95$0, If[LessEqual[y, 1.35e+155], t$95$1, If[LessEqual[y, 4.1e+180], t$95$0, N[(y + N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + -0.16666666666666666 \cdot \left(y \cdot {x}^{2}\right)\\
t_1 := \mathsf{log1p}\left(\mathsf{expm1}\left(y\right)\right)\\
\mathbf{if}\;y \leq 6400:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+40}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+155}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+180}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y + 0.16666666666666666 \cdot {y}^{3}\\
\end{array}
\end{array}
if y < 6400Initial program 83.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 49.8%
associate-/l*66.5%
Simplified66.5%
clear-num66.5%
un-div-inv66.5%
Applied egg-rr66.5%
if 6400 < y < 4.8e40 or 5.0999999999999997e46 < y < 1.34999999999999997e155Initial program 100.0%
Taylor expanded in y around 0 3.4%
Taylor expanded in x around 0 6.9%
*-commutative6.9%
Simplified6.9%
associate-/l*3.2%
*-inverses3.2%
*-commutative3.2%
*-un-lft-identity3.2%
log1p-expm1-u80.0%
Applied egg-rr80.0%
if 4.8e40 < y < 5.0999999999999997e46 or 1.34999999999999997e155 < y < 4.1e180Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 2.9%
associate-/l*2.9%
Simplified2.9%
Taylor expanded in x around 0 88.2%
if 4.1e180 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 80.0%
Final simplification70.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (pow y 3.0)))
(t_1 (+ y (* -0.16666666666666666 (* y (pow x 2.0))))))
(if (<= y 620.0)
(/ y (/ x (sin x)))
(if (<= y 3.3e+104)
t_1
(if (<= y 1.35e+155) t_0 (if (<= y 4.1e+180) t_1 (+ y t_0)))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * pow(y, 3.0);
double t_1 = y + (-0.16666666666666666 * (y * pow(x, 2.0)));
double tmp;
if (y <= 620.0) {
tmp = y / (x / sin(x));
} else if (y <= 3.3e+104) {
tmp = t_1;
} else if (y <= 1.35e+155) {
tmp = t_0;
} else if (y <= 4.1e+180) {
tmp = t_1;
} else {
tmp = y + t_0;
}
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 = 0.16666666666666666d0 * (y ** 3.0d0)
t_1 = y + ((-0.16666666666666666d0) * (y * (x ** 2.0d0)))
if (y <= 620.0d0) then
tmp = y / (x / sin(x))
else if (y <= 3.3d+104) then
tmp = t_1
else if (y <= 1.35d+155) then
tmp = t_0
else if (y <= 4.1d+180) then
tmp = t_1
else
tmp = y + t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * Math.pow(y, 3.0);
double t_1 = y + (-0.16666666666666666 * (y * Math.pow(x, 2.0)));
double tmp;
if (y <= 620.0) {
tmp = y / (x / Math.sin(x));
} else if (y <= 3.3e+104) {
tmp = t_1;
} else if (y <= 1.35e+155) {
tmp = t_0;
} else if (y <= 4.1e+180) {
tmp = t_1;
} else {
tmp = y + t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * math.pow(y, 3.0) t_1 = y + (-0.16666666666666666 * (y * math.pow(x, 2.0))) tmp = 0 if y <= 620.0: tmp = y / (x / math.sin(x)) elif y <= 3.3e+104: tmp = t_1 elif y <= 1.35e+155: tmp = t_0 elif y <= 4.1e+180: tmp = t_1 else: tmp = y + t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * (y ^ 3.0)) t_1 = Float64(y + Float64(-0.16666666666666666 * Float64(y * (x ^ 2.0)))) tmp = 0.0 if (y <= 620.0) tmp = Float64(y / Float64(x / sin(x))); elseif (y <= 3.3e+104) tmp = t_1; elseif (y <= 1.35e+155) tmp = t_0; elseif (y <= 4.1e+180) tmp = t_1; else tmp = Float64(y + t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y ^ 3.0); t_1 = y + (-0.16666666666666666 * (y * (x ^ 2.0))); tmp = 0.0; if (y <= 620.0) tmp = y / (x / sin(x)); elseif (y <= 3.3e+104) tmp = t_1; elseif (y <= 1.35e+155) tmp = t_0; elseif (y <= 4.1e+180) tmp = t_1; else tmp = y + t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y + N[(-0.16666666666666666 * N[(y * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 620.0], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.3e+104], t$95$1, If[LessEqual[y, 1.35e+155], t$95$0, If[LessEqual[y, 4.1e+180], t$95$1, N[(y + t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot {y}^{3}\\
t_1 := y + -0.16666666666666666 \cdot \left(y \cdot {x}^{2}\right)\\
\mathbf{if}\;y \leq 620:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{elif}\;y \leq 3.3 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+155}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+180}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y + t\_0\\
\end{array}
\end{array}
if y < 620Initial program 83.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 49.8%
associate-/l*66.5%
Simplified66.5%
clear-num66.5%
un-div-inv66.5%
Applied egg-rr66.5%
if 620 < y < 3.29999999999999985e104 or 1.34999999999999997e155 < y < 4.1e180Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 3.0%
associate-/l*3.0%
Simplified3.0%
Taylor expanded in x around 0 46.5%
if 3.29999999999999985e104 < y < 1.34999999999999997e155Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 76.9%
Taylor expanded in y around inf 76.9%
if 4.1e180 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 80.0%
Final simplification67.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ y (* -0.16666666666666666 (* y (pow x 2.0))))))
(if (<= y 1400.0)
(/ y (/ x (sin x)))
(if (<= y 6e+46)
t_0
(if (<= y 1.35e+155)
(/ (* 0.16666666666666666 (* x (pow y 3.0))) x)
(if (<= y 4.1e+180)
t_0
(+ y (* 0.16666666666666666 (pow y 3.0)))))))))
double code(double x, double y) {
double t_0 = y + (-0.16666666666666666 * (y * pow(x, 2.0)));
double tmp;
if (y <= 1400.0) {
tmp = y / (x / sin(x));
} else if (y <= 6e+46) {
tmp = t_0;
} else if (y <= 1.35e+155) {
tmp = (0.16666666666666666 * (x * pow(y, 3.0))) / x;
} else if (y <= 4.1e+180) {
tmp = t_0;
} else {
tmp = y + (0.16666666666666666 * pow(y, 3.0));
}
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 + ((-0.16666666666666666d0) * (y * (x ** 2.0d0)))
if (y <= 1400.0d0) then
tmp = y / (x / sin(x))
else if (y <= 6d+46) then
tmp = t_0
else if (y <= 1.35d+155) then
tmp = (0.16666666666666666d0 * (x * (y ** 3.0d0))) / x
else if (y <= 4.1d+180) then
tmp = t_0
else
tmp = y + (0.16666666666666666d0 * (y ** 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y + (-0.16666666666666666 * (y * Math.pow(x, 2.0)));
double tmp;
if (y <= 1400.0) {
tmp = y / (x / Math.sin(x));
} else if (y <= 6e+46) {
tmp = t_0;
} else if (y <= 1.35e+155) {
tmp = (0.16666666666666666 * (x * Math.pow(y, 3.0))) / x;
} else if (y <= 4.1e+180) {
tmp = t_0;
} else {
tmp = y + (0.16666666666666666 * Math.pow(y, 3.0));
}
return tmp;
}
def code(x, y): t_0 = y + (-0.16666666666666666 * (y * math.pow(x, 2.0))) tmp = 0 if y <= 1400.0: tmp = y / (x / math.sin(x)) elif y <= 6e+46: tmp = t_0 elif y <= 1.35e+155: tmp = (0.16666666666666666 * (x * math.pow(y, 3.0))) / x elif y <= 4.1e+180: tmp = t_0 else: tmp = y + (0.16666666666666666 * math.pow(y, 3.0)) return tmp
function code(x, y) t_0 = Float64(y + Float64(-0.16666666666666666 * Float64(y * (x ^ 2.0)))) tmp = 0.0 if (y <= 1400.0) tmp = Float64(y / Float64(x / sin(x))); elseif (y <= 6e+46) tmp = t_0; elseif (y <= 1.35e+155) tmp = Float64(Float64(0.16666666666666666 * Float64(x * (y ^ 3.0))) / x); elseif (y <= 4.1e+180) tmp = t_0; else tmp = Float64(y + Float64(0.16666666666666666 * (y ^ 3.0))); end return tmp end
function tmp_2 = code(x, y) t_0 = y + (-0.16666666666666666 * (y * (x ^ 2.0))); tmp = 0.0; if (y <= 1400.0) tmp = y / (x / sin(x)); elseif (y <= 6e+46) tmp = t_0; elseif (y <= 1.35e+155) tmp = (0.16666666666666666 * (x * (y ^ 3.0))) / x; elseif (y <= 4.1e+180) tmp = t_0; else tmp = y + (0.16666666666666666 * (y ^ 3.0)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y + N[(-0.16666666666666666 * N[(y * N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1400.0], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6e+46], t$95$0, If[LessEqual[y, 1.35e+155], N[(N[(0.16666666666666666 * N[(x * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], If[LessEqual[y, 4.1e+180], t$95$0, N[(y + N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y + -0.16666666666666666 \cdot \left(y \cdot {x}^{2}\right)\\
\mathbf{if}\;y \leq 1400:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+155}:\\
\;\;\;\;\frac{0.16666666666666666 \cdot \left(x \cdot {y}^{3}\right)}{x}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+180}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;y + 0.16666666666666666 \cdot {y}^{3}\\
\end{array}
\end{array}
if y < 1400Initial program 83.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 49.8%
associate-/l*66.5%
Simplified66.5%
clear-num66.5%
un-div-inv66.5%
Applied egg-rr66.5%
if 1400 < y < 6.00000000000000047e46 or 1.34999999999999997e155 < y < 4.1e180Initial program 100.0%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 3.0%
associate-/l*3.0%
Simplified3.0%
Taylor expanded in x around 0 51.4%
if 6.00000000000000047e46 < y < 1.34999999999999997e155Initial program 100.0%
Taylor expanded in y around 0 83.4%
Taylor expanded in x around 0 65.6%
Taylor expanded in y around inf 65.6%
if 4.1e180 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
Taylor expanded in x around 0 80.0%
Final simplification67.1%
(FPCore (x y) :precision binary64 (if (<= y 2.7e+86) (* (sin x) (/ y x)) (+ y (* 0.16666666666666666 (pow y 3.0)))))
double code(double x, double y) {
double tmp;
if (y <= 2.7e+86) {
tmp = sin(x) * (y / x);
} else {
tmp = y + (0.16666666666666666 * pow(y, 3.0));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.7d+86) then
tmp = sin(x) * (y / x)
else
tmp = y + (0.16666666666666666d0 * (y ** 3.0d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.7e+86) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = y + (0.16666666666666666 * Math.pow(y, 3.0));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.7e+86: tmp = math.sin(x) * (y / x) else: tmp = y + (0.16666666666666666 * math.pow(y, 3.0)) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.7e+86) tmp = Float64(sin(x) * Float64(y / x)); else tmp = Float64(y + Float64(0.16666666666666666 * (y ^ 3.0))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.7e+86) tmp = sin(x) * (y / x); else tmp = y + (0.16666666666666666 * (y ^ 3.0)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.7e+86], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(y + N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.7 \cdot 10^{+86}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;y + 0.16666666666666666 \cdot {y}^{3}\\
\end{array}
\end{array}
if y < 2.70000000000000018e86Initial program 84.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 71.5%
if 2.70000000000000018e86 < y Initial program 100.0%
Taylor expanded in y around 0 98.2%
Taylor expanded in x around 0 66.9%
Final simplification70.6%
(FPCore (x y) :precision binary64 (if (<= y 5.1e+46) (* y (/ (sin x) x)) (* 0.16666666666666666 (pow y 3.0))))
double code(double x, double y) {
double tmp;
if (y <= 5.1e+46) {
tmp = y * (sin(x) / x);
} else {
tmp = 0.16666666666666666 * pow(y, 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 5.1d+46) then
tmp = y * (sin(x) / x)
else
tmp = 0.16666666666666666d0 * (y ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 5.1e+46) {
tmp = y * (Math.sin(x) / x);
} else {
tmp = 0.16666666666666666 * Math.pow(y, 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 5.1e+46: tmp = y * (math.sin(x) / x) else: tmp = 0.16666666666666666 * math.pow(y, 3.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 5.1e+46) tmp = Float64(y * Float64(sin(x) / x)); else tmp = Float64(0.16666666666666666 * (y ^ 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 5.1e+46) tmp = y * (sin(x) / x); else tmp = 0.16666666666666666 * (y ^ 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 5.1e+46], N[(y * N[(N[Sin[x], $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.1 \cdot 10^{+46}:\\
\;\;\;\;y \cdot \frac{\sin x}{x}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot {y}^{3}\\
\end{array}
\end{array}
if y < 5.0999999999999997e46Initial program 84.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 47.5%
associate-/l*63.4%
Simplified63.4%
if 5.0999999999999997e46 < y Initial program 100.0%
Taylor expanded in y around 0 94.7%
Taylor expanded in x around 0 66.3%
Taylor expanded in y around inf 64.5%
Final simplification63.6%
(FPCore (x y) :precision binary64 (if (<= y 2.85e+86) (* (sin x) (/ y x)) (* 0.16666666666666666 (pow y 3.0))))
double code(double x, double y) {
double tmp;
if (y <= 2.85e+86) {
tmp = sin(x) * (y / x);
} else {
tmp = 0.16666666666666666 * pow(y, 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.85d+86) then
tmp = sin(x) * (y / x)
else
tmp = 0.16666666666666666d0 * (y ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.85e+86) {
tmp = Math.sin(x) * (y / x);
} else {
tmp = 0.16666666666666666 * Math.pow(y, 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.85e+86: tmp = math.sin(x) * (y / x) else: tmp = 0.16666666666666666 * math.pow(y, 3.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.85e+86) tmp = Float64(sin(x) * Float64(y / x)); else tmp = Float64(0.16666666666666666 * (y ^ 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.85e+86) tmp = sin(x) * (y / x); else tmp = 0.16666666666666666 * (y ^ 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.85e+86], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.85 \cdot 10^{+86}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot {y}^{3}\\
\end{array}
\end{array}
if y < 2.85e86Initial program 84.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 71.5%
if 2.85e86 < y Initial program 100.0%
Taylor expanded in y around 0 98.2%
Taylor expanded in x around 0 66.9%
Taylor expanded in y around inf 66.9%
Final simplification70.6%
(FPCore (x y) :precision binary64 (if (<= y 2.85e+86) (* x (/ y x)) (* 0.16666666666666666 (pow y 3.0))))
double code(double x, double y) {
double tmp;
if (y <= 2.85e+86) {
tmp = x * (y / x);
} else {
tmp = 0.16666666666666666 * pow(y, 3.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.85d+86) then
tmp = x * (y / x)
else
tmp = 0.16666666666666666d0 * (y ** 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.85e+86) {
tmp = x * (y / x);
} else {
tmp = 0.16666666666666666 * Math.pow(y, 3.0);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.85e+86: tmp = x * (y / x) else: tmp = 0.16666666666666666 * math.pow(y, 3.0) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.85e+86) tmp = Float64(x * Float64(y / x)); else tmp = Float64(0.16666666666666666 * (y ^ 3.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.85e+86) tmp = x * (y / x); else tmp = 0.16666666666666666 * (y ^ 3.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.85e+86], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[Power[y, 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.85 \cdot 10^{+86}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot {y}^{3}\\
\end{array}
\end{array}
if y < 2.85e86Initial program 84.2%
Taylor expanded in y around 0 47.1%
Taylor expanded in x around 0 19.6%
*-commutative19.6%
Simplified19.6%
*-commutative19.6%
associate-/l*54.6%
Applied egg-rr54.6%
if 2.85e86 < y Initial program 100.0%
Taylor expanded in y around 0 98.2%
Taylor expanded in x around 0 66.9%
Taylor expanded in y around inf 66.9%
Final simplification57.1%
(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.3%
Taylor expanded in y around 0 38.7%
Taylor expanded in x around 0 19.1%
*-commutative19.1%
Simplified19.1%
*-commutative19.1%
associate-/l*50.8%
Applied egg-rr50.8%
Final simplification50.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.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 38.7%
associate-/l*51.3%
Simplified51.3%
Taylor expanded in x around 0 26.3%
Final simplification26.3%
(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 2024043
(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))