
(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 1.00000000002) (cos x) t_0)))
double code(double x, double y) {
double t_0 = sinh(y) / y;
double tmp;
if (t_0 <= 1.00000000002) {
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 <= 1.00000000002d0) 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 <= 1.00000000002) {
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 <= 1.00000000002: 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 <= 1.00000000002) 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 <= 1.00000000002) 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, 1.00000000002], N[Cos[x], $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
\mathbf{if}\;t_0 \leq 1.00000000002:\\
\;\;\;\;\cos x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (/.f64 (sinh.f64 y) y) < 1.00000000002Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 99.9%
if 1.00000000002 < (/.f64 (sinh.f64 y) y) Initial program 100.0%
Taylor expanded in x around 0 73.9%
Final simplification86.4%
(FPCore (x y) :precision binary64 (if (or (<= y 0.051) (not (<= y 1.35e+154))) (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y)))) (* (/ (sinh y) y) (+ 1.0 (* -0.5 (* x x))))))
double code(double x, double y) {
double tmp;
if ((y <= 0.051) || !(y <= 1.35e+154)) {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = (sinh(y) / y) * (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 ((y <= 0.051d0) .or. (.not. (y <= 1.35d+154))) then
tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else
tmp = (sinh(y) / y) * (1.0d0 + ((-0.5d0) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 0.051) || !(y <= 1.35e+154)) {
tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = (Math.sinh(y) / y) * (1.0 + (-0.5 * (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 0.051) or not (y <= 1.35e+154): tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) else: tmp = (math.sinh(y) / y) * (1.0 + (-0.5 * (x * x))) return tmp
function code(x, y) tmp = 0.0 if ((y <= 0.051) || !(y <= 1.35e+154)) tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(Float64(sinh(y) / y) * Float64(1.0 + Float64(-0.5 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 0.051) || ~((y <= 1.35e+154))) tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); else tmp = (sinh(y) / y) * (1.0 + (-0.5 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 0.051], N[Not[LessEqual[y, 1.35e+154]], $MachinePrecision]], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.051 \lor \neg \left(y \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sinh y}{y} \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 0.0509999999999999967 or 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 85.6%
unpow285.6%
Simplified85.6%
if 0.0509999999999999967 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in x around 0 81.9%
unpow281.9%
Simplified81.9%
Final simplification85.2%
(FPCore (x y) :precision binary64 (if (or (<= y 0.038) (not (<= y 1.35e+154))) (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y)))) (/ (sinh y) y)))
double code(double x, double y) {
double tmp;
if ((y <= 0.038) || !(y <= 1.35e+154)) {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = sinh(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.038d0) .or. (.not. (y <= 1.35d+154))) then
tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else
tmp = sinh(y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 0.038) || !(y <= 1.35e+154)) {
tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = Math.sinh(y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 0.038) or not (y <= 1.35e+154): tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) else: tmp = math.sinh(y) / y return tmp
function code(x, y) tmp = 0.0 if ((y <= 0.038) || !(y <= 1.35e+154)) tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(sinh(y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 0.038) || ~((y <= 1.35e+154))) tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); else tmp = sinh(y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 0.038], N[Not[LessEqual[y, 1.35e+154]], $MachinePrecision]], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.038 \lor \neg \left(y \leq 1.35 \cdot 10^{+154}\right):\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\end{array}
\end{array}
if y < 0.0379999999999999991 or 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 85.6%
unpow285.6%
Simplified85.6%
if 0.0379999999999999991 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in x around 0 66.7%
Final simplification83.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y)))))
(if (<= y 1.6e-5)
(cos x)
(if (or (<= y 8.114e+146)
(not
(or (<= y 1e+183) (and (not (<= y 4.8e+243)) (<= y 1.8e+292)))))
(* (+ 1.0 (* -0.5 (* x x))) t_0)
t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (y <= 1.6e-5) {
tmp = cos(x);
} else if ((y <= 8.114e+146) || !((y <= 1e+183) || (!(y <= 4.8e+243) && (y <= 1.8e+292)))) {
tmp = (1.0 + (-0.5 * (x * x))) * t_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 = 1.0d0 + (0.16666666666666666d0 * (y * y))
if (y <= 1.6d-5) then
tmp = cos(x)
else if ((y <= 8.114d+146) .or. (.not. (y <= 1d+183) .or. (.not. (y <= 4.8d+243)) .and. (y <= 1.8d+292))) then
tmp = (1.0d0 + ((-0.5d0) * (x * x))) * t_0
else
tmp = t_0
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 (y <= 1.6e-5) {
tmp = Math.cos(x);
} else if ((y <= 8.114e+146) || !((y <= 1e+183) || (!(y <= 4.8e+243) && (y <= 1.8e+292)))) {
tmp = (1.0 + (-0.5 * (x * x))) * t_0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if y <= 1.6e-5: tmp = math.cos(x) elif (y <= 8.114e+146) or not ((y <= 1e+183) or (not (y <= 4.8e+243) and (y <= 1.8e+292))): tmp = (1.0 + (-0.5 * (x * x))) * t_0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (y <= 1.6e-5) tmp = cos(x); elseif ((y <= 8.114e+146) || !((y <= 1e+183) || (!(y <= 4.8e+243) && (y <= 1.8e+292)))) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(x * x))) * t_0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (y <= 1.6e-5) tmp = cos(x); elseif ((y <= 8.114e+146) || ~(((y <= 1e+183) || (~((y <= 4.8e+243)) && (y <= 1.8e+292))))) tmp = (1.0 + (-0.5 * (x * x))) * t_0; else tmp = t_0; 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[y, 1.6e-5], N[Cos[x], $MachinePrecision], If[Or[LessEqual[y, 8.114e+146], N[Not[Or[LessEqual[y, 1e+183], And[N[Not[LessEqual[y, 4.8e+243]], $MachinePrecision], LessEqual[y, 1.8e+292]]]], $MachinePrecision]], N[(N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 1.6 \cdot 10^{-5}:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 8.114 \cdot 10^{+146} \lor \neg \left(y \leq 10^{+183} \lor \neg \left(y \leq 4.8 \cdot 10^{+243}\right) \land y \leq 1.8 \cdot 10^{+292}\right):\\
\;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < 1.59999999999999993e-5Initial program 100.0%
Taylor expanded in y around 0 83.1%
unpow283.1%
Simplified83.1%
Taylor expanded in y around 0 66.9%
if 1.59999999999999993e-5 < y < 8.1140000000000002e146 or 9.99999999999999947e182 < y < 4.8000000000000001e243 or 1.79999999999999998e292 < y Initial program 100.0%
Taylor expanded in x around 0 85.8%
unpow285.8%
Simplified85.8%
Taylor expanded in y around 0 49.2%
unpow240.5%
Simplified49.2%
if 8.1140000000000002e146 < y < 9.99999999999999947e182 or 4.8000000000000001e243 < y < 1.79999999999999998e292Initial program 100.0%
Taylor expanded in x around 0 88.2%
Taylor expanded in y around 0 77.7%
unpow289.5%
Simplified77.7%
Final simplification64.2%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y))))) (if (<= x 2.55e+76) t_0 (* (+ 1.0 (* -0.5 (* x x))) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 2.55e+76) {
tmp = t_0;
} else {
tmp = (1.0 + (-0.5 * (x * x))) * 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 = 1.0d0 + (0.16666666666666666d0 * (y * y))
if (x <= 2.55d+76) then
tmp = t_0
else
tmp = (1.0d0 + ((-0.5d0) * (x * x))) * t_0
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 <= 2.55e+76) {
tmp = t_0;
} else {
tmp = (1.0 + (-0.5 * (x * x))) * t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if x <= 2.55e+76: tmp = t_0 else: tmp = (1.0 + (-0.5 * (x * x))) * t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (x <= 2.55e+76) tmp = t_0; else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(x * x))) * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (x <= 2.55e+76) tmp = t_0; else tmp = (1.0 + (-0.5 * (x * x))) * t_0; 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, 2.55e+76], t$95$0, N[(N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;x \leq 2.55 \cdot 10^{+76}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot t_0\\
\end{array}
\end{array}
if x < 2.5500000000000001e76Initial program 100.0%
Taylor expanded in x around 0 70.3%
Taylor expanded in y around 0 50.9%
unpow274.6%
Simplified50.9%
if 2.5500000000000001e76 < x Initial program 100.0%
Taylor expanded in x around 0 29.8%
unpow229.8%
Simplified29.8%
Taylor expanded in y around 0 27.8%
unpow278.9%
Simplified27.8%
Final simplification46.8%
(FPCore (x y) :precision binary64 (if (<= x 2.55e+76) (+ 1.0 (* 0.16666666666666666 (* y y))) (* (* x x) (+ -0.5 (* (* y y) -0.08333333333333333)))))
double code(double x, double y) {
double tmp;
if (x <= 2.55e+76) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = (x * x) * (-0.5 + ((y * y) * -0.08333333333333333));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 2.55d+76) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = (x * x) * ((-0.5d0) + ((y * y) * (-0.08333333333333333d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 2.55e+76) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = (x * x) * (-0.5 + ((y * y) * -0.08333333333333333));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.55e+76: tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = (x * x) * (-0.5 + ((y * y) * -0.08333333333333333)) return tmp
function code(x, y) tmp = 0.0 if (x <= 2.55e+76) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(Float64(x * x) * Float64(-0.5 + Float64(Float64(y * y) * -0.08333333333333333))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 2.55e+76) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = (x * x) * (-0.5 + ((y * y) * -0.08333333333333333)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.55e+76], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(-0.5 + N[(N[(y * y), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.55 \cdot 10^{+76}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(-0.5 + \left(y \cdot y\right) \cdot -0.08333333333333333\right)\\
\end{array}
\end{array}
if x < 2.5500000000000001e76Initial program 100.0%
Taylor expanded in x around 0 70.3%
Taylor expanded in y around 0 50.9%
unpow274.6%
Simplified50.9%
if 2.5500000000000001e76 < x Initial program 100.0%
Taylor expanded in x around 0 29.8%
unpow229.8%
Simplified29.8%
Taylor expanded in x around inf 29.8%
unpow229.8%
Simplified29.8%
Taylor expanded in y around 0 27.5%
unpow227.5%
*-commutative27.5%
associate-*r*27.5%
distribute-rgt-out27.8%
unpow227.8%
Simplified27.8%
Final simplification46.8%
(FPCore (x y) :precision binary64 (if (<= y 290000000.0) 1.0 (* -0.08333333333333333 (* (* y y) (* x x)))))
double code(double x, double y) {
double tmp;
if (y <= 290000000.0) {
tmp = 1.0;
} 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 <= 290000000.0d0) then
tmp = 1.0d0
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 <= 290000000.0) {
tmp = 1.0;
} else {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 290000000.0: tmp = 1.0 else: tmp = -0.08333333333333333 * ((y * y) * (x * x)) return tmp
function code(x, y) tmp = 0.0 if (y <= 290000000.0) tmp = 1.0; 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 <= 290000000.0) tmp = 1.0; else tmp = -0.08333333333333333 * ((y * y) * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 290000000.0], 1.0, N[(-0.08333333333333333 * N[(N[(y * y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 290000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 2.9e8Initial program 100.0%
Taylor expanded in y around 0 81.6%
unpow281.6%
Simplified81.6%
Taylor expanded in y around 0 65.7%
Taylor expanded in x around 0 35.1%
if 2.9e8 < y Initial program 100.0%
Taylor expanded in x around 0 77.4%
unpow277.4%
Simplified77.4%
Taylor expanded in x around inf 29.0%
unpow229.0%
Simplified29.0%
Taylor expanded in y around 0 26.3%
unpow226.3%
*-commutative26.3%
associate-*r*26.3%
distribute-rgt-out26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in y around inf 26.3%
unpow226.3%
unpow226.3%
Simplified26.3%
Final simplification33.0%
(FPCore (x y) :precision binary64 (if (<= x 2.55e+76) (+ 1.0 (* 0.16666666666666666 (* y y))) (* -0.08333333333333333 (* (* y y) (* x x)))))
double code(double x, double y) {
double tmp;
if (x <= 2.55e+76) {
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 (x <= 2.55d+76) 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 (x <= 2.55e+76) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.55e+76: 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 (x <= 2.55e+76) 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 (x <= 2.55e+76) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = -0.08333333333333333 * ((y * y) * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.55e+76], 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}\;x \leq 2.55 \cdot 10^{+76}:\\
\;\;\;\;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 x < 2.5500000000000001e76Initial program 100.0%
Taylor expanded in x around 0 70.3%
Taylor expanded in y around 0 50.9%
unpow274.6%
Simplified50.9%
if 2.5500000000000001e76 < x Initial program 100.0%
Taylor expanded in x around 0 29.8%
unpow229.8%
Simplified29.8%
Taylor expanded in x around inf 29.8%
unpow229.8%
Simplified29.8%
Taylor expanded in y around 0 27.5%
unpow227.5%
*-commutative27.5%
associate-*r*27.5%
distribute-rgt-out27.8%
unpow227.8%
Simplified27.8%
Taylor expanded in y around inf 27.7%
unpow227.7%
unpow227.7%
Simplified27.7%
Final simplification46.8%
(FPCore (x y) :precision binary64 (if (<= y 3250.0) 1.0 (+ 1.0 (* -0.5 (* x x)))))
double code(double x, double y) {
double tmp;
if (y <= 3250.0) {
tmp = 1.0;
} 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 (y <= 3250.0d0) then
tmp = 1.0d0
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 (y <= 3250.0) {
tmp = 1.0;
} else {
tmp = 1.0 + (-0.5 * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3250.0: tmp = 1.0 else: tmp = 1.0 + (-0.5 * (x * x)) return tmp
function code(x, y) tmp = 0.0 if (y <= 3250.0) tmp = 1.0; 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 (y <= 3250.0) tmp = 1.0; else tmp = 1.0 + (-0.5 * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3250.0], 1.0, N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3250:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if y < 3250Initial program 100.0%
Taylor expanded in y around 0 82.4%
unpow282.4%
Simplified82.4%
Taylor expanded in y around 0 66.3%
Taylor expanded in x around 0 35.5%
if 3250 < y Initial program 100.0%
Taylor expanded in y around 0 54.4%
unpow254.4%
Simplified54.4%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 15.0%
unpow278.1%
Simplified15.0%
Final simplification30.3%
(FPCore (x y) :precision binary64 (if (<= y 170000000.0) 1.0 (* -0.5 (* x x))))
double code(double x, double y) {
double tmp;
if (y <= 170000000.0) {
tmp = 1.0;
} else {
tmp = -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 (y <= 170000000.0d0) then
tmp = 1.0d0
else
tmp = (-0.5d0) * (x * x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 170000000.0) {
tmp = 1.0;
} else {
tmp = -0.5 * (x * x);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 170000000.0: tmp = 1.0 else: tmp = -0.5 * (x * x) return tmp
function code(x, y) tmp = 0.0 if (y <= 170000000.0) tmp = 1.0; else tmp = Float64(-0.5 * Float64(x * x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 170000000.0) tmp = 1.0; else tmp = -0.5 * (x * x); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 170000000.0], 1.0, N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 170000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if y < 1.7e8Initial program 100.0%
Taylor expanded in y around 0 81.6%
unpow281.6%
Simplified81.6%
Taylor expanded in y around 0 65.7%
Taylor expanded in x around 0 35.1%
if 1.7e8 < y Initial program 100.0%
Taylor expanded in x around 0 77.4%
unpow277.4%
Simplified77.4%
Taylor expanded in x around inf 29.0%
unpow229.0%
Simplified29.0%
Taylor expanded in y around 0 14.5%
*-commutative14.5%
unpow214.5%
Simplified14.5%
Final simplification30.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 100.0%
Taylor expanded in y around 0 75.4%
unpow275.4%
Simplified75.4%
Taylor expanded in y around 0 50.5%
Taylor expanded in x around 0 27.2%
Final simplification27.2%
herbie shell --seed 2023290
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))