
(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 90.6%
associate-*r/99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (or (<= y -420.0) (not (<= y 860000.0))) (log1p (expm1 y)) (/ y (/ x (sin x)))))
double code(double x, double y) {
double tmp;
if ((y <= -420.0) || !(y <= 860000.0)) {
tmp = log1p(expm1(y));
} else {
tmp = y / (x / sin(x));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if ((y <= -420.0) || !(y <= 860000.0)) {
tmp = Math.log1p(Math.expm1(y));
} else {
tmp = y / (x / Math.sin(x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -420.0) or not (y <= 860000.0): tmp = math.log1p(math.expm1(y)) else: tmp = y / (x / math.sin(x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -420.0) || !(y <= 860000.0)) tmp = log1p(expm1(y)); else tmp = Float64(y / Float64(x / sin(x))); end return tmp end
code[x_, y_] := If[Or[LessEqual[y, -420.0], N[Not[LessEqual[y, 860000.0]], $MachinePrecision]], N[Log[1 + N[(Exp[y] - 1), $MachinePrecision]], $MachinePrecision], N[(y / N[(x / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -420 \lor \neg \left(y \leq 860000\right):\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{x}{\sin x}}\\
\end{array}
\end{array}
if y < -420 or 8.6e5 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 4.2%
Taylor expanded in x around 0 16.4%
div-inv16.4%
associate-*l*3.9%
div-inv3.9%
*-inverses3.9%
*-commutative3.9%
*-un-lft-identity3.9%
log1p-expm1-u73.9%
Applied egg-rr73.9%
if -420 < y < 8.6e5Initial program 78.8%
associate-*r/99.8%
Simplified99.8%
Taylor expanded in y around 0 77.9%
associate-/l*98.9%
Simplified98.9%
Final simplification85.0%
(FPCore (x y)
:precision binary64
(if (<= y -5.8e+254)
(/ (* x y) x)
(if (or (<= y -1.2e+162) (not (<= y 2.25e+157)))
(sqrt (* y y))
(* (sin x) (/ y x)))))
double code(double x, double y) {
double tmp;
if (y <= -5.8e+254) {
tmp = (x * y) / x;
} else if ((y <= -1.2e+162) || !(y <= 2.25e+157)) {
tmp = sqrt((y * y));
} else {
tmp = sin(x) * (y / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-5.8d+254)) then
tmp = (x * y) / x
else if ((y <= (-1.2d+162)) .or. (.not. (y <= 2.25d+157))) then
tmp = sqrt((y * y))
else
tmp = sin(x) * (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -5.8e+254) {
tmp = (x * y) / x;
} else if ((y <= -1.2e+162) || !(y <= 2.25e+157)) {
tmp = Math.sqrt((y * y));
} else {
tmp = Math.sin(x) * (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -5.8e+254: tmp = (x * y) / x elif (y <= -1.2e+162) or not (y <= 2.25e+157): tmp = math.sqrt((y * y)) else: tmp = math.sin(x) * (y / x) return tmp
function code(x, y) tmp = 0.0 if (y <= -5.8e+254) tmp = Float64(Float64(x * y) / x); elseif ((y <= -1.2e+162) || !(y <= 2.25e+157)) tmp = sqrt(Float64(y * y)); else tmp = Float64(sin(x) * Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -5.8e+254) tmp = (x * y) / x; elseif ((y <= -1.2e+162) || ~((y <= 2.25e+157))) tmp = sqrt((y * y)); else tmp = sin(x) * (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -5.8e+254], N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision], If[Or[LessEqual[y, -1.2e+162], N[Not[LessEqual[y, 2.25e+157]], $MachinePrecision]], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.8 \cdot 10^{+254}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{+162} \lor \neg \left(y \leq 2.25 \cdot 10^{+157}\right):\\
\;\;\;\;\sqrt{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \frac{y}{x}\\
\end{array}
\end{array}
if y < -5.7999999999999999e254Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 6.0%
Taylor expanded in x around 0 78.0%
if -5.7999999999999999e254 < y < -1.20000000000000005e162 or 2.24999999999999992e157 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.2%
Taylor expanded in x around 0 15.2%
div-inv15.2%
associate-*l*4.4%
div-inv4.4%
*-inverses4.4%
*-commutative4.4%
*-un-lft-identity4.4%
add-sqr-sqrt3.6%
sqrt-unprod71.2%
Applied egg-rr71.2%
if -1.20000000000000005e162 < y < 2.24999999999999992e157Initial program 87.7%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 46.7%
associate-/l*58.9%
associate-/r/64.7%
Simplified64.7%
Final simplification66.5%
(FPCore (x y)
:precision binary64
(if (<= y -9.8e+255)
(/ (* x y) x)
(if (or (<= y -2.2e+158) (not (<= y 2.25e+157)))
(sqrt (* y y))
(/ (/ y x) (+ (* x 0.16666666666666666) (/ 1.0 x))))))
double code(double x, double y) {
double tmp;
if (y <= -9.8e+255) {
tmp = (x * y) / x;
} else if ((y <= -2.2e+158) || !(y <= 2.25e+157)) {
tmp = sqrt((y * y));
} else {
tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-9.8d+255)) then
tmp = (x * y) / x
else if ((y <= (-2.2d+158)) .or. (.not. (y <= 2.25d+157))) then
tmp = sqrt((y * y))
else
tmp = (y / x) / ((x * 0.16666666666666666d0) + (1.0d0 / x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -9.8e+255) {
tmp = (x * y) / x;
} else if ((y <= -2.2e+158) || !(y <= 2.25e+157)) {
tmp = Math.sqrt((y * y));
} else {
tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -9.8e+255: tmp = (x * y) / x elif (y <= -2.2e+158) or not (y <= 2.25e+157): tmp = math.sqrt((y * y)) else: tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x)) return tmp
function code(x, y) tmp = 0.0 if (y <= -9.8e+255) tmp = Float64(Float64(x * y) / x); elseif ((y <= -2.2e+158) || !(y <= 2.25e+157)) tmp = sqrt(Float64(y * y)); else tmp = Float64(Float64(y / x) / Float64(Float64(x * 0.16666666666666666) + Float64(1.0 / x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -9.8e+255) tmp = (x * y) / x; elseif ((y <= -2.2e+158) || ~((y <= 2.25e+157))) tmp = sqrt((y * y)); else tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -9.8e+255], N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision], If[Or[LessEqual[y, -2.2e+158], N[Not[LessEqual[y, 2.25e+157]], $MachinePrecision]], N[Sqrt[N[(y * y), $MachinePrecision]], $MachinePrecision], N[(N[(y / x), $MachinePrecision] / N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.8 \cdot 10^{+255}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\mathbf{elif}\;y \leq -2.2 \cdot 10^{+158} \lor \neg \left(y \leq 2.25 \cdot 10^{+157}\right):\\
\;\;\;\;\sqrt{y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{y}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x}}\\
\end{array}
\end{array}
if y < -9.79999999999999943e255Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 6.0%
Taylor expanded in x around 0 78.0%
if -9.79999999999999943e255 < y < -2.2000000000000001e158 or 2.24999999999999992e157 < y Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 5.2%
Taylor expanded in x around 0 15.2%
div-inv15.2%
associate-*l*4.4%
div-inv4.4%
*-inverses4.4%
*-commutative4.4%
*-un-lft-identity4.4%
add-sqr-sqrt3.6%
sqrt-unprod71.2%
Applied egg-rr71.2%
if -2.2000000000000001e158 < y < 2.24999999999999992e157Initial program 87.7%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 46.7%
associate-/l*58.9%
associate-/r/64.7%
Simplified64.7%
associate-/r/58.9%
div-inv58.8%
associate-/r*64.6%
Applied egg-rr64.6%
Taylor expanded in x around 0 49.4%
Final simplification54.7%
(FPCore (x y)
:precision binary64
(if (<= x 1.45e+59)
(* x (/ y x))
(if (<= x 7.8e+187)
(* y (+ 1.0 (* -0.16666666666666666 (* x x))))
(if (<= x 8.2e+256) (/ x (/ x y)) (/ (* x y) x)))))
double code(double x, double y) {
double tmp;
if (x <= 1.45e+59) {
tmp = x * (y / x);
} else if (x <= 7.8e+187) {
tmp = y * (1.0 + (-0.16666666666666666 * (x * x)));
} else if (x <= 8.2e+256) {
tmp = x / (x / y);
} 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) :: tmp
if (x <= 1.45d+59) then
tmp = x * (y / x)
else if (x <= 7.8d+187) then
tmp = y * (1.0d0 + ((-0.16666666666666666d0) * (x * x)))
else if (x <= 8.2d+256) then
tmp = x / (x / y)
else
tmp = (x * y) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1.45e+59) {
tmp = x * (y / x);
} else if (x <= 7.8e+187) {
tmp = y * (1.0 + (-0.16666666666666666 * (x * x)));
} else if (x <= 8.2e+256) {
tmp = x / (x / y);
} else {
tmp = (x * y) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.45e+59: tmp = x * (y / x) elif x <= 7.8e+187: tmp = y * (1.0 + (-0.16666666666666666 * (x * x))) elif x <= 8.2e+256: tmp = x / (x / y) else: tmp = (x * y) / x return tmp
function code(x, y) tmp = 0.0 if (x <= 1.45e+59) tmp = Float64(x * Float64(y / x)); elseif (x <= 7.8e+187) tmp = Float64(y * Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x)))); elseif (x <= 8.2e+256) tmp = Float64(x / Float64(x / y)); else tmp = Float64(Float64(x * y) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1.45e+59) tmp = x * (y / x); elseif (x <= 7.8e+187) tmp = y * (1.0 + (-0.16666666666666666 * (x * x))); elseif (x <= 8.2e+256) tmp = x / (x / y); else tmp = (x * y) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.45e+59], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.8e+187], N[(y * N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.2e+256], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{+59}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+187}:\\
\;\;\;\;y \cdot \left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+256}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\end{array}
\end{array}
if x < 1.44999999999999995e59Initial program 88.5%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 36.2%
Taylor expanded in x around 0 24.7%
associate-/l*31.1%
associate-/r/52.1%
Applied egg-rr52.1%
if 1.44999999999999995e59 < x < 7.79999999999999962e187Initial program 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 30.9%
associate-/l*30.9%
Simplified30.9%
clear-num30.8%
associate-/r/30.9%
clear-num30.9%
Applied egg-rr30.9%
Taylor expanded in x around 0 39.8%
unpow239.8%
Simplified39.8%
if 7.79999999999999962e187 < x < 8.20000000000000011e256Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 72.0%
Taylor expanded in x around 0 25.0%
associate-/l*4.8%
associate-/r/45.4%
Applied egg-rr45.4%
*-commutative45.4%
clear-num49.3%
un-div-inv49.3%
Applied egg-rr49.3%
if 8.20000000000000011e256 < x Initial program 100.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 20.2%
Taylor expanded in x around 0 27.9%
Final simplification49.9%
(FPCore (x y)
:precision binary64
(if (<= x 1.45e+59)
(/ (/ y x) (+ (* x 0.16666666666666666) (/ 1.0 x)))
(if (<= x 7.8e+187)
(* y (+ 1.0 (* -0.16666666666666666 (* x x))))
(if (<= x 6.5e+256) (/ x (/ x y)) (/ (* x y) x)))))
double code(double x, double y) {
double tmp;
if (x <= 1.45e+59) {
tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x));
} else if (x <= 7.8e+187) {
tmp = y * (1.0 + (-0.16666666666666666 * (x * x)));
} else if (x <= 6.5e+256) {
tmp = x / (x / y);
} 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) :: tmp
if (x <= 1.45d+59) then
tmp = (y / x) / ((x * 0.16666666666666666d0) + (1.0d0 / x))
else if (x <= 7.8d+187) then
tmp = y * (1.0d0 + ((-0.16666666666666666d0) * (x * x)))
else if (x <= 6.5d+256) then
tmp = x / (x / y)
else
tmp = (x * y) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1.45e+59) {
tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x));
} else if (x <= 7.8e+187) {
tmp = y * (1.0 + (-0.16666666666666666 * (x * x)));
} else if (x <= 6.5e+256) {
tmp = x / (x / y);
} else {
tmp = (x * y) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.45e+59: tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x)) elif x <= 7.8e+187: tmp = y * (1.0 + (-0.16666666666666666 * (x * x))) elif x <= 6.5e+256: tmp = x / (x / y) else: tmp = (x * y) / x return tmp
function code(x, y) tmp = 0.0 if (x <= 1.45e+59) tmp = Float64(Float64(y / x) / Float64(Float64(x * 0.16666666666666666) + Float64(1.0 / x))); elseif (x <= 7.8e+187) tmp = Float64(y * Float64(1.0 + Float64(-0.16666666666666666 * Float64(x * x)))); elseif (x <= 6.5e+256) tmp = Float64(x / Float64(x / y)); else tmp = Float64(Float64(x * y) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1.45e+59) tmp = (y / x) / ((x * 0.16666666666666666) + (1.0 / x)); elseif (x <= 7.8e+187) tmp = y * (1.0 + (-0.16666666666666666 * (x * x))); elseif (x <= 6.5e+256) tmp = x / (x / y); else tmp = (x * y) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.45e+59], N[(N[(y / x), $MachinePrecision] / N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.8e+187], N[(y * N[(1.0 + N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.5e+256], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{+59}:\\
\;\;\;\;\frac{\frac{y}{x}}{x \cdot 0.16666666666666666 + \frac{1}{x}}\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+187}:\\
\;\;\;\;y \cdot \left(1 + -0.16666666666666666 \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{+256}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\end{array}
\end{array}
if x < 1.44999999999999995e59Initial program 88.5%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 36.2%
associate-/l*47.6%
associate-/r/63.6%
Simplified63.6%
associate-/r/47.6%
div-inv47.5%
associate-/r*63.5%
Applied egg-rr63.5%
Taylor expanded in x around 0 53.1%
if 1.44999999999999995e59 < x < 7.79999999999999962e187Initial program 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 30.9%
associate-/l*30.9%
Simplified30.9%
clear-num30.8%
associate-/r/30.9%
clear-num30.9%
Applied egg-rr30.9%
Taylor expanded in x around 0 39.8%
unpow239.8%
Simplified39.8%
if 7.79999999999999962e187 < x < 6.50000000000000053e256Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 72.0%
Taylor expanded in x around 0 25.0%
associate-/l*4.8%
associate-/r/45.4%
Applied egg-rr45.4%
*-commutative45.4%
clear-num49.3%
un-div-inv49.3%
Applied egg-rr49.3%
if 6.50000000000000053e256 < x Initial program 100.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 20.2%
Taylor expanded in x around 0 27.9%
Final simplification50.7%
(FPCore (x y)
:precision binary64
(if (<= x 1.45e+59)
(* x (/ y x))
(if (<= x 7.8e+187)
(* -0.16666666666666666 (* y (* x x)))
(if (<= x 7e+256) (/ x (/ x y)) (/ (* x y) x)))))
double code(double x, double y) {
double tmp;
if (x <= 1.45e+59) {
tmp = x * (y / x);
} else if (x <= 7.8e+187) {
tmp = -0.16666666666666666 * (y * (x * x));
} else if (x <= 7e+256) {
tmp = x / (x / y);
} 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) :: tmp
if (x <= 1.45d+59) then
tmp = x * (y / x)
else if (x <= 7.8d+187) then
tmp = (-0.16666666666666666d0) * (y * (x * x))
else if (x <= 7d+256) then
tmp = x / (x / y)
else
tmp = (x * y) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1.45e+59) {
tmp = x * (y / x);
} else if (x <= 7.8e+187) {
tmp = -0.16666666666666666 * (y * (x * x));
} else if (x <= 7e+256) {
tmp = x / (x / y);
} else {
tmp = (x * y) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.45e+59: tmp = x * (y / x) elif x <= 7.8e+187: tmp = -0.16666666666666666 * (y * (x * x)) elif x <= 7e+256: tmp = x / (x / y) else: tmp = (x * y) / x return tmp
function code(x, y) tmp = 0.0 if (x <= 1.45e+59) tmp = Float64(x * Float64(y / x)); elseif (x <= 7.8e+187) tmp = Float64(-0.16666666666666666 * Float64(y * Float64(x * x))); elseif (x <= 7e+256) tmp = Float64(x / Float64(x / y)); else tmp = Float64(Float64(x * y) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1.45e+59) tmp = x * (y / x); elseif (x <= 7.8e+187) tmp = -0.16666666666666666 * (y * (x * x)); elseif (x <= 7e+256) tmp = x / (x / y); else tmp = (x * y) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.45e+59], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.8e+187], N[(-0.16666666666666666 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e+256], N[(x / N[(x / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.45 \cdot 10^{+59}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+187}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 7 \cdot 10^{+256}:\\
\;\;\;\;\frac{x}{\frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\end{array}
\end{array}
if x < 1.44999999999999995e59Initial program 88.5%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 36.2%
Taylor expanded in x around 0 24.7%
associate-/l*31.1%
associate-/r/52.1%
Applied egg-rr52.1%
if 1.44999999999999995e59 < x < 7.79999999999999962e187Initial program 99.9%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 30.9%
associate-/l*30.9%
Simplified30.9%
clear-num30.8%
associate-/r/30.9%
clear-num30.9%
Applied egg-rr30.9%
Taylor expanded in x around 0 39.8%
unpow239.8%
Simplified39.8%
Taylor expanded in x around inf 39.8%
unpow239.8%
Simplified39.8%
if 7.79999999999999962e187 < x < 6.9999999999999995e256Initial program 100.0%
associate-*r/100.0%
Simplified100.0%
Taylor expanded in y around 0 72.0%
Taylor expanded in x around 0 25.0%
associate-/l*4.8%
associate-/r/45.4%
Applied egg-rr45.4%
*-commutative45.4%
clear-num49.3%
un-div-inv49.3%
Applied egg-rr49.3%
if 6.9999999999999995e256 < x Initial program 100.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 20.2%
Taylor expanded in x around 0 27.9%
Final simplification49.9%
(FPCore (x y) :precision binary64 (if (<= x 6.5e+256) (* x (/ y x)) (/ (* x y) x)))
double code(double x, double y) {
double tmp;
if (x <= 6.5e+256) {
tmp = x * (y / 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) :: tmp
if (x <= 6.5d+256) then
tmp = x * (y / x)
else
tmp = (x * y) / x
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 6.5e+256) {
tmp = x * (y / x);
} else {
tmp = (x * y) / x;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 6.5e+256: tmp = x * (y / x) else: tmp = (x * y) / x return tmp
function code(x, y) tmp = 0.0 if (x <= 6.5e+256) tmp = Float64(x * Float64(y / x)); else tmp = Float64(Float64(x * y) / x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 6.5e+256) tmp = x * (y / x); else tmp = (x * y) / x; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 6.5e+256], N[(x * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] / x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.5 \cdot 10^{+256}:\\
\;\;\;\;x \cdot \frac{y}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{x}\\
\end{array}
\end{array}
if x < 6.50000000000000053e256Initial program 90.2%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 37.8%
Taylor expanded in x around 0 23.6%
associate-/l*27.2%
associate-/r/47.8%
Applied egg-rr47.8%
if 6.50000000000000053e256 < x Initial program 100.0%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 20.2%
Taylor expanded in x around 0 27.9%
Final simplification47.0%
(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 90.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 37.0%
Taylor expanded in x around 0 23.8%
associate-/l*26.2%
associate-/r/46.3%
Applied egg-rr46.3%
Final simplification46.3%
(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 90.6%
associate-*r/99.9%
Simplified99.9%
Taylor expanded in y around 0 37.0%
associate-/l*46.4%
associate-/r/59.5%
Simplified59.5%
Taylor expanded in x around 0 26.2%
Final simplification26.2%
(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 2023257
(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))