
(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 12 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.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (sin y) (/ (+ 1.0 (* 0.5 (* x x))) y))))
(if (<= x 1.9)
t_0
(if (<= x 1e+71)
(cosh x)
(if (<= x 1.32e+150)
(* (cosh x) (+ 1.0 (* -0.16666666666666666 (* y y))))
t_0)))))
double code(double x, double y) {
double t_0 = sin(y) * ((1.0 + (0.5 * (x * x))) / y);
double tmp;
if (x <= 1.9) {
tmp = t_0;
} else if (x <= 1e+71) {
tmp = cosh(x);
} else if (x <= 1.32e+150) {
tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
} 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 = sin(y) * ((1.0d0 + (0.5d0 * (x * x))) / y)
if (x <= 1.9d0) then
tmp = t_0
else if (x <= 1d+71) then
tmp = cosh(x)
else if (x <= 1.32d+150) then
tmp = cosh(x) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sin(y) * ((1.0 + (0.5 * (x * x))) / y);
double tmp;
if (x <= 1.9) {
tmp = t_0;
} else if (x <= 1e+71) {
tmp = Math.cosh(x);
} else if (x <= 1.32e+150) {
tmp = Math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sin(y) * ((1.0 + (0.5 * (x * x))) / y) tmp = 0 if x <= 1.9: tmp = t_0 elif x <= 1e+71: tmp = math.cosh(x) elif x <= 1.32e+150: tmp = math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(sin(y) * Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / y)) tmp = 0.0 if (x <= 1.9) tmp = t_0; elseif (x <= 1e+71) tmp = cosh(x); elseif (x <= 1.32e+150) tmp = Float64(cosh(x) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = sin(y) * ((1.0 + (0.5 * (x * x))) / y); tmp = 0.0; if (x <= 1.9) tmp = t_0; elseif (x <= 1e+71) tmp = cosh(x); elseif (x <= 1.32e+150) tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sin[y], $MachinePrecision] * N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.9], t$95$0, If[LessEqual[x, 1e+71], N[Cosh[x], $MachinePrecision], If[LessEqual[x, 1.32e+150], N[(N[Cosh[x], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin y \cdot \frac{1 + 0.5 \cdot \left(x \cdot x\right)}{y}\\
\mathbf{if}\;x \leq 1.9:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 10^{+71}:\\
\;\;\;\;\cosh x\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+150}:\\
\;\;\;\;\cosh x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < 1.8999999999999999 or 1.32e150 < x Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 85.6%
unpow250.9%
Simplified85.6%
if 1.8999999999999999 < x < 1e71Initial program 100.0%
Taylor expanded in y around 0 100.0%
if 1e71 < x < 1.32e150Initial program 100.0%
Taylor expanded in y around 0 70.6%
unpow28.0%
Simplified70.6%
Final simplification85.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.5 (* x x)))))
(if (<= x 1.9)
(/ (sin y) (/ y t_0))
(if (<= x 4e+68)
(cosh x)
(if (<= x 1.32e+150)
(* (cosh x) (+ 1.0 (* -0.16666666666666666 (* y y))))
(* (sin y) (/ t_0 y)))))))
double code(double x, double y) {
double t_0 = 1.0 + (0.5 * (x * x));
double tmp;
if (x <= 1.9) {
tmp = sin(y) / (y / t_0);
} else if (x <= 4e+68) {
tmp = cosh(x);
} else if (x <= 1.32e+150) {
tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = sin(y) * (t_0 / y);
}
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 = 1.0d0 + (0.5d0 * (x * x))
if (x <= 1.9d0) then
tmp = sin(y) / (y / t_0)
else if (x <= 4d+68) then
tmp = cosh(x)
else if (x <= 1.32d+150) then
tmp = cosh(x) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
else
tmp = sin(y) * (t_0 / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (0.5 * (x * x));
double tmp;
if (x <= 1.9) {
tmp = Math.sin(y) / (y / t_0);
} else if (x <= 4e+68) {
tmp = Math.cosh(x);
} else if (x <= 1.32e+150) {
tmp = Math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
} else {
tmp = Math.sin(y) * (t_0 / y);
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.5 * (x * x)) tmp = 0 if x <= 1.9: tmp = math.sin(y) / (y / t_0) elif x <= 4e+68: tmp = math.cosh(x) elif x <= 1.32e+150: tmp = math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))) else: tmp = math.sin(y) * (t_0 / y) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.5 * Float64(x * x))) tmp = 0.0 if (x <= 1.9) tmp = Float64(sin(y) / Float64(y / t_0)); elseif (x <= 4e+68) tmp = cosh(x); elseif (x <= 1.32e+150) tmp = Float64(cosh(x) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); else tmp = Float64(sin(y) * Float64(t_0 / y)); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.5 * (x * x)); tmp = 0.0; if (x <= 1.9) tmp = sin(y) / (y / t_0); elseif (x <= 4e+68) tmp = cosh(x); elseif (x <= 1.32e+150) tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))); else tmp = sin(y) * (t_0 / y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.9], N[(N[Sin[y], $MachinePrecision] / N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4e+68], N[Cosh[x], $MachinePrecision], If[LessEqual[x, 1.32e+150], N[(N[Cosh[x], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[y], $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq 1.9:\\
\;\;\;\;\frac{\sin y}{\frac{y}{t_0}}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+68}:\\
\;\;\;\;\cosh x\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+150}:\\
\;\;\;\;\cosh x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin y \cdot \frac{t_0}{y}\\
\end{array}
\end{array}
if x < 1.8999999999999999Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 82.8%
unpow247.6%
Simplified82.8%
if 1.8999999999999999 < x < 3.99999999999999981e68Initial program 100.0%
Taylor expanded in y around 0 100.0%
if 3.99999999999999981e68 < x < 1.32e150Initial program 100.0%
Taylor expanded in y around 0 70.6%
unpow28.0%
Simplified70.6%
if 1.32e150 < x Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
clear-num100.0%
associate-/r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 97.5%
unpow267.0%
Simplified97.5%
Final simplification84.9%
(FPCore (x y)
:precision binary64
(if (<= x 0.00046)
(/ (sin y) y)
(if (<= x 1e+69)
(cosh x)
(* (cosh x) (+ 1.0 (* -0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (x <= 0.00046) {
tmp = sin(y) / y;
} else if (x <= 1e+69) {
tmp = cosh(x);
} else {
tmp = cosh(x) * (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 <= 0.00046d0) then
tmp = sin(y) / y
else if (x <= 1d+69) then
tmp = cosh(x)
else
tmp = cosh(x) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.00046) {
tmp = Math.sin(y) / y;
} else if (x <= 1e+69) {
tmp = Math.cosh(x);
} else {
tmp = Math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.00046: tmp = math.sin(y) / y elif x <= 1e+69: tmp = math.cosh(x) else: tmp = math.cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.00046) tmp = Float64(sin(y) / y); elseif (x <= 1e+69) tmp = cosh(x); else tmp = Float64(cosh(x) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.00046) tmp = sin(y) / y; elseif (x <= 1e+69) tmp = cosh(x); else tmp = cosh(x) * (1.0 + (-0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.00046], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 1e+69], N[Cosh[x], $MachinePrecision], N[(N[Cosh[x], $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00046:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 10^{+69}:\\
\;\;\;\;\cosh x\\
\mathbf{else}:\\
\;\;\;\;\cosh x \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if x < 4.6000000000000001e-4Initial program 99.9%
Taylor expanded in x around 0 67.6%
if 4.6000000000000001e-4 < x < 1.0000000000000001e69Initial program 99.9%
Taylor expanded in y around 0 92.0%
if 1.0000000000000001e69 < x Initial program 100.0%
Taylor expanded in y around 0 78.6%
unpow214.8%
Simplified78.6%
Final simplification71.2%
(FPCore (x y)
:precision binary64
(if (<= x 0.00031)
(/ (sin y) y)
(if (<= x 4e+153)
(cosh x)
(* (+ 1.0 (* 0.5 (* x x))) (+ 1.0 (* -0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (x <= 0.00031) {
tmp = sin(y) / y;
} else if (x <= 4e+153) {
tmp = cosh(x);
} else {
tmp = (1.0 + (0.5 * (x * x))) * (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 <= 0.00031d0) then
tmp = sin(y) / y
else if (x <= 4d+153) then
tmp = cosh(x)
else
tmp = (1.0d0 + (0.5d0 * (x * x))) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.00031) {
tmp = Math.sin(y) / y;
} else if (x <= 4e+153) {
tmp = Math.cosh(x);
} else {
tmp = (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.00031: tmp = math.sin(y) / y elif x <= 4e+153: tmp = math.cosh(x) else: tmp = (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.00031) tmp = Float64(sin(y) / y); elseif (x <= 4e+153) tmp = cosh(x); else tmp = Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.00031) tmp = sin(y) / y; elseif (x <= 4e+153) tmp = cosh(x); else tmp = (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.00031], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 4e+153], N[Cosh[x], $MachinePrecision], N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00031:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+153}:\\
\;\;\;\;\cosh x\\
\mathbf{else}:\\
\;\;\;\;\left(1 + 0.5 \cdot \left(x \cdot x\right)\right) \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if x < 3.1e-4Initial program 99.9%
Taylor expanded in x around 0 67.6%
if 3.1e-4 < x < 4e153Initial program 99.9%
Taylor expanded in y around 0 90.1%
if 4e153 < x Initial program 100.0%
Taylor expanded in y around 0 84.2%
unpow218.3%
Simplified84.2%
Taylor expanded in x around 0 84.2%
unpow268.4%
Simplified84.2%
Final simplification72.7%
(FPCore (x y) :precision binary64 (if (<= x 6.2e+153) (cosh x) (* (+ 1.0 (* 0.5 (* x x))) (+ 1.0 (* -0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (x <= 6.2e+153) {
tmp = cosh(x);
} else {
tmp = (1.0 + (0.5 * (x * x))) * (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.2d+153) then
tmp = cosh(x)
else
tmp = (1.0d0 + (0.5d0 * (x * x))) * (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.2e+153) {
tmp = Math.cosh(x);
} else {
tmp = (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 6.2e+153: tmp = math.cosh(x) else: tmp = (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (x <= 6.2e+153) tmp = cosh(x); else tmp = Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) * 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.2e+153) tmp = cosh(x); else tmp = (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 6.2e+153], N[Cosh[x], $MachinePrecision], N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6.2 \cdot 10^{+153}:\\
\;\;\;\;\cosh x\\
\mathbf{else}:\\
\;\;\;\;\left(1 + 0.5 \cdot \left(x \cdot x\right)\right) \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if x < 6.2e153Initial program 99.9%
Taylor expanded in y around 0 62.9%
if 6.2e153 < x Initial program 100.0%
Taylor expanded in y around 0 84.2%
unpow218.3%
Simplified84.2%
Taylor expanded in x around 0 84.2%
unpow268.4%
Simplified84.2%
Final simplification66.1%
(FPCore (x y) :precision binary64 (* (+ 1.0 (* 0.5 (* x x))) (+ 1.0 (* -0.16666666666666666 (* y y)))))
double code(double x, double y) {
return (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 + (0.5d0 * (x * x))) * (1.0d0 + ((-0.16666666666666666d0) * (y * y)))
end function
public static double code(double x, double y) {
return (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y)));
}
def code(x, y): return (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y)))
function code(x, y) return Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) * Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y)))) end
function tmp = code(x, y) tmp = (1.0 + (0.5 * (x * x))) * (1.0 + (-0.16666666666666666 * (y * y))); end
code[x_, y_] := N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + 0.5 \cdot \left(x \cdot x\right)\right) \cdot \left(1 + -0.16666666666666666 \cdot \left(y \cdot y\right)\right)
\end{array}
Initial program 99.9%
Taylor expanded in y around 0 65.4%
unpow235.6%
Simplified65.4%
Taylor expanded in x around 0 53.6%
unpow246.0%
Simplified53.6%
Final simplification53.6%
(FPCore (x y) :precision binary64 (* (+ 1.0 (* 0.5 (* x x))) (+ 1.0 (* y (* y -0.16666666666666666)))))
double code(double x, double y) {
return (1.0 + (0.5 * (x * x))) * (1.0 + (y * (y * -0.16666666666666666)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (1.0d0 + (0.5d0 * (x * x))) * (1.0d0 + (y * (y * (-0.16666666666666666d0))))
end function
public static double code(double x, double y) {
return (1.0 + (0.5 * (x * x))) * (1.0 + (y * (y * -0.16666666666666666)));
}
def code(x, y): return (1.0 + (0.5 * (x * x))) * (1.0 + (y * (y * -0.16666666666666666)))
function code(x, y) return Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) * Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666)))) end
function tmp = code(x, y) tmp = (1.0 + (0.5 * (x * x))) * (1.0 + (y * (y * -0.16666666666666666))); end
code[x_, y_] := N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(1 + 0.5 \cdot \left(x \cdot x\right)\right) \cdot \left(1 + y \cdot \left(y \cdot -0.16666666666666666\right)\right)
\end{array}
Initial program 99.9%
add-sqr-sqrt74.1%
pow274.1%
Applied egg-rr74.1%
Taylor expanded in x around 0 55.9%
unpow246.0%
Simplified55.9%
Taylor expanded in y around 0 53.6%
*-commutative53.6%
unpow253.6%
associate-*r*53.6%
Simplified53.6%
Final simplification53.6%
(FPCore (x y) :precision binary64 (if (<= x 1.8e+155) (+ 1.0 (* y (* y -0.16666666666666666))) (+ 1.0 (* 0.5 (* x x)))))
double code(double x, double y) {
double tmp;
if (x <= 1.8e+155) {
tmp = 1.0 + (y * (y * -0.16666666666666666));
} else {
tmp = 1.0 + (0.5 * (x * 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.8d+155) then
tmp = 1.0d0 + (y * (y * (-0.16666666666666666d0)))
else
tmp = 1.0d0 + (0.5d0 * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1.8e+155) {
tmp = 1.0 + (y * (y * -0.16666666666666666));
} else {
tmp = 1.0 + (0.5 * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1.8e+155: tmp = 1.0 + (y * (y * -0.16666666666666666)) else: tmp = 1.0 + (0.5 * (x * x)) return tmp
function code(x, y) tmp = 0.0 if (x <= 1.8e+155) tmp = Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666))); else tmp = Float64(1.0 + Float64(0.5 * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1.8e+155) tmp = 1.0 + (y * (y * -0.16666666666666666)); else tmp = 1.0 + (0.5 * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1.8e+155], N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.8 \cdot 10^{+155}:\\
\;\;\;\;1 + y \cdot \left(y \cdot -0.16666666666666666\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 1.80000000000000004e155Initial program 99.9%
Taylor expanded in x around 0 58.7%
Taylor expanded in y around 0 38.9%
unpow238.9%
Simplified38.9%
Taylor expanded in y around 0 38.9%
*-commutative38.9%
unpow238.9%
associate-*r*38.9%
Simplified38.9%
if 1.80000000000000004e155 < x Initial program 100.0%
Taylor expanded in y around 0 70.3%
Taylor expanded in x around 0 70.3%
unpow270.3%
Simplified70.3%
Final simplification43.4%
(FPCore (x y) :precision binary64 (+ 1.0 (* -0.16666666666666666 (* y y))))
double code(double x, double y) {
return 1.0 + (-0.16666666666666666 * (y * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + ((-0.16666666666666666d0) * (y * y))
end function
public static double code(double x, double y) {
return 1.0 + (-0.16666666666666666 * (y * y));
}
def code(x, y): return 1.0 + (-0.16666666666666666 * (y * y))
function code(x, y) return Float64(1.0 + Float64(-0.16666666666666666 * Float64(y * y))) end
function tmp = code(x, y) tmp = 1.0 + (-0.16666666666666666 * (y * y)); end
code[x_, y_] := N[(1.0 + N[(-0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + -0.16666666666666666 \cdot \left(y \cdot y\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 50.6%
Taylor expanded in y around 0 35.6%
unpow235.6%
Simplified35.6%
Final simplification35.6%
(FPCore (x y) :precision binary64 (+ 1.0 (* y (* y -0.16666666666666666))))
double code(double x, double y) {
return 1.0 + (y * (y * -0.16666666666666666));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + (y * (y * (-0.16666666666666666d0)))
end function
public static double code(double x, double y) {
return 1.0 + (y * (y * -0.16666666666666666));
}
def code(x, y): return 1.0 + (y * (y * -0.16666666666666666))
function code(x, y) return Float64(1.0 + Float64(y * Float64(y * -0.16666666666666666))) end
function tmp = code(x, y) tmp = 1.0 + (y * (y * -0.16666666666666666)); end
code[x_, y_] := N[(1.0 + N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + y \cdot \left(y \cdot -0.16666666666666666\right)
\end{array}
Initial program 99.9%
Taylor expanded in x around 0 50.6%
Taylor expanded in y around 0 35.6%
unpow235.6%
Simplified35.6%
Taylor expanded in y around 0 35.6%
*-commutative35.6%
unpow235.6%
associate-*r*35.6%
Simplified35.6%
Final simplification35.6%
(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 50.6%
Taylor expanded in y around 0 29.3%
Final simplification29.3%
(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 2023275
(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)))