
(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 13 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) (cosh x)) y))
double code(double x, double y) {
return (sin(y) * cosh(x)) / y;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sin(y) * cosh(x)) / y
end function
public static double code(double x, double y) {
return (Math.sin(y) * Math.cosh(x)) / y;
}
def code(x, y): return (math.sin(y) * math.cosh(x)) / y
function code(x, y) return Float64(Float64(sin(y) * cosh(x)) / y) end
function tmp = code(x, y) tmp = (sin(y) * cosh(x)) / y; end
code[x_, y_] := N[(N[(N[Sin[y], $MachinePrecision] * N[Cosh[x], $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin y \cdot \cosh x}{y}
\end{array}
Initial program 99.9%
add-cbrt-cube64.6%
pow364.6%
Applied egg-rr64.6%
*-commutative64.6%
rem-cbrt-cube99.9%
associate-*l/99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= (cosh x) 2.0) (/ (sin y) y) (cosh x)))
double code(double x, double y) {
double tmp;
if (cosh(x) <= 2.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 (cosh(x) <= 2.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 (Math.cosh(x) <= 2.0) {
tmp = Math.sin(y) / y;
} else {
tmp = Math.cosh(x);
}
return tmp;
}
def code(x, y): tmp = 0 if math.cosh(x) <= 2.0: tmp = math.sin(y) / y else: tmp = math.cosh(x) return tmp
function code(x, y) tmp = 0.0 if (cosh(x) <= 2.0) tmp = Float64(sin(y) / y); else tmp = cosh(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (cosh(x) <= 2.0) tmp = sin(y) / y; else tmp = cosh(x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[N[Cosh[x], $MachinePrecision], 2.0], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[Cosh[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cosh x \leq 2:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\cosh x\\
\end{array}
\end{array}
if (cosh.f64 x) < 2Initial program 99.8%
Taylor expanded in x around 0 99.3%
if 2 < (cosh.f64 x) Initial program 100.0%
Taylor expanded in y around 0 75.8%
Final simplification87.9%
(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.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (or (<= x -4.2e+137)
(and (not (<= x -0.054)) (or (<= x 0.0132) (not (<= x 1.9e+154)))))
(/ (+ 1.0 (* x (* x 0.5))) (/ y (sin y)))
(cosh x)))
double code(double x, double y) {
double tmp;
if ((x <= -4.2e+137) || (!(x <= -0.054) && ((x <= 0.0132) || !(x <= 1.9e+154)))) {
tmp = (1.0 + (x * (x * 0.5))) / (y / sin(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 <= (-4.2d+137)) .or. (.not. (x <= (-0.054d0))) .and. (x <= 0.0132d0) .or. (.not. (x <= 1.9d+154))) then
tmp = (1.0d0 + (x * (x * 0.5d0))) / (y / sin(y))
else
tmp = cosh(x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -4.2e+137) || (!(x <= -0.054) && ((x <= 0.0132) || !(x <= 1.9e+154)))) {
tmp = (1.0 + (x * (x * 0.5))) / (y / Math.sin(y));
} else {
tmp = Math.cosh(x);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -4.2e+137) or (not (x <= -0.054) and ((x <= 0.0132) or not (x <= 1.9e+154))): tmp = (1.0 + (x * (x * 0.5))) / (y / math.sin(y)) else: tmp = math.cosh(x) return tmp
function code(x, y) tmp = 0.0 if ((x <= -4.2e+137) || (!(x <= -0.054) && ((x <= 0.0132) || !(x <= 1.9e+154)))) tmp = Float64(Float64(1.0 + Float64(x * Float64(x * 0.5))) / Float64(y / sin(y))); else tmp = cosh(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -4.2e+137) || (~((x <= -0.054)) && ((x <= 0.0132) || ~((x <= 1.9e+154))))) tmp = (1.0 + (x * (x * 0.5))) / (y / sin(y)); else tmp = cosh(x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -4.2e+137], And[N[Not[LessEqual[x, -0.054]], $MachinePrecision], Or[LessEqual[x, 0.0132], N[Not[LessEqual[x, 1.9e+154]], $MachinePrecision]]]], N[(N[(1.0 + N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cosh[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+137} \lor \neg \left(x \leq -0.054\right) \land \left(x \leq 0.0132 \lor \neg \left(x \leq 1.9 \cdot 10^{+154}\right)\right):\\
\;\;\;\;\frac{1 + x \cdot \left(x \cdot 0.5\right)}{\frac{y}{\sin y}}\\
\mathbf{else}:\\
\;\;\;\;\cosh x\\
\end{array}
\end{array}
if x < -4.1999999999999998e137 or -0.0539999999999999994 < x < 0.0132 or 1.8999999999999999e154 < x Initial program 99.9%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 98.8%
*-rgt-identity98.8%
associate-*r/98.6%
*-commutative98.6%
associate-/l*98.6%
unpow298.6%
associate-/r*92.2%
associate-/l*92.2%
associate-*r/92.2%
associate-*r*92.2%
distribute-lft-out92.2%
*-commutative92.2%
associate-/r/92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in y around inf 98.8%
associate-/l*98.7%
unpow298.7%
associate-*r*98.7%
*-commutative98.7%
associate-*l*98.7%
Simplified98.7%
if -4.1999999999999998e137 < x < -0.0539999999999999994 or 0.0132 < x < 1.8999999999999999e154Initial program 100.0%
Taylor expanded in y around 0 80.8%
Final simplification95.1%
(FPCore (x y) :precision binary64 (if (<= x -0.053) (* (cosh x) (+ 1.0 (* -0.16666666666666666 (* y y)))) (if (<= x 7e-5) (/ (sin y) y) (cosh x))))
double code(double x, double y) {
double tmp;
if (x <= -0.053) {
tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
} else if (x <= 7e-5) {
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 <= (-0.053d0)) then
tmp = cosh(x) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else if (x <= 7d-5) 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 <= -0.053) {
tmp = Math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
} else if (x <= 7e-5) {
tmp = Math.sin(y) / y;
} else {
tmp = Math.cosh(x);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.053: tmp = math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))) elif x <= 7e-5: tmp = math.sin(y) / y else: tmp = math.cosh(x) return tmp
function code(x, y) tmp = 0.0 if (x <= -0.053) tmp = Float64(cosh(x) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); elseif (x <= 7e-5) tmp = Float64(sin(y) / y); else tmp = cosh(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.053) tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))); elseif (x <= 7e-5) tmp = sin(y) / y; else tmp = cosh(x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.053], N[(N[Cosh[x], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7e-5], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[Cosh[x], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.053:\\
\;\;\;\;\cosh x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;x \leq 7 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\cosh x\\
\end{array}
\end{array}
if x < -0.0529999999999999985Initial program 100.0%
Taylor expanded in y around 0 74.0%
unpow230.0%
Simplified74.0%
if -0.0529999999999999985 < x < 6.9999999999999994e-5Initial program 99.8%
Taylor expanded in x around 0 99.3%
if 6.9999999999999994e-5 < x Initial program 100.0%
Taylor expanded in y around 0 83.8%
Final simplification89.9%
(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.9%
Taylor expanded in y around 0 66.3%
Final simplification66.3%
(FPCore (x y) :precision binary64 (if (or (<= y -8.5e+148) (not (<= y 9.2e+178))) (* -0.16666666666666666 (* y y)) (* y (/ (+ 1.0 (* x (* x 0.5))) y))))
double code(double x, double y) {
double tmp;
if ((y <= -8.5e+148) || !(y <= 9.2e+178)) {
tmp = -0.16666666666666666 * (y * y);
} else {
tmp = y * ((1.0 + (x * (x * 0.5))) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-8.5d+148)) .or. (.not. (y <= 9.2d+178))) then
tmp = (-0.16666666666666666d0) * (y * y)
else
tmp = y * ((1.0d0 + (x * (x * 0.5d0))) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -8.5e+148) || !(y <= 9.2e+178)) {
tmp = -0.16666666666666666 * (y * y);
} else {
tmp = y * ((1.0 + (x * (x * 0.5))) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -8.5e+148) or not (y <= 9.2e+178): tmp = -0.16666666666666666 * (y * y) else: tmp = y * ((1.0 + (x * (x * 0.5))) / y) return tmp
function code(x, y) tmp = 0.0 if ((y <= -8.5e+148) || !(y <= 9.2e+178)) tmp = Float64(-0.16666666666666666 * Float64(y * y)); else tmp = Float64(y * Float64(Float64(1.0 + Float64(x * Float64(x * 0.5))) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -8.5e+148) || ~((y <= 9.2e+178))) tmp = -0.16666666666666666 * (y * y); else tmp = y * ((1.0 + (x * (x * 0.5))) / y); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -8.5e+148], N[Not[LessEqual[y, 9.2e+178]], $MachinePrecision]], N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(1.0 + N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+148} \lor \neg \left(y \leq 9.2 \cdot 10^{+178}\right):\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{1 + x \cdot \left(x \cdot 0.5\right)}{y}\\
\end{array}
\end{array}
if y < -8.4999999999999996e148 or 9.2000000000000003e178 < y Initial program 99.8%
Taylor expanded in x around 0 45.2%
Taylor expanded in y around 0 32.3%
Taylor expanded in y around inf 30.7%
unpow230.7%
Simplified30.7%
if -8.4999999999999996e148 < y < 9.2000000000000003e178Initial program 99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 82.4%
*-rgt-identity82.4%
associate-*r/82.3%
*-commutative82.3%
associate-/l*88.8%
unpow288.8%
associate-/r*86.5%
associate-/l*84.6%
associate-*r/87.0%
associate-*r*87.0%
distribute-lft-out87.0%
*-commutative87.0%
associate-/r/87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in y around 0 68.8%
Taylor expanded in y around 0 68.8%
unpow268.8%
associate-*r*68.8%
*-commutative68.8%
associate-*l*68.8%
Simplified68.8%
Final simplification60.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.5 (* x x))))
(if (<= x -6.1e+172)
t_0
(if (<= x -1200.0)
(* -0.16666666666666666 (* y y))
(if (<= x 3.3e-9) 1.0 t_0)))))
double code(double x, double y) {
double t_0 = 0.5 * (x * x);
double tmp;
if (x <= -6.1e+172) {
tmp = t_0;
} else if (x <= -1200.0) {
tmp = -0.16666666666666666 * (y * y);
} else if (x <= 3.3e-9) {
tmp = 1.0;
} else {
tmp = 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) :: tmp
t_0 = 0.5d0 * (x * x)
if (x <= (-6.1d+172)) then
tmp = t_0
else if (x <= (-1200.0d0)) then
tmp = (-0.16666666666666666d0) * (y * y)
else if (x <= 3.3d-9) then
tmp = 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.5 * (x * x);
double tmp;
if (x <= -6.1e+172) {
tmp = t_0;
} else if (x <= -1200.0) {
tmp = -0.16666666666666666 * (y * y);
} else if (x <= 3.3e-9) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.5 * (x * x) tmp = 0 if x <= -6.1e+172: tmp = t_0 elif x <= -1200.0: tmp = -0.16666666666666666 * (y * y) elif x <= 3.3e-9: tmp = 1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.5 * Float64(x * x)) tmp = 0.0 if (x <= -6.1e+172) tmp = t_0; elseif (x <= -1200.0) tmp = Float64(-0.16666666666666666 * Float64(y * y)); elseif (x <= 3.3e-9) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.5 * (x * x); tmp = 0.0; if (x <= -6.1e+172) tmp = t_0; elseif (x <= -1200.0) tmp = -0.16666666666666666 * (y * y); elseif (x <= 3.3e-9) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.1e+172], t$95$0, If[LessEqual[x, -1200.0], N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e-9], 1.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -6.1 \cdot 10^{+172}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1200:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -6.0999999999999998e172 or 3.30000000000000018e-9 < x Initial program 100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 70.2%
*-rgt-identity70.2%
associate-*r/70.2%
*-commutative70.2%
associate-/l*80.2%
unpow280.2%
associate-/r*68.2%
associate-/l*64.6%
associate-*r/69.2%
associate-*r*69.2%
distribute-lft-out69.2%
*-commutative69.2%
associate-/r/69.2%
*-commutative69.2%
Simplified69.2%
Taylor expanded in y around 0 63.6%
Taylor expanded in x around inf 52.7%
unpow252.7%
Simplified52.7%
if -6.0999999999999998e172 < x < -1200Initial program 100.0%
Taylor expanded in x around 0 2.3%
Taylor expanded in y around 0 38.9%
Taylor expanded in y around inf 34.1%
unpow234.1%
Simplified34.1%
if -1200 < x < 3.30000000000000018e-9Initial program 99.8%
Taylor expanded in x around 0 98.0%
Taylor expanded in y around 0 57.0%
Final simplification53.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.5 (* x x))))
(if (<= x -6.1e+172)
t_0
(if (<= x -520.0)
(* y (* y -0.16666666666666666))
(if (<= x 3.3e-9) 1.0 t_0)))))
double code(double x, double y) {
double t_0 = 0.5 * (x * x);
double tmp;
if (x <= -6.1e+172) {
tmp = t_0;
} else if (x <= -520.0) {
tmp = y * (y * -0.16666666666666666);
} else if (x <= 3.3e-9) {
tmp = 1.0;
} else {
tmp = 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) :: tmp
t_0 = 0.5d0 * (x * x)
if (x <= (-6.1d+172)) then
tmp = t_0
else if (x <= (-520.0d0)) then
tmp = y * (y * (-0.16666666666666666d0))
else if (x <= 3.3d-9) then
tmp = 1.0d0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.5 * (x * x);
double tmp;
if (x <= -6.1e+172) {
tmp = t_0;
} else if (x <= -520.0) {
tmp = y * (y * -0.16666666666666666);
} else if (x <= 3.3e-9) {
tmp = 1.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.5 * (x * x) tmp = 0 if x <= -6.1e+172: tmp = t_0 elif x <= -520.0: tmp = y * (y * -0.16666666666666666) elif x <= 3.3e-9: tmp = 1.0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.5 * Float64(x * x)) tmp = 0.0 if (x <= -6.1e+172) tmp = t_0; elseif (x <= -520.0) tmp = Float64(y * Float64(y * -0.16666666666666666)); elseif (x <= 3.3e-9) tmp = 1.0; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.5 * (x * x); tmp = 0.0; if (x <= -6.1e+172) tmp = t_0; elseif (x <= -520.0) tmp = y * (y * -0.16666666666666666); elseif (x <= 3.3e-9) tmp = 1.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.1e+172], t$95$0, If[LessEqual[x, -520.0], N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.3e-9], 1.0, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -6.1 \cdot 10^{+172}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -520:\\
\;\;\;\;y \cdot \left(y \cdot -0.16666666666666666\right)\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -6.0999999999999998e172 or 3.30000000000000018e-9 < x Initial program 100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 70.2%
*-rgt-identity70.2%
associate-*r/70.2%
*-commutative70.2%
associate-/l*80.2%
unpow280.2%
associate-/r*68.2%
associate-/l*64.6%
associate-*r/69.2%
associate-*r*69.2%
distribute-lft-out69.2%
*-commutative69.2%
associate-/r/69.2%
*-commutative69.2%
Simplified69.2%
Taylor expanded in y around 0 63.6%
Taylor expanded in x around inf 52.7%
unpow252.7%
Simplified52.7%
if -6.0999999999999998e172 < x < -520Initial program 100.0%
Taylor expanded in x around 0 2.3%
Taylor expanded in y around 0 38.9%
Taylor expanded in y around inf 34.1%
unpow234.1%
*-commutative34.1%
associate-*l*34.1%
Simplified34.1%
if -520 < x < 3.30000000000000018e-9Initial program 99.8%
Taylor expanded in x around 0 98.0%
Taylor expanded in y around 0 57.0%
Final simplification53.4%
(FPCore (x y) :precision binary64 (if (or (<= x -6.1e+172) (not (<= x 2.8e+149))) (* 0.5 (* x x)) (+ 1.0 (* -0.16666666666666666 (* y y)))))
double code(double x, double y) {
double tmp;
if ((x <= -6.1e+172) || !(x <= 2.8e+149)) {
tmp = 0.5 * (x * x);
} else {
tmp = 1.0 + (-0.16666666666666666 * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-6.1d+172)) .or. (.not. (x <= 2.8d+149))) then
tmp = 0.5d0 * (x * x)
else
tmp = 1.0d0 + ((-0.16666666666666666d0) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -6.1e+172) || !(x <= 2.8e+149)) {
tmp = 0.5 * (x * x);
} else {
tmp = 1.0 + (-0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -6.1e+172) or not (x <= 2.8e+149): tmp = 0.5 * (x * x) else: tmp = 1.0 + (-0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -6.1e+172) || !(x <= 2.8e+149)) tmp = Float64(0.5 * Float64(x * x)); else tmp = Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -6.1e+172) || ~((x <= 2.8e+149))) tmp = 0.5 * (x * x); else tmp = 1.0 + (-0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -6.1e+172], N[Not[LessEqual[x, 2.8e+149]], $MachinePrecision]], N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.1 \cdot 10^{+172} \lor \neg \left(x \leq 2.8 \cdot 10^{+149}\right):\\
\;\;\;\;0.5 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if x < -6.0999999999999998e172 or 2.7999999999999999e149 < x Initial program 100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 97.4%
*-rgt-identity97.4%
associate-*r/97.4%
*-commutative97.4%
associate-/l*98.7%
unpow298.7%
associate-/r*81.5%
associate-/l*80.3%
associate-*r/81.5%
associate-*r*81.5%
distribute-lft-out81.5%
*-commutative81.5%
associate-/r/81.5%
*-commutative81.5%
Simplified81.5%
Taylor expanded in y around 0 74.8%
Taylor expanded in x around inf 73.6%
unpow273.6%
Simplified73.6%
if -6.0999999999999998e172 < x < 2.7999999999999999e149Initial program 99.9%
Taylor expanded in x around 0 71.7%
Taylor expanded in y around 0 47.1%
unpow247.1%
Simplified47.1%
Final simplification54.4%
(FPCore (x y) :precision binary64 (if (or (<= y -8.5e+148) (not (<= y 9.2e+178))) (* -0.16666666666666666 (* y y)) (+ 1.0 (* x (* x 0.5)))))
double code(double x, double y) {
double tmp;
if ((y <= -8.5e+148) || !(y <= 9.2e+178)) {
tmp = -0.16666666666666666 * (y * y);
} else {
tmp = 1.0 + (x * (x * 0.5));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-8.5d+148)) .or. (.not. (y <= 9.2d+178))) then
tmp = (-0.16666666666666666d0) * (y * y)
else
tmp = 1.0d0 + (x * (x * 0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -8.5e+148) || !(y <= 9.2e+178)) {
tmp = -0.16666666666666666 * (y * y);
} else {
tmp = 1.0 + (x * (x * 0.5));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -8.5e+148) or not (y <= 9.2e+178): tmp = -0.16666666666666666 * (y * y) else: tmp = 1.0 + (x * (x * 0.5)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -8.5e+148) || !(y <= 9.2e+178)) tmp = Float64(-0.16666666666666666 * Float64(y * y)); else tmp = Float64(1.0 + Float64(x * Float64(x * 0.5))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -8.5e+148) || ~((y <= 9.2e+178))) tmp = -0.16666666666666666 * (y * y); else tmp = 1.0 + (x * (x * 0.5)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -8.5e+148], N[Not[LessEqual[y, 9.2e+178]], $MachinePrecision]], N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(x * N[(x * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{+148} \lor \neg \left(y \leq 9.2 \cdot 10^{+178}\right):\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;1 + x \cdot \left(x \cdot 0.5\right)\\
\end{array}
\end{array}
if y < -8.4999999999999996e148 or 9.2000000000000003e178 < y Initial program 99.8%
Taylor expanded in x around 0 45.2%
Taylor expanded in y around 0 32.3%
Taylor expanded in y around inf 30.7%
unpow230.7%
Simplified30.7%
if -8.4999999999999996e148 < y < 9.2000000000000003e178Initial program 99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in x around 0 82.4%
*-rgt-identity82.4%
associate-*r/82.3%
*-commutative82.3%
associate-/l*88.8%
unpow288.8%
associate-/r*86.5%
associate-/l*84.6%
associate-*r/87.0%
associate-*r*87.0%
distribute-lft-out87.0%
*-commutative87.0%
associate-/r/87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in y around 0 61.8%
unpow261.8%
associate-*r*61.8%
*-commutative61.8%
associate-*l*61.8%
Simplified61.8%
Final simplification54.9%
(FPCore (x y) :precision binary64 (if (<= x -1200.0) (* -0.16666666666666666 (* y y)) 1.0))
double code(double x, double y) {
double tmp;
if (x <= -1200.0) {
tmp = -0.16666666666666666 * (y * y);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1200.0d0)) then
tmp = (-0.16666666666666666d0) * (y * y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1200.0) {
tmp = -0.16666666666666666 * (y * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1200.0: tmp = -0.16666666666666666 * (y * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -1200.0) tmp = Float64(-0.16666666666666666 * Float64(y * y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1200.0) tmp = -0.16666666666666666 * (y * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1200.0], N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1200:\\
\;\;\;\;-0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1200Initial program 100.0%
Taylor expanded in x around 0 2.5%
Taylor expanded in y around 0 32.7%
Taylor expanded in y around inf 30.2%
unpow230.2%
Simplified30.2%
if -1200 < x Initial program 99.9%
Taylor expanded in x around 0 64.1%
Taylor expanded in y around 0 37.5%
Final simplification36.1%
(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.9%
Taylor expanded in x around 0 52.6%
Taylor expanded in y around 0 30.8%
Final simplification30.8%
(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 2023185
(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)))