
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (sinh y) y))) (if (<= t_0 2.0) (cos x) t_0)))
double code(double x, double y) {
double t_0 = sinh(y) / y;
double tmp;
if (t_0 <= 2.0) {
tmp = cos(x);
} 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 = sinh(y) / y
if (t_0 <= 2.0d0) then
tmp = cos(x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.sinh(y) / y;
double tmp;
if (t_0 <= 2.0) {
tmp = Math.cos(x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sinh(y) / y tmp = 0 if t_0 <= 2.0: tmp = math.cos(x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(sinh(y) / y) tmp = 0.0 if (t_0 <= 2.0) tmp = cos(x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = sinh(y) / y; tmp = 0.0; if (t_0 <= 2.0) tmp = cos(x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[t$95$0, 2.0], N[Cos[x], $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
\mathbf{if}\;t_0 \leq 2:\\
\;\;\;\;\cos x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 (sinh.f64 y) y) < 2Initial program 100.0%
Taylor expanded in y around 0 99.1%
if 2 < (/.f64 (sinh.f64 y) y) Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 73.0%
Final simplification86.3%
(FPCore (x y)
:precision binary64
(if (<= y 0.082)
(cos x)
(if (<= y 1e+154)
(/ (sinh y) y)
(* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 0.082) {
tmp = cos(x);
} else if (y <= 1e+154) {
tmp = sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.082d0) then
tmp = cos(x)
else if (y <= 1d+154) then
tmp = sinh(y) / y
else
tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.082) {
tmp = Math.cos(x);
} else if (y <= 1e+154) {
tmp = Math.sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.082: tmp = math.cos(x) elif y <= 1e+154: tmp = math.sinh(y) / y else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.082) tmp = cos(x); elseif (y <= 1e+154) tmp = Float64(sinh(y) / y); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.082) tmp = cos(x); elseif (y <= 1e+154) tmp = sinh(y) / y; else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.082], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1e+154], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.082:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 10^{+154}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.0820000000000000034Initial program 100.0%
Taylor expanded in y around 0 65.8%
if 0.0820000000000000034 < y < 1.00000000000000004e154Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 70.0%
if 1.00000000000000004e154 < y Initial program 100.0%
Taylor expanded in y around 0 96.9%
unpow296.9%
Simplified96.9%
Taylor expanded in y around inf 96.9%
unpow296.9%
*-commutative96.9%
Simplified96.9%
Final simplification69.6%
(FPCore (x y)
:precision binary64
(if (<= y 0.082)
(* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 1e+154)
(/ (sinh y) y)
(* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 0.082) {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1e+154) {
tmp = sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.082d0) then
tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 1d+154) then
tmp = sinh(y) / y
else
tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.082) {
tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1e+154) {
tmp = Math.sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.082: tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 1e+154: tmp = math.sinh(y) / y else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.082) tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 1e+154) tmp = Float64(sinh(y) / y); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.082) tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 1e+154) tmp = sinh(y) / y; else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.082], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+154], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.082:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 10^{+154}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.0820000000000000034Initial program 100.0%
Taylor expanded in y around 0 82.7%
unpow282.7%
Simplified82.7%
if 0.0820000000000000034 < y < 1.00000000000000004e154Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 70.0%
if 1.00000000000000004e154 < y Initial program 100.0%
Taylor expanded in y around 0 96.9%
unpow296.9%
Simplified96.9%
Taylor expanded in y around inf 96.9%
unpow296.9%
*-commutative96.9%
Simplified96.9%
Final simplification82.7%
(FPCore (x y)
:precision binary64
(if (<= y 5.2e+22)
(cos x)
(if (or (<= y 2.2e+204) (not (<= y 7e+249)))
(* y (* y (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))
(+ 1.0 (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 5.2e+22) {
tmp = cos(x);
} else if ((y <= 2.2e+204) || !(y <= 7e+249)) {
tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (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 (y <= 5.2d+22) then
tmp = cos(x)
else if ((y <= 2.2d+204) .or. (.not. (y <= 7d+249))) then
tmp = y * (y * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (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 (y <= 5.2e+22) {
tmp = Math.cos(x);
} else if ((y <= 2.2e+204) || !(y <= 7e+249)) {
tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x))));
} else {
tmp = 1.0 + (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 5.2e+22: tmp = math.cos(x) elif (y <= 2.2e+204) or not (y <= 7e+249): tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))) else: tmp = 1.0 + (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 5.2e+22) tmp = cos(x); elseif ((y <= 2.2e+204) || !(y <= 7e+249)) tmp = Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * 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 (y <= 5.2e+22) tmp = cos(x); elseif ((y <= 2.2e+204) || ~((y <= 7e+249))) tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))); else tmp = 1.0 + (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 5.2e+22], N[Cos[x], $MachinePrecision], If[Or[LessEqual[y, 2.2e+204], N[Not[LessEqual[y, 7e+249]], $MachinePrecision]], N[(y * N[(y * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.2 \cdot 10^{+22}:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 2.2 \cdot 10^{+204} \lor \neg \left(y \leq 7 \cdot 10^{+249}\right):\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 5.2e22Initial program 100.0%
Taylor expanded in y around 0 64.9%
if 5.2e22 < y < 2.20000000000000011e204 or 7.00000000000000024e249 < y Initial program 100.0%
Taylor expanded in y around 0 39.0%
unpow239.0%
Simplified39.0%
Taylor expanded in y around inf 39.0%
unpow239.0%
associate-*l*39.0%
associate-*r*37.0%
*-commutative37.0%
associate-*l*37.0%
Simplified37.0%
Taylor expanded in x around 0 48.4%
unpow248.4%
associate-*r*48.4%
distribute-rgt-out48.4%
Simplified48.4%
if 2.20000000000000011e204 < y < 7.00000000000000024e249Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 72.7%
+-commutative72.7%
unpow272.7%
Simplified72.7%
Final simplification62.5%
(FPCore (x y) :precision binary64 (if (or (<= y 6.2e+22) (and (not (<= y 2e+203)) (<= y 5e+248))) (+ 1.0 (* 0.16666666666666666 (* y y))) (* y (* y (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))))
double code(double x, double y) {
double tmp;
if ((y <= 6.2e+22) || (!(y <= 2e+203) && (y <= 5e+248))) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x))));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= 6.2d+22) .or. (.not. (y <= 2d+203)) .and. (y <= 5d+248)) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = y * (y * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 6.2e+22) || (!(y <= 2e+203) && (y <= 5e+248))) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x))));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 6.2e+22) or (not (y <= 2e+203) and (y <= 5e+248)): tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))) return tmp
function code(x, y) tmp = 0.0 if ((y <= 6.2e+22) || (!(y <= 2e+203) && (y <= 5e+248))) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 6.2e+22) || (~((y <= 2e+203)) && (y <= 5e+248))) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 6.2e+22], And[N[Not[LessEqual[y, 2e+203]], $MachinePrecision], LessEqual[y, 5e+248]]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(y * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 6.2 \cdot 10^{+22} \lor \neg \left(y \leq 2 \cdot 10^{+203}\right) \land y \leq 5 \cdot 10^{+248}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if y < 6.2000000000000004e22 or 2e203 < y < 4.9999999999999996e248Initial program 100.0%
Taylor expanded in y around 0 82.4%
unpow282.4%
Simplified82.4%
Taylor expanded in x around 0 51.3%
+-commutative51.3%
unpow251.3%
Simplified51.3%
if 6.2000000000000004e22 < y < 2e203 or 4.9999999999999996e248 < y Initial program 100.0%
Taylor expanded in y around 0 39.0%
unpow239.0%
Simplified39.0%
Taylor expanded in y around inf 39.0%
unpow239.0%
associate-*l*39.0%
associate-*r*37.0%
*-commutative37.0%
associate-*l*37.0%
Simplified37.0%
Taylor expanded in x around 0 48.4%
unpow248.4%
associate-*r*48.4%
distribute-rgt-out48.4%
Simplified48.4%
Final simplification50.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y)))))
(if (<= x 1.6)
t_0
(if (<= x 8.5e+133)
(* -0.08333333333333333 (* (* y y) (* x x)))
(if (<= x 2e+156) t_0 (+ 1.0 (* (* x x) -0.5)))))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 1.6) {
tmp = t_0;
} else if (x <= 8.5e+133) {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
} else if (x <= 2e+156) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (0.16666666666666666d0 * (y * y))
if (x <= 1.6d0) then
tmp = t_0
else if (x <= 8.5d+133) then
tmp = (-0.08333333333333333d0) * ((y * y) * (x * x))
else if (x <= 2d+156) then
tmp = t_0
else
tmp = 1.0d0 + ((x * x) * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 1.6) {
tmp = t_0;
} else if (x <= 8.5e+133) {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
} else if (x <= 2e+156) {
tmp = t_0;
} else {
tmp = 1.0 + ((x * x) * -0.5);
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if x <= 1.6: tmp = t_0 elif x <= 8.5e+133: tmp = -0.08333333333333333 * ((y * y) * (x * x)) elif x <= 2e+156: tmp = t_0 else: tmp = 1.0 + ((x * x) * -0.5) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (x <= 1.6) tmp = t_0; elseif (x <= 8.5e+133) tmp = Float64(-0.08333333333333333 * Float64(Float64(y * y) * Float64(x * x))); elseif (x <= 2e+156) tmp = t_0; else tmp = Float64(1.0 + Float64(Float64(x * x) * -0.5)); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (x <= 1.6) tmp = t_0; elseif (x <= 8.5e+133) tmp = -0.08333333333333333 * ((y * y) * (x * x)); elseif (x <= 2e+156) tmp = t_0; else tmp = 1.0 + ((x * x) * -0.5); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.6], t$95$0, If[LessEqual[x, 8.5e+133], N[(-0.08333333333333333 * N[(N[(y * y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+156], t$95$0, N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;x \leq 1.6:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+133}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+156}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot -0.5\\
\end{array}
\end{array}
if x < 1.6000000000000001 or 8.50000000000000044e133 < x < 2e156Initial program 100.0%
Taylor expanded in y around 0 74.7%
unpow274.7%
Simplified74.7%
Taylor expanded in x around 0 54.9%
+-commutative54.9%
unpow254.9%
Simplified54.9%
if 1.6000000000000001 < x < 8.50000000000000044e133Initial program 100.0%
Taylor expanded in y around 0 79.4%
unpow279.4%
Simplified79.4%
Taylor expanded in y around inf 21.3%
unpow221.3%
associate-*l*21.3%
associate-*r*21.3%
*-commutative21.3%
associate-*l*21.3%
Simplified21.3%
Taylor expanded in x around 0 19.5%
unpow219.5%
associate-*r*19.5%
distribute-rgt-out19.5%
Simplified19.5%
Taylor expanded in x around inf 19.5%
unpow219.5%
unpow219.5%
Simplified19.5%
if 2e156 < x Initial program 100.0%
Taylor expanded in y around 0 75.0%
unpow275.0%
Simplified75.0%
Taylor expanded in x around 0 9.3%
associate-+r+9.3%
+-commutative9.3%
associate-+r+9.3%
+-commutative9.3%
*-lft-identity9.3%
associate-*r*9.3%
distribute-rgt-out17.6%
+-commutative17.6%
unpow217.6%
fma-def17.6%
unpow217.6%
Simplified17.6%
Taylor expanded in y around 0 17.6%
Final simplification46.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y)))))
(if (<= x 1.6)
t_0
(if (<= x 8.5e+133)
(* y (* y (* -0.08333333333333333 (* x x))))
(if (<= x 2e+156) t_0 (+ 1.0 (* (* x x) -0.5)))))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 1.6) {
tmp = t_0;
} else if (x <= 8.5e+133) {
tmp = y * (y * (-0.08333333333333333 * (x * x)));
} else if (x <= 2e+156) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + (0.16666666666666666d0 * (y * y))
if (x <= 1.6d0) then
tmp = t_0
else if (x <= 8.5d+133) then
tmp = y * (y * ((-0.08333333333333333d0) * (x * x)))
else if (x <= 2d+156) then
tmp = t_0
else
tmp = 1.0d0 + ((x * x) * (-0.5d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 1.6) {
tmp = t_0;
} else if (x <= 8.5e+133) {
tmp = y * (y * (-0.08333333333333333 * (x * x)));
} else if (x <= 2e+156) {
tmp = t_0;
} else {
tmp = 1.0 + ((x * x) * -0.5);
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if x <= 1.6: tmp = t_0 elif x <= 8.5e+133: tmp = y * (y * (-0.08333333333333333 * (x * x))) elif x <= 2e+156: tmp = t_0 else: tmp = 1.0 + ((x * x) * -0.5) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (x <= 1.6) tmp = t_0; elseif (x <= 8.5e+133) tmp = Float64(y * Float64(y * Float64(-0.08333333333333333 * Float64(x * x)))); elseif (x <= 2e+156) tmp = t_0; else tmp = Float64(1.0 + Float64(Float64(x * x) * -0.5)); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (x <= 1.6) tmp = t_0; elseif (x <= 8.5e+133) tmp = y * (y * (-0.08333333333333333 * (x * x))); elseif (x <= 2e+156) tmp = t_0; else tmp = 1.0 + ((x * x) * -0.5); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 1.6], t$95$0, If[LessEqual[x, 8.5e+133], N[(y * N[(y * N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e+156], t$95$0, N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;x \leq 1.6:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{+133}:\\
\;\;\;\;y \cdot \left(y \cdot \left(-0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+156}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 + \left(x \cdot x\right) \cdot -0.5\\
\end{array}
\end{array}
if x < 1.6000000000000001 or 8.50000000000000044e133 < x < 2e156Initial program 100.0%
Taylor expanded in y around 0 74.7%
unpow274.7%
Simplified74.7%
Taylor expanded in x around 0 54.9%
+-commutative54.9%
unpow254.9%
Simplified54.9%
if 1.6000000000000001 < x < 8.50000000000000044e133Initial program 100.0%
Taylor expanded in y around 0 79.4%
unpow279.4%
Simplified79.4%
Taylor expanded in y around inf 21.3%
unpow221.3%
associate-*l*21.3%
associate-*r*21.3%
*-commutative21.3%
associate-*l*21.3%
Simplified21.3%
Taylor expanded in x around 0 19.5%
unpow219.5%
associate-*r*19.5%
distribute-rgt-out19.5%
Simplified19.5%
Taylor expanded in x around inf 19.5%
unpow219.5%
associate-*r*19.5%
*-commutative19.5%
Simplified19.5%
if 2e156 < x Initial program 100.0%
Taylor expanded in y around 0 75.0%
unpow275.0%
Simplified75.0%
Taylor expanded in x around 0 9.3%
associate-+r+9.3%
+-commutative9.3%
associate-+r+9.3%
+-commutative9.3%
*-lft-identity9.3%
associate-*r*9.3%
distribute-rgt-out17.6%
+-commutative17.6%
unpow217.6%
fma-def17.6%
unpow217.6%
Simplified17.6%
Taylor expanded in y around 0 17.6%
Final simplification46.5%
(FPCore (x y) :precision binary64 (if (or (<= y 5.2e+22) (not (<= y 1.9e+159))) (+ 1.0 (* 0.16666666666666666 (* y y))) (* -0.08333333333333333 (* (* y y) (* x x)))))
double code(double x, double y) {
double tmp;
if ((y <= 5.2e+22) || !(y <= 1.9e+159)) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((y * y) * (x * 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.2d+22) .or. (.not. (y <= 1.9d+159))) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = (-0.08333333333333333d0) * ((y * y) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 5.2e+22) || !(y <= 1.9e+159)) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 5.2e+22) or not (y <= 1.9e+159): tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = -0.08333333333333333 * ((y * y) * (x * x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= 5.2e+22) || !(y <= 1.9e+159)) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(-0.08333333333333333 * Float64(Float64(y * y) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 5.2e+22) || ~((y <= 1.9e+159))) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = -0.08333333333333333 * ((y * y) * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 5.2e+22], N[Not[LessEqual[y, 1.9e+159]], $MachinePrecision]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.08333333333333333 * N[(N[(y * y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.2 \cdot 10^{+22} \lor \neg \left(y \leq 1.9 \cdot 10^{+159}\right):\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 5.2e22 or 1.89999999999999983e159 < y Initial program 100.0%
Taylor expanded in y around 0 83.4%
unpow283.4%
Simplified83.4%
Taylor expanded in x around 0 51.7%
+-commutative51.7%
unpow251.7%
Simplified51.7%
if 5.2e22 < y < 1.89999999999999983e159Initial program 100.0%
Taylor expanded in y around 0 15.3%
unpow215.3%
Simplified15.3%
Taylor expanded in y around inf 15.3%
unpow215.3%
associate-*l*15.3%
associate-*r*12.7%
*-commutative12.7%
associate-*l*12.7%
Simplified12.7%
Taylor expanded in x around 0 38.1%
unpow238.1%
associate-*r*38.1%
distribute-rgt-out38.1%
Simplified38.1%
Taylor expanded in x around inf 36.0%
unpow236.0%
unpow236.0%
Simplified36.0%
Final simplification49.8%
(FPCore (x y) :precision binary64 (if (<= y 2.5) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 2.5) {
tmp = 1.0;
} else {
tmp = 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 (y <= 2.5d0) then
tmp = 1.0d0
else
tmp = 0.16666666666666666d0 * (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.5) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.5: tmp = 1.0 else: tmp = 0.16666666666666666 * (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.5) tmp = 1.0; else tmp = Float64(0.16666666666666666 * Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.5) tmp = 1.0; else tmp = 0.16666666666666666 * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.5], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 2.5Initial program 100.0%
*-commutative100.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 66.0%
Taylor expanded in y around 0 39.3%
if 2.5 < y Initial program 100.0%
Taylor expanded in y around 0 48.9%
unpow248.9%
Simplified48.9%
Taylor expanded in y around inf 48.9%
unpow248.9%
*-commutative48.9%
Simplified48.9%
Taylor expanded in x around 0 30.2%
unpow230.2%
Simplified30.2%
Final simplification37.3%
(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 100.0%
Taylor expanded in y around 0 75.1%
unpow275.1%
Simplified75.1%
Taylor expanded in x around 0 46.3%
+-commutative46.3%
unpow246.3%
Simplified46.3%
Final simplification46.3%
(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 100.0%
*-commutative100.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 65.8%
Taylor expanded in y around 0 31.0%
Final simplification31.0%
herbie shell --seed 2023275
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))