
(FPCore (x y) :precision binary64 (* (cosh x) (/ (sin y) y)))
double code(double x, double y) {
return cosh(x) * (sin(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cosh(x) * (sin(y) / y)
end function
public static double code(double x, double y) {
return Math.cosh(x) * (Math.sin(y) / y);
}
def code(x, y): return math.cosh(x) * (math.sin(y) / y)
function code(x, y) return Float64(cosh(x) * Float64(sin(y) / y)) end
function tmp = code(x, y) tmp = cosh(x) * (sin(y) / y); end
code[x_, y_] := N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cosh x \cdot \frac{\sin y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (cosh x) (/ (sin y) y)))
double code(double x, double y) {
return cosh(x) * (sin(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cosh(x) * (sin(y) / y)
end function
public static double code(double x, double y) {
return Math.cosh(x) * (Math.sin(y) / y);
}
def code(x, y): return math.cosh(x) * (math.sin(y) / y)
function code(x, y) return Float64(cosh(x) * Float64(sin(y) / y)) end
function tmp = code(x, y) tmp = cosh(x) * (sin(y) / y); end
code[x_, y_] := N[(N[Cosh[x], $MachinePrecision] * N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cosh x \cdot \frac{\sin y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (/ (sin y) y) (cosh x)))
double code(double x, double y) {
return (sin(y) / y) * cosh(x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(y) / y) * cosh(x)
end function
public static double code(double x, double y) {
return (Math.sin(y) / y) * Math.cosh(x);
}
def code(x, y): return (math.sin(y) / y) * math.cosh(x)
function code(x, y) return Float64(Float64(sin(y) / y) * cosh(x)) end
function tmp = code(x, y) tmp = (sin(y) / y) * cosh(x); end
code[x_, y_] := N[(N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin y}{y} \cdot \cosh x
\end{array}
Initial program 99.6%
Final simplification99.6%
(FPCore (x y) :precision binary64 (if (or (<= x 850.0) (not (<= x 1e+141))) (* (sin y) (+ (/ 1.0 y) (* 0.5 (/ (* x x) y)))) (cosh x)))
double code(double x, double y) {
double tmp;
if ((x <= 850.0) || !(x <= 1e+141)) {
tmp = sin(y) * ((1.0 / y) + (0.5 * ((x * x) / y)));
} else {
tmp = cosh(x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= 850.0d0) .or. (.not. (x <= 1d+141))) then
tmp = sin(y) * ((1.0d0 / y) + (0.5d0 * ((x * x) / y)))
else
tmp = cosh(x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= 850.0) || !(x <= 1e+141)) {
tmp = Math.sin(y) * ((1.0 / y) + (0.5 * ((x * x) / y)));
} else {
tmp = Math.cosh(x);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= 850.0) or not (x <= 1e+141): tmp = math.sin(y) * ((1.0 / y) + (0.5 * ((x * x) / y))) else: tmp = math.cosh(x) return tmp
function code(x, y) tmp = 0.0 if ((x <= 850.0) || !(x <= 1e+141)) tmp = Float64(sin(y) * Float64(Float64(1.0 / y) + Float64(0.5 * Float64(Float64(x * x) / y)))); else tmp = cosh(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= 850.0) || ~((x <= 1e+141))) tmp = sin(y) * ((1.0 / y) + (0.5 * ((x * x) / y))); else tmp = cosh(x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, 850.0], N[Not[LessEqual[x, 1e+141]], $MachinePrecision]], N[(N[Sin[y], $MachinePrecision] * N[(N[(1.0 / y), $MachinePrecision] + N[(0.5 * N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cosh[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 850 \lor \neg \left(x \leq 10^{+141}\right):\\
\;\;\;\;\sin y \cdot \left(\frac{1}{y} + 0.5 \cdot \frac{x \cdot x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\cosh x\\
\end{array}
\end{array}
if x < 850 or 1.00000000000000002e141 < x Initial program 99.5%
add-log-exp74.6%
*-un-lft-identity74.6%
log-prod74.6%
metadata-eval74.6%
add-log-exp99.5%
Applied egg-rr99.5%
+-lft-identity99.5%
associate-*r/99.5%
associate-*l/99.4%
Simplified99.4%
Taylor expanded in x around 0 92.0%
unpow292.0%
Simplified92.0%
if 850 < x < 1.00000000000000002e141Initial program 100.0%
Taylor expanded in y around 0 80.6%
Final simplification90.4%
(FPCore (x y) :precision binary64 (if (<= x 850.0) (/ (sin y) y) (if (<= x 4.6e+150) (cosh x) (/ (+ 1.0 (* 0.5 (* x x))) (/ y (sin y))))))
double code(double x, double y) {
double tmp;
if (x <= 850.0) {
tmp = sin(y) / y;
} else if (x <= 4.6e+150) {
tmp = cosh(x);
} else {
tmp = (1.0 + (0.5 * (x * x))) / (y / sin(y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 850.0d0) then
tmp = sin(y) / y
else if (x <= 4.6d+150) then
tmp = cosh(x)
else
tmp = (1.0d0 + (0.5d0 * (x * x))) / (y / sin(y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 850.0) {
tmp = Math.sin(y) / y;
} else if (x <= 4.6e+150) {
tmp = Math.cosh(x);
} else {
tmp = (1.0 + (0.5 * (x * x))) / (y / Math.sin(y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 850.0: tmp = math.sin(y) / y elif x <= 4.6e+150: tmp = math.cosh(x) else: tmp = (1.0 + (0.5 * (x * x))) / (y / math.sin(y)) return tmp
function code(x, y) tmp = 0.0 if (x <= 850.0) tmp = Float64(sin(y) / y); elseif (x <= 4.6e+150) tmp = cosh(x); else tmp = Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / Float64(y / sin(y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 850.0) tmp = sin(y) / y; elseif (x <= 4.6e+150) tmp = cosh(x); else tmp = (1.0 + (0.5 * (x * x))) / (y / sin(y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 850.0], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 4.6e+150], N[Cosh[x], $MachinePrecision], N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 850:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+150}:\\
\;\;\;\;\cosh x\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + 0.5 \cdot \left(x \cdot x\right)}{\frac{y}{\sin y}}\\
\end{array}
\end{array}
if x < 850Initial program 99.4%
Taylor expanded in x around 0 65.2%
if 850 < x < 4.60000000000000002e150Initial program 100.0%
Taylor expanded in y around 0 78.9%
if 4.60000000000000002e150 < x Initial program 100.0%
add-log-exp100.0%
*-un-lft-identity100.0%
log-prod100.0%
metadata-eval100.0%
add-log-exp100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
associate-*r/100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 97.3%
unpow297.3%
Simplified97.3%
Taylor expanded in y around inf 97.3%
associate-/l*97.3%
unpow297.3%
Simplified97.3%
Final simplification71.7%
(FPCore (x y)
:precision binary64
(if (<= x 9.2e-5)
(/ (sin y) y)
(if (<= x 3.9e+223)
(* (cosh x) (+ 1.0 (* (* y y) -0.16666666666666666)))
(* y (+ (/ 1.0 y) (* 0.5 (/ (* x x) y)))))))
double code(double x, double y) {
double tmp;
if (x <= 9.2e-5) {
tmp = sin(y) / y;
} else if (x <= 3.9e+223) {
tmp = cosh(x) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = y * ((1.0 / y) + (0.5 * ((x * x) / y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 9.2d-5) then
tmp = sin(y) / y
else if (x <= 3.9d+223) then
tmp = cosh(x) * (1.0d0 + ((y * y) * (-0.16666666666666666d0)))
else
tmp = y * ((1.0d0 / y) + (0.5d0 * ((x * x) / y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 9.2e-5) {
tmp = Math.sin(y) / y;
} else if (x <= 3.9e+223) {
tmp = Math.cosh(x) * (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = y * ((1.0 / y) + (0.5 * ((x * x) / y)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 9.2e-5: tmp = math.sin(y) / y elif x <= 3.9e+223: tmp = math.cosh(x) * (1.0 + ((y * y) * -0.16666666666666666)) else: tmp = y * ((1.0 / y) + (0.5 * ((x * x) / y))) return tmp
function code(x, y) tmp = 0.0 if (x <= 9.2e-5) tmp = Float64(sin(y) / y); elseif (x <= 3.9e+223) tmp = Float64(cosh(x) * Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))); else tmp = Float64(y * Float64(Float64(1.0 / y) + Float64(0.5 * Float64(Float64(x * x) / y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 9.2e-5) tmp = sin(y) / y; elseif (x <= 3.9e+223) tmp = cosh(x) * (1.0 + ((y * y) * -0.16666666666666666)); else tmp = y * ((1.0 / y) + (0.5 * ((x * x) / y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 9.2e-5], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 3.9e+223], N[(N[Cosh[x], $MachinePrecision] * N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(1.0 / y), $MachinePrecision] + N[(0.5 * N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 9.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+223}:\\
\;\;\;\;\cosh x \cdot \left(1 + \left(y \cdot y\right) \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\frac{1}{y} + 0.5 \cdot \frac{x \cdot x}{y}\right)\\
\end{array}
\end{array}
if x < 9.20000000000000001e-5Initial program 99.4%
Taylor expanded in x around 0 65.2%
if 9.20000000000000001e-5 < x < 3.8999999999999999e223Initial program 100.0%
Taylor expanded in y around 0 72.3%
*-commutative72.3%
unpow272.3%
Simplified72.3%
if 3.8999999999999999e223 < x Initial program 100.0%
add-log-exp100.0%
*-un-lft-identity100.0%
log-prod100.0%
metadata-eval100.0%
add-log-exp100.0%
Applied egg-rr100.0%
+-lft-identity100.0%
associate-*r/100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in x around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 84.6%
Final simplification68.5%
(FPCore (x y) :precision binary64 (if (<= x 850.0) (/ (sin y) y) (cosh x)))
double code(double x, double y) {
double tmp;
if (x <= 850.0) {
tmp = sin(y) / y;
} else {
tmp = cosh(x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 850.0d0) then
tmp = sin(y) / y
else
tmp = cosh(x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 850.0) {
tmp = Math.sin(y) / y;
} else {
tmp = Math.cosh(x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 850.0: tmp = math.sin(y) / y else: tmp = math.cosh(x) return tmp
function code(x, y) tmp = 0.0 if (x <= 850.0) tmp = Float64(sin(y) / y); else tmp = cosh(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 850.0) tmp = sin(y) / y; else tmp = cosh(x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 850.0], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[Cosh[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 850:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\cosh x\\
\end{array}
\end{array}
if x < 850Initial program 99.4%
Taylor expanded in x around 0 65.2%
if 850 < x Initial program 100.0%
Taylor expanded in y around 0 76.7%
Final simplification68.5%
(FPCore (x y) :precision binary64 (cosh x))
double code(double x, double y) {
return cosh(x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cosh(x)
end function
public static double code(double x, double y) {
return Math.cosh(x);
}
def code(x, y): return math.cosh(x)
function code(x, y) return cosh(x) end
function tmp = code(x, y) tmp = cosh(x); end
code[x_, y_] := N[Cosh[x], $MachinePrecision]
\begin{array}{l}
\\
\cosh x
\end{array}
Initial program 99.6%
Taylor expanded in y around 0 64.3%
Final simplification64.3%
(FPCore (x y)
:precision binary64
(if (<= y 1.38e+166)
(* y (+ (/ 1.0 y) (* 0.5 (/ (* x x) y))))
(if (<= y 6.4e+271)
(* (* y y) -0.16666666666666666)
(* y (* y 0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if (y <= 1.38e+166) {
tmp = y * ((1.0 / y) + (0.5 * ((x * x) / y)));
} else if (y <= 6.4e+271) {
tmp = (y * y) * -0.16666666666666666;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.38d+166) then
tmp = y * ((1.0d0 / y) + (0.5d0 * ((x * x) / y)))
else if (y <= 6.4d+271) then
tmp = (y * y) * (-0.16666666666666666d0)
else
tmp = y * (y * 0.16666666666666666d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.38e+166) {
tmp = y * ((1.0 / y) + (0.5 * ((x * x) / y)));
} else if (y <= 6.4e+271) {
tmp = (y * y) * -0.16666666666666666;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.38e+166: tmp = y * ((1.0 / y) + (0.5 * ((x * x) / y))) elif y <= 6.4e+271: tmp = (y * y) * -0.16666666666666666 else: tmp = y * (y * 0.16666666666666666) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.38e+166) tmp = Float64(y * Float64(Float64(1.0 / y) + Float64(0.5 * Float64(Float64(x * x) / y)))); elseif (y <= 6.4e+271) tmp = Float64(Float64(y * y) * -0.16666666666666666); else tmp = Float64(y * Float64(y * 0.16666666666666666)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.38e+166) tmp = y * ((1.0 / y) + (0.5 * ((x * x) / y))); elseif (y <= 6.4e+271) tmp = (y * y) * -0.16666666666666666; else tmp = y * (y * 0.16666666666666666); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.38e+166], N[(y * N[(N[(1.0 / y), $MachinePrecision] + N[(0.5 * N[(N[(x * x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e+271], N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision], N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.38 \cdot 10^{+166}:\\
\;\;\;\;y \cdot \left(\frac{1}{y} + 0.5 \cdot \frac{x \cdot x}{y}\right)\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+271}:\\
\;\;\;\;\left(y \cdot y\right) \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot 0.16666666666666666\right)\\
\end{array}
\end{array}
if y < 1.38000000000000001e166Initial program 99.5%
add-log-exp79.8%
*-un-lft-identity79.8%
log-prod79.8%
metadata-eval79.8%
add-log-exp99.5%
Applied egg-rr99.5%
+-lft-identity99.5%
associate-*r/99.5%
associate-*l/99.4%
Simplified99.4%
Taylor expanded in x around 0 84.0%
unpow284.0%
Simplified84.0%
Taylor expanded in y around 0 56.3%
if 1.38000000000000001e166 < y < 6.4000000000000003e271Initial program 100.0%
Taylor expanded in y around 0 32.2%
*-commutative32.2%
unpow232.2%
Simplified32.2%
Taylor expanded in x around 0 32.2%
+-commutative32.2%
*-commutative32.2%
unpow232.2%
associate-*r*32.2%
fma-udef32.2%
Simplified32.2%
Taylor expanded in y around inf 32.2%
*-commutative32.2%
unpow232.2%
associate-*l*32.2%
Simplified32.2%
Taylor expanded in y around 0 32.2%
unpow232.2%
Simplified32.2%
if 6.4000000000000003e271 < y Initial program 100.0%
Taylor expanded in y around 0 0.7%
*-commutative0.7%
unpow20.7%
Simplified0.7%
Taylor expanded in x around 0 0.7%
+-commutative0.7%
*-commutative0.7%
unpow20.7%
associate-*r*0.7%
fma-udef0.7%
Simplified0.7%
Taylor expanded in y around inf 0.7%
*-commutative0.7%
unpow20.7%
associate-*l*0.7%
Simplified0.7%
Taylor expanded in y around 0 0.7%
unpow20.7%
*-commutative0.7%
associate-*r*0.7%
unpow10.7%
sqr-pow57.8%
fabs-sqr57.8%
sqr-pow57.8%
unpow157.8%
*-lft-identity57.8%
associate-*r*57.8%
fabs-mul57.8%
*-lft-identity57.8%
unpow157.8%
sqr-pow57.8%
metadata-eval57.8%
unpow1/257.8%
metadata-eval57.8%
unpow1/257.8%
fabs-sqr57.8%
unpow1/257.8%
metadata-eval57.8%
unpow1/257.8%
metadata-eval57.8%
sqr-pow57.8%
unpow157.8%
fabs-mul57.8%
Simplified57.8%
Final simplification54.5%
(FPCore (x y)
:precision binary64
(if (<= y 1.38e+166)
1.0
(if (<= y 6.4e+271)
(* (* y y) -0.16666666666666666)
(* y (* y 0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if (y <= 1.38e+166) {
tmp = 1.0;
} else if (y <= 6.4e+271) {
tmp = (y * y) * -0.16666666666666666;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.38d+166) then
tmp = 1.0d0
else if (y <= 6.4d+271) then
tmp = (y * y) * (-0.16666666666666666d0)
else
tmp = y * (y * 0.16666666666666666d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.38e+166) {
tmp = 1.0;
} else if (y <= 6.4e+271) {
tmp = (y * y) * -0.16666666666666666;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.38e+166: tmp = 1.0 elif y <= 6.4e+271: tmp = (y * y) * -0.16666666666666666 else: tmp = y * (y * 0.16666666666666666) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.38e+166) tmp = 1.0; elseif (y <= 6.4e+271) tmp = Float64(Float64(y * y) * -0.16666666666666666); else tmp = Float64(y * Float64(y * 0.16666666666666666)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.38e+166) tmp = 1.0; elseif (y <= 6.4e+271) tmp = (y * y) * -0.16666666666666666; else tmp = y * (y * 0.16666666666666666); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.38e+166], 1.0, If[LessEqual[y, 6.4e+271], N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision], N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.38 \cdot 10^{+166}:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+271}:\\
\;\;\;\;\left(y \cdot y\right) \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot 0.16666666666666666\right)\\
\end{array}
\end{array}
if y < 1.38000000000000001e166Initial program 99.5%
Taylor expanded in x around 0 48.3%
Taylor expanded in y around 0 26.7%
if 1.38000000000000001e166 < y < 6.4000000000000003e271Initial program 100.0%
Taylor expanded in y around 0 32.2%
*-commutative32.2%
unpow232.2%
Simplified32.2%
Taylor expanded in x around 0 32.2%
+-commutative32.2%
*-commutative32.2%
unpow232.2%
associate-*r*32.2%
fma-udef32.2%
Simplified32.2%
Taylor expanded in y around inf 32.2%
*-commutative32.2%
unpow232.2%
associate-*l*32.2%
Simplified32.2%
Taylor expanded in y around 0 32.2%
unpow232.2%
Simplified32.2%
if 6.4000000000000003e271 < y Initial program 100.0%
Taylor expanded in y around 0 0.7%
*-commutative0.7%
unpow20.7%
Simplified0.7%
Taylor expanded in x around 0 0.7%
+-commutative0.7%
*-commutative0.7%
unpow20.7%
associate-*r*0.7%
fma-udef0.7%
Simplified0.7%
Taylor expanded in y around inf 0.7%
*-commutative0.7%
unpow20.7%
associate-*l*0.7%
Simplified0.7%
Taylor expanded in y around 0 0.7%
unpow20.7%
*-commutative0.7%
associate-*r*0.7%
unpow10.7%
sqr-pow57.8%
fabs-sqr57.8%
sqr-pow57.8%
unpow157.8%
*-lft-identity57.8%
associate-*r*57.8%
fabs-mul57.8%
*-lft-identity57.8%
unpow157.8%
sqr-pow57.8%
metadata-eval57.8%
unpow1/257.8%
metadata-eval57.8%
unpow1/257.8%
fabs-sqr57.8%
unpow1/257.8%
metadata-eval57.8%
unpow1/257.8%
metadata-eval57.8%
sqr-pow57.8%
unpow157.8%
fabs-mul57.8%
Simplified57.8%
Final simplification28.0%
(FPCore (x y)
:precision binary64
(if (<= y 1.38e+166)
(+ 1.0 (* 0.5 (* x x)))
(if (<= y 6.4e+271)
(* (* y y) -0.16666666666666666)
(* y (* y 0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if (y <= 1.38e+166) {
tmp = 1.0 + (0.5 * (x * x));
} else if (y <= 6.4e+271) {
tmp = (y * y) * -0.16666666666666666;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.38d+166) then
tmp = 1.0d0 + (0.5d0 * (x * x))
else if (y <= 6.4d+271) then
tmp = (y * y) * (-0.16666666666666666d0)
else
tmp = y * (y * 0.16666666666666666d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.38e+166) {
tmp = 1.0 + (0.5 * (x * x));
} else if (y <= 6.4e+271) {
tmp = (y * y) * -0.16666666666666666;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.38e+166: tmp = 1.0 + (0.5 * (x * x)) elif y <= 6.4e+271: tmp = (y * y) * -0.16666666666666666 else: tmp = y * (y * 0.16666666666666666) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.38e+166) tmp = Float64(1.0 + Float64(0.5 * Float64(x * x))); elseif (y <= 6.4e+271) tmp = Float64(Float64(y * y) * -0.16666666666666666); else tmp = Float64(y * Float64(y * 0.16666666666666666)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.38e+166) tmp = 1.0 + (0.5 * (x * x)); elseif (y <= 6.4e+271) tmp = (y * y) * -0.16666666666666666; else tmp = y * (y * 0.16666666666666666); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.38e+166], N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.4e+271], N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision], N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.38 \cdot 10^{+166}:\\
\;\;\;\;1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+271}:\\
\;\;\;\;\left(y \cdot y\right) \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot 0.16666666666666666\right)\\
\end{array}
\end{array}
if y < 1.38000000000000001e166Initial program 99.5%
add-log-exp79.8%
*-un-lft-identity79.8%
log-prod79.8%
metadata-eval79.8%
add-log-exp99.5%
Applied egg-rr99.5%
+-lft-identity99.5%
associate-*r/99.5%
associate-*l/99.4%
Simplified99.4%
Taylor expanded in x around 0 84.0%
unpow284.0%
Simplified84.0%
Taylor expanded in y around 0 50.2%
unpow250.2%
Simplified50.2%
if 1.38000000000000001e166 < y < 6.4000000000000003e271Initial program 100.0%
Taylor expanded in y around 0 32.2%
*-commutative32.2%
unpow232.2%
Simplified32.2%
Taylor expanded in x around 0 32.2%
+-commutative32.2%
*-commutative32.2%
unpow232.2%
associate-*r*32.2%
fma-udef32.2%
Simplified32.2%
Taylor expanded in y around inf 32.2%
*-commutative32.2%
unpow232.2%
associate-*l*32.2%
Simplified32.2%
Taylor expanded in y around 0 32.2%
unpow232.2%
Simplified32.2%
if 6.4000000000000003e271 < y Initial program 100.0%
Taylor expanded in y around 0 0.7%
*-commutative0.7%
unpow20.7%
Simplified0.7%
Taylor expanded in x around 0 0.7%
+-commutative0.7%
*-commutative0.7%
unpow20.7%
associate-*r*0.7%
fma-udef0.7%
Simplified0.7%
Taylor expanded in y around inf 0.7%
*-commutative0.7%
unpow20.7%
associate-*l*0.7%
Simplified0.7%
Taylor expanded in y around 0 0.7%
unpow20.7%
*-commutative0.7%
associate-*r*0.7%
unpow10.7%
sqr-pow57.8%
fabs-sqr57.8%
sqr-pow57.8%
unpow157.8%
*-lft-identity57.8%
associate-*r*57.8%
fabs-mul57.8%
*-lft-identity57.8%
unpow157.8%
sqr-pow57.8%
metadata-eval57.8%
unpow1/257.8%
metadata-eval57.8%
unpow1/257.8%
fabs-sqr57.8%
unpow1/257.8%
metadata-eval57.8%
unpow1/257.8%
metadata-eval57.8%
sqr-pow57.8%
unpow157.8%
fabs-mul57.8%
Simplified57.8%
Final simplification49.1%
(FPCore (x y) :precision binary64 (if (<= y 1.38e+166) 1.0 (* (* y y) -0.16666666666666666)))
double code(double x, double y) {
double tmp;
if (y <= 1.38e+166) {
tmp = 1.0;
} else {
tmp = (y * y) * -0.16666666666666666;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.38d+166) then
tmp = 1.0d0
else
tmp = (y * y) * (-0.16666666666666666d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.38e+166) {
tmp = 1.0;
} else {
tmp = (y * y) * -0.16666666666666666;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.38e+166: tmp = 1.0 else: tmp = (y * y) * -0.16666666666666666 return tmp
function code(x, y) tmp = 0.0 if (y <= 1.38e+166) tmp = 1.0; else tmp = Float64(Float64(y * y) * -0.16666666666666666); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.38e+166) tmp = 1.0; else tmp = (y * y) * -0.16666666666666666; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.38e+166], 1.0, N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.38 \cdot 10^{+166}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot -0.16666666666666666\\
\end{array}
\end{array}
if y < 1.38000000000000001e166Initial program 99.5%
Taylor expanded in x around 0 48.3%
Taylor expanded in y around 0 26.7%
if 1.38000000000000001e166 < y Initial program 100.0%
Taylor expanded in y around 0 23.7%
*-commutative23.7%
unpow223.7%
Simplified23.7%
Taylor expanded in x around 0 23.7%
+-commutative23.7%
*-commutative23.7%
unpow223.7%
associate-*r*23.7%
fma-udef23.7%
Simplified23.7%
Taylor expanded in y around inf 23.7%
*-commutative23.7%
unpow223.7%
associate-*l*23.7%
Simplified23.7%
Taylor expanded in y around 0 23.7%
unpow223.7%
Simplified23.7%
Final simplification26.4%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.6%
Taylor expanded in x around 0 47.4%
Taylor expanded in y around 0 24.2%
Final simplification24.2%
(FPCore (x y) :precision binary64 (/ (* (cosh x) (sin y)) y))
double code(double x, double y) {
return (cosh(x) * sin(y)) / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (cosh(x) * sin(y)) / y
end function
public static double code(double x, double y) {
return (Math.cosh(x) * Math.sin(y)) / y;
}
def code(x, y): return (math.cosh(x) * math.sin(y)) / y
function code(x, y) return Float64(Float64(cosh(x) * sin(y)) / y) end
function tmp = code(x, y) tmp = (cosh(x) * sin(y)) / y; end
code[x_, y_] := N[(N[(N[Cosh[x], $MachinePrecision] * N[Sin[y], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cosh x \cdot \sin y}{y}
\end{array}
herbie shell --seed 2023200
(FPCore (x y)
:name "Linear.Quaternion:$csinh from linear-1.19.1.3"
:precision binary64
:herbie-target
(/ (* (cosh x) (sin y)) y)
(* (cosh x) (/ (sin y) y)))