
(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 10 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 (if (or (<= y 0.29) (not (<= y 5.4e+149))) (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y)))) (/ (sinh y) y)))
double code(double x, double y) {
double tmp;
if ((y <= 0.29) || !(y <= 5.4e+149)) {
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.29d0) .or. (.not. (y <= 5.4d+149))) 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.29) || !(y <= 5.4e+149)) {
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.29) or not (y <= 5.4e+149): 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.29) || !(y <= 5.4e+149)) 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.29) || ~((y <= 5.4e+149))) 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.29], N[Not[LessEqual[y, 5.4e+149]], $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.29 \lor \neg \left(y \leq 5.4 \cdot 10^{+149}\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.28999999999999998 or 5.4000000000000002e149 < y Initial program 100.0%
Taylor expanded in y around 0 87.2%
unpow287.2%
Simplified87.2%
if 0.28999999999999998 < y < 5.4000000000000002e149Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 85.7%
*-commutative85.7%
associate-/r/85.7%
rec-exp85.7%
sinh-def85.7%
Simplified85.7%
add-log-exp85.7%
*-un-lft-identity85.7%
log-prod85.7%
metadata-eval85.7%
add-log-exp85.7%
clear-num85.7%
Applied egg-rr85.7%
+-lft-identity85.7%
Simplified85.7%
Final simplification87.0%
(FPCore (x y)
:precision binary64
(if (<= y 0.29)
(cos x)
(if (<= y 5.4e+149)
(/ (sinh y) y)
(* 0.16666666666666666 (* y (* (cos x) y))))))
double code(double x, double y) {
double tmp;
if (y <= 0.29) {
tmp = cos(x);
} else if (y <= 5.4e+149) {
tmp = sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (y * (cos(x) * 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.29d0) then
tmp = cos(x)
else if (y <= 5.4d+149) then
tmp = sinh(y) / y
else
tmp = 0.16666666666666666d0 * (y * (cos(x) * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.29) {
tmp = Math.cos(x);
} else if (y <= 5.4e+149) {
tmp = Math.sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (y * (Math.cos(x) * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.29: tmp = math.cos(x) elif y <= 5.4e+149: tmp = math.sinh(y) / y else: tmp = 0.16666666666666666 * (y * (math.cos(x) * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.29) tmp = cos(x); elseif (y <= 5.4e+149) tmp = Float64(sinh(y) / y); else tmp = Float64(0.16666666666666666 * Float64(y * Float64(cos(x) * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.29) tmp = cos(x); elseif (y <= 5.4e+149) tmp = sinh(y) / y; else tmp = 0.16666666666666666 * (y * (cos(x) * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.29], N[Cos[x], $MachinePrecision], If[LessEqual[y, 5.4e+149], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.29:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+149}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.28999999999999998Initial program 100.0%
Taylor expanded in y around 0 69.2%
if 0.28999999999999998 < y < 5.4000000000000002e149Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 85.7%
*-commutative85.7%
associate-/r/85.7%
rec-exp85.7%
sinh-def85.7%
Simplified85.7%
add-log-exp85.7%
*-un-lft-identity85.7%
log-prod85.7%
metadata-eval85.7%
add-log-exp85.7%
clear-num85.7%
Applied egg-rr85.7%
+-lft-identity85.7%
Simplified85.7%
if 5.4000000000000002e149 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification75.1%
(FPCore (x y)
:precision binary64
(if (<= y 0.29)
(cos x)
(if (<= y 5.4e+149)
(/ (sinh y) y)
(* (* y y) (+ 0.16666666666666666 (* (* x x) -0.08333333333333333))))))
double code(double x, double y) {
double tmp;
if (y <= 0.29) {
tmp = cos(x);
} else if (y <= 5.4e+149) {
tmp = sinh(y) / y;
} else {
tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.29d0) then
tmp = cos(x)
else if (y <= 5.4d+149) then
tmp = sinh(y) / y
else
tmp = (y * y) * (0.16666666666666666d0 + ((x * x) * (-0.08333333333333333d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.29) {
tmp = Math.cos(x);
} else if (y <= 5.4e+149) {
tmp = Math.sinh(y) / y;
} else {
tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.29: tmp = math.cos(x) elif y <= 5.4e+149: tmp = math.sinh(y) / y else: tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.29) tmp = cos(x); elseif (y <= 5.4e+149) tmp = Float64(sinh(y) / y); else tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(Float64(x * x) * -0.08333333333333333))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.29) tmp = cos(x); elseif (y <= 5.4e+149) tmp = sinh(y) / y; else tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.29], N[Cos[x], $MachinePrecision], If[LessEqual[y, 5.4e+149], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.29:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+149}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\\
\end{array}
\end{array}
if y < 0.28999999999999998Initial program 100.0%
Taylor expanded in y around 0 69.2%
if 0.28999999999999998 < y < 5.4000000000000002e149Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 85.7%
*-commutative85.7%
associate-/r/85.7%
rec-exp85.7%
sinh-def85.7%
Simplified85.7%
add-log-exp85.7%
*-un-lft-identity85.7%
log-prod85.7%
metadata-eval85.7%
add-log-exp85.7%
clear-num85.7%
Applied egg-rr85.7%
+-lft-identity85.7%
Simplified85.7%
if 5.4000000000000002e149 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate-*r*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 86.7%
*-commutative86.7%
unpow286.7%
Simplified86.7%
Final simplification73.5%
(FPCore (x y)
:precision binary64
(if (<= y 270.0)
(cos x)
(if (<= y 5.4e+149)
(/ 2.0 (* x x))
(* (* y y) (+ 0.16666666666666666 (* (* x x) -0.08333333333333333))))))
double code(double x, double y) {
double tmp;
if (y <= 270.0) {
tmp = cos(x);
} else if (y <= 5.4e+149) {
tmp = 2.0 / (x * x);
} else {
tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 270.0d0) then
tmp = cos(x)
else if (y <= 5.4d+149) then
tmp = 2.0d0 / (x * x)
else
tmp = (y * y) * (0.16666666666666666d0 + ((x * x) * (-0.08333333333333333d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 270.0) {
tmp = Math.cos(x);
} else if (y <= 5.4e+149) {
tmp = 2.0 / (x * x);
} else {
tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 270.0: tmp = math.cos(x) elif y <= 5.4e+149: tmp = 2.0 / (x * x) else: tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333)) return tmp
function code(x, y) tmp = 0.0 if (y <= 270.0) tmp = cos(x); elseif (y <= 5.4e+149) tmp = Float64(2.0 / Float64(x * x)); else tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(Float64(x * x) * -0.08333333333333333))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 270.0) tmp = cos(x); elseif (y <= 5.4e+149) tmp = 2.0 / (x * x); else tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 270.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 5.4e+149], N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 270:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+149}:\\
\;\;\;\;\frac{2}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\\
\end{array}
\end{array}
if y < 270Initial program 100.0%
Taylor expanded in y around 0 69.2%
if 270 < y < 5.4000000000000002e149Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 2.5%
unpow22.5%
Simplified2.5%
Taylor expanded in x around inf 28.0%
unpow228.0%
Simplified28.0%
if 5.4000000000000002e149 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate-*r*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 86.7%
*-commutative86.7%
unpow286.7%
Simplified86.7%
Final simplification65.6%
(FPCore (x y)
:precision binary64
(if (<= y 225.0)
1.0
(if (<= y 5.4e+149)
(/ 2.0 (* x x))
(* (* y y) (+ 0.16666666666666666 (* (* x x) -0.08333333333333333))))))
double code(double x, double y) {
double tmp;
if (y <= 225.0) {
tmp = 1.0;
} else if (y <= 5.4e+149) {
tmp = 2.0 / (x * x);
} else {
tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 225.0d0) then
tmp = 1.0d0
else if (y <= 5.4d+149) then
tmp = 2.0d0 / (x * x)
else
tmp = (y * y) * (0.16666666666666666d0 + ((x * x) * (-0.08333333333333333d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 225.0) {
tmp = 1.0;
} else if (y <= 5.4e+149) {
tmp = 2.0 / (x * x);
} else {
tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 225.0: tmp = 1.0 elif y <= 5.4e+149: tmp = 2.0 / (x * x) else: tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333)) return tmp
function code(x, y) tmp = 0.0 if (y <= 225.0) tmp = 1.0; elseif (y <= 5.4e+149) tmp = Float64(2.0 / Float64(x * x)); else tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(Float64(x * x) * -0.08333333333333333))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 225.0) tmp = 1.0; elseif (y <= 5.4e+149) tmp = 2.0 / (x * x); else tmp = (y * y) * (0.16666666666666666 + ((x * x) * -0.08333333333333333)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 225.0], 1.0, If[LessEqual[y, 5.4e+149], N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 225:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+149}:\\
\;\;\;\;\frac{2}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\\
\end{array}
\end{array}
if y < 225Initial program 100.0%
associate-*r/99.9%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 28.9%
*-commutative28.9%
associate-/r/28.9%
rec-exp29.0%
sinh-def64.9%
Simplified64.9%
Taylor expanded in y around 0 40.1%
if 225 < y < 5.4000000000000002e149Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 2.5%
unpow22.5%
Simplified2.5%
Taylor expanded in x around inf 28.0%
unpow228.0%
Simplified28.0%
if 5.4000000000000002e149 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
associate-*r*100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 86.7%
*-commutative86.7%
unpow286.7%
Simplified86.7%
Final simplification43.9%
(FPCore (x y)
:precision binary64
(if (<= y 170.0)
1.0
(if (<= y 1.6e+149)
(/ 2.0 (* x x))
(+ 1.0 (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 170.0) {
tmp = 1.0;
} else if (y <= 1.6e+149) {
tmp = 2.0 / (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 <= 170.0d0) then
tmp = 1.0d0
else if (y <= 1.6d+149) then
tmp = 2.0d0 / (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 <= 170.0) {
tmp = 1.0;
} else if (y <= 1.6e+149) {
tmp = 2.0 / (x * x);
} else {
tmp = 1.0 + (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 170.0: tmp = 1.0 elif y <= 1.6e+149: tmp = 2.0 / (x * x) else: tmp = 1.0 + (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 170.0) tmp = 1.0; elseif (y <= 1.6e+149) tmp = Float64(2.0 / 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 <= 170.0) tmp = 1.0; elseif (y <= 1.6e+149) tmp = 2.0 / (x * x); else tmp = 1.0 + (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 170.0], 1.0, If[LessEqual[y, 1.6e+149], N[(2.0 / 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}\;y \leq 170:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+149}:\\
\;\;\;\;\frac{2}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 170Initial program 100.0%
associate-*r/99.9%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 28.9%
*-commutative28.9%
associate-/r/28.9%
rec-exp29.0%
sinh-def64.9%
Simplified64.9%
Taylor expanded in y around 0 40.1%
if 170 < y < 1.6000000000000001e149Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 2.5%
unpow22.5%
Simplified2.5%
Taylor expanded in x around inf 28.0%
unpow228.0%
Simplified28.0%
if 1.6000000000000001e149 < y Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 76.7%
*-commutative76.7%
associate-/r/76.7%
rec-exp76.7%
sinh-def76.7%
Simplified76.7%
Taylor expanded in y around 0 76.7%
unpow276.7%
Simplified76.7%
Final simplification42.8%
(FPCore (x y) :precision binary64 (if (<= y 340.0) 1.0 (if (<= y 1.6e+149) (/ 2.0 (* x x)) (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 340.0) {
tmp = 1.0;
} else if (y <= 1.6e+149) {
tmp = 2.0 / (x * x);
} 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 <= 340.0d0) then
tmp = 1.0d0
else if (y <= 1.6d+149) then
tmp = 2.0d0 / (x * x)
else
tmp = 0.16666666666666666d0 * (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 340.0) {
tmp = 1.0;
} else if (y <= 1.6e+149) {
tmp = 2.0 / (x * x);
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 340.0: tmp = 1.0 elif y <= 1.6e+149: tmp = 2.0 / (x * x) else: tmp = 0.16666666666666666 * (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 340.0) tmp = 1.0; elseif (y <= 1.6e+149) tmp = Float64(2.0 / Float64(x * x)); else tmp = Float64(0.16666666666666666 * Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 340.0) tmp = 1.0; elseif (y <= 1.6e+149) tmp = 2.0 / (x * x); else tmp = 0.16666666666666666 * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 340.0], 1.0, If[LessEqual[y, 1.6e+149], N[(2.0 / N[(x * x), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 340:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+149}:\\
\;\;\;\;\frac{2}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 340Initial program 100.0%
associate-*r/99.9%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 28.9%
*-commutative28.9%
associate-/r/28.9%
rec-exp29.0%
sinh-def64.9%
Simplified64.9%
Taylor expanded in y around 0 40.1%
if 340 < y < 1.6000000000000001e149Initial program 100.0%
associate-*r/100.0%
clear-num100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 2.5%
unpow22.5%
Simplified2.5%
Taylor expanded in x around inf 28.0%
unpow228.0%
Simplified28.0%
if 1.6000000000000001e149 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in x around 0 76.7%
unpow276.7%
Simplified76.7%
Final simplification42.8%
(FPCore (x y) :precision binary64 (if (<= y 2.0) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 2.0) {
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.0d0) 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.0) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.0: tmp = 1.0 else: tmp = 0.16666666666666666 * (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.0) 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.0) tmp = 1.0; else tmp = 0.16666666666666666 * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.0], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 2Initial program 100.0%
associate-*r/99.9%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 28.9%
*-commutative28.9%
associate-/r/28.9%
rec-exp29.0%
sinh-def64.9%
Simplified64.9%
Taylor expanded in y around 0 40.1%
if 2 < y Initial program 100.0%
Taylor expanded in y around 0 48.6%
unpow248.6%
Simplified48.6%
Taylor expanded in y around inf 48.6%
unpow248.6%
*-commutative48.6%
associate-*l*48.6%
Simplified48.6%
Taylor expanded in x around 0 37.6%
unpow237.6%
Simplified37.6%
Final simplification39.5%
(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%
associate-*r/99.9%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 42.3%
*-commutative42.3%
associate-/r/42.3%
rec-exp42.3%
sinh-def69.2%
Simplified69.2%
Taylor expanded in y around 0 30.6%
Final simplification30.6%
herbie shell --seed 2023238
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))