
(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 10 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(sin(y) / Float64(y / cosh(x))) end
function tmp = code(x, y) tmp = sin(y) / (y / cosh(x)); end
code[x_, y_] := N[(N[Sin[y], $MachinePrecision] / N[(y / N[Cosh[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin y}{\frac{y}{\cosh x}}
\end{array}
Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Final simplification99.9%
(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}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(if (<= x 0.00036)
(/ (sin y) y)
(if (<= x 2.8e+152)
(/ (/ (cosh x) y) (/ 1.0 y))
(* 0.5 (/ (sin y) (/ y (* x x)))))))
double code(double x, double y) {
double tmp;
if (x <= 0.00036) {
tmp = sin(y) / y;
} else if (x <= 2.8e+152) {
tmp = (cosh(x) / y) / (1.0 / y);
} else {
tmp = 0.5 * (sin(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 <= 0.00036d0) then
tmp = sin(y) / y
else if (x <= 2.8d+152) then
tmp = (cosh(x) / y) / (1.0d0 / y)
else
tmp = 0.5d0 * (sin(y) / (y / (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.00036) {
tmp = Math.sin(y) / y;
} else if (x <= 2.8e+152) {
tmp = (Math.cosh(x) / y) / (1.0 / y);
} else {
tmp = 0.5 * (Math.sin(y) / (y / (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.00036: tmp = math.sin(y) / y elif x <= 2.8e+152: tmp = (math.cosh(x) / y) / (1.0 / y) else: tmp = 0.5 * (math.sin(y) / (y / (x * x))) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.00036) tmp = Float64(sin(y) / y); elseif (x <= 2.8e+152) tmp = Float64(Float64(cosh(x) / y) / Float64(1.0 / y)); else tmp = Float64(0.5 * Float64(sin(y) / Float64(y / Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.00036) tmp = sin(y) / y; elseif (x <= 2.8e+152) tmp = (cosh(x) / y) / (1.0 / y); else tmp = 0.5 * (sin(y) / (y / (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.00036], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, 2.8e+152], N[(N[(N[Cosh[x], $MachinePrecision] / y), $MachinePrecision] / N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[y], $MachinePrecision] / N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00036:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+152}:\\
\;\;\;\;\frac{\frac{\cosh x}{y}}{\frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\sin y}{\frac{y}{x \cdot x}}\\
\end{array}
\end{array}
if x < 3.60000000000000023e-4Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 68.7%
if 3.60000000000000023e-4 < x < 2.8000000000000002e152Initial 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%
clear-num100.0%
associate-*l/100.0%
add-sqr-sqrt42.5%
times-frac42.5%
pow1/295.0%
pow-flip95.0%
metadata-eval95.0%
associate-*r/95.0%
associate-/l*95.0%
metadata-eval95.0%
pow-flip95.0%
pow1/242.5%
metadata-eval42.5%
sqrt-div42.5%
clear-num42.5%
Applied egg-rr42.5%
div-inv42.5%
clear-num42.5%
div-inv42.5%
metadata-eval42.5%
sqrt-div42.5%
clear-num42.5%
Applied egg-rr42.5%
associate-*r*42.5%
/-rgt-identity42.5%
associate-/r/42.5%
associate-*l/42.5%
rem-square-sqrt100.0%
Simplified100.0%
Taylor expanded in y around 0 82.5%
if 2.8000000000000002e152 < 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 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.0%
unpow297.0%
associate-/l*100.0%
Simplified100.0%
Final simplification74.4%
(FPCore (x y)
:precision binary64
(if (<= x 0.00036)
(/ (+ 1.0 (* 0.5 (* x x))) (/ y (sin y)))
(if (<= x 2.8e+152)
(/ (/ (cosh x) y) (/ 1.0 y))
(* 0.5 (/ (sin y) (/ y (* x x)))))))
double code(double x, double y) {
double tmp;
if (x <= 0.00036) {
tmp = (1.0 + (0.5 * (x * x))) / (y / sin(y));
} else if (x <= 2.8e+152) {
tmp = (cosh(x) / y) / (1.0 / y);
} else {
tmp = 0.5 * (sin(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 <= 0.00036d0) then
tmp = (1.0d0 + (0.5d0 * (x * x))) / (y / sin(y))
else if (x <= 2.8d+152) then
tmp = (cosh(x) / y) / (1.0d0 / y)
else
tmp = 0.5d0 * (sin(y) / (y / (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.00036) {
tmp = (1.0 + (0.5 * (x * x))) / (y / Math.sin(y));
} else if (x <= 2.8e+152) {
tmp = (Math.cosh(x) / y) / (1.0 / y);
} else {
tmp = 0.5 * (Math.sin(y) / (y / (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.00036: tmp = (1.0 + (0.5 * (x * x))) / (y / math.sin(y)) elif x <= 2.8e+152: tmp = (math.cosh(x) / y) / (1.0 / y) else: tmp = 0.5 * (math.sin(y) / (y / (x * x))) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.00036) tmp = Float64(Float64(1.0 + Float64(0.5 * Float64(x * x))) / Float64(y / sin(y))); elseif (x <= 2.8e+152) tmp = Float64(Float64(cosh(x) / y) / Float64(1.0 / y)); else tmp = Float64(0.5 * Float64(sin(y) / Float64(y / Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.00036) tmp = (1.0 + (0.5 * (x * x))) / (y / sin(y)); elseif (x <= 2.8e+152) tmp = (cosh(x) / y) / (1.0 / y); else tmp = 0.5 * (sin(y) / (y / (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.00036], N[(N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y / N[Sin[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+152], N[(N[(N[Cosh[x], $MachinePrecision] / y), $MachinePrecision] / N[(1.0 / y), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[Sin[y], $MachinePrecision] / N[(y / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.00036:\\
\;\;\;\;\frac{1 + 0.5 \cdot \left(x \cdot x\right)}{\frac{y}{\sin y}}\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+152}:\\
\;\;\;\;\frac{\frac{\cosh x}{y}}{\frac{1}{y}}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{\sin y}{\frac{y}{x \cdot x}}\\
\end{array}
\end{array}
if x < 3.60000000000000023e-4Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.8%
associate-/r/99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 89.8%
unpow289.8%
Simplified89.8%
Taylor expanded in y around inf 86.4%
associate-/l*86.3%
unpow286.3%
Simplified86.3%
if 3.60000000000000023e-4 < x < 2.8000000000000002e152Initial 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%
clear-num100.0%
associate-*l/100.0%
add-sqr-sqrt42.5%
times-frac42.5%
pow1/295.0%
pow-flip95.0%
metadata-eval95.0%
associate-*r/95.0%
associate-/l*95.0%
metadata-eval95.0%
pow-flip95.0%
pow1/242.5%
metadata-eval42.5%
sqrt-div42.5%
clear-num42.5%
Applied egg-rr42.5%
div-inv42.5%
clear-num42.5%
div-inv42.5%
metadata-eval42.5%
sqrt-div42.5%
clear-num42.5%
Applied egg-rr42.5%
associate-*r*42.5%
/-rgt-identity42.5%
associate-/r/42.5%
associate-*l/42.5%
rem-square-sqrt100.0%
Simplified100.0%
Taylor expanded in y around 0 82.5%
if 2.8000000000000002e152 < 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 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around inf 97.0%
unpow297.0%
associate-/l*100.0%
Simplified100.0%
Final simplification87.2%
(FPCore (x y) :precision binary64 (if (<= x 0.000205) (/ (sin y) y) (/ (/ (cosh x) y) (/ 1.0 y))))
double code(double x, double y) {
double tmp;
if (x <= 0.000205) {
tmp = sin(y) / y;
} else {
tmp = (cosh(x) / y) / (1.0 / 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.000205d0) then
tmp = sin(y) / y
else
tmp = (cosh(x) / y) / (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 0.000205) {
tmp = Math.sin(y) / y;
} else {
tmp = (Math.cosh(x) / y) / (1.0 / y);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 0.000205: tmp = math.sin(y) / y else: tmp = (math.cosh(x) / y) / (1.0 / y) return tmp
function code(x, y) tmp = 0.0 if (x <= 0.000205) tmp = Float64(sin(y) / y); else tmp = Float64(Float64(cosh(x) / y) / Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 0.000205) tmp = sin(y) / y; else tmp = (cosh(x) / y) / (1.0 / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 0.000205], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], N[(N[(N[Cosh[x], $MachinePrecision] / y), $MachinePrecision] / N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.000205:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\cosh x}{y}}{\frac{1}{y}}\\
\end{array}
\end{array}
if x < 2.05e-4Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 68.7%
if 2.05e-4 < 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%
clear-num100.0%
associate-*l/100.0%
add-sqr-sqrt42.0%
times-frac42.0%
pow1/297.1%
pow-flip97.1%
metadata-eval97.1%
associate-*r/97.1%
associate-/l*97.1%
metadata-eval97.1%
pow-flip97.1%
pow1/242.0%
metadata-eval42.0%
sqrt-div42.0%
clear-num42.0%
Applied egg-rr42.0%
div-inv42.0%
clear-num42.0%
div-inv42.0%
metadata-eval42.0%
sqrt-div42.0%
clear-num42.0%
Applied egg-rr42.0%
associate-*r*42.0%
/-rgt-identity42.0%
associate-/r/42.0%
associate-*l/42.0%
rem-square-sqrt100.0%
Simplified100.0%
Taylor expanded in y around 0 79.7%
Final simplification71.6%
(FPCore (x y)
:precision binary64
(if (<= x 11.0)
(/ (sin y) y)
(if (or (<= x 2e+173) (not (<= x 6.4e+254)))
(* (* x x) (+ 0.5 (* -0.08333333333333333 (* y y))))
(+ 1.0 (* 0.5 (* x x))))))
double code(double x, double y) {
double tmp;
if (x <= 11.0) {
tmp = sin(y) / y;
} else if ((x <= 2e+173) || !(x <= 6.4e+254)) {
tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y)));
} 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 <= 11.0d0) then
tmp = sin(y) / y
else if ((x <= 2d+173) .or. (.not. (x <= 6.4d+254))) then
tmp = (x * x) * (0.5d0 + ((-0.08333333333333333d0) * (y * y)))
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 <= 11.0) {
tmp = Math.sin(y) / y;
} else if ((x <= 2e+173) || !(x <= 6.4e+254)) {
tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y)));
} else {
tmp = 1.0 + (0.5 * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 11.0: tmp = math.sin(y) / y elif (x <= 2e+173) or not (x <= 6.4e+254): tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y))) else: tmp = 1.0 + (0.5 * (x * x)) return tmp
function code(x, y) tmp = 0.0 if (x <= 11.0) tmp = Float64(sin(y) / y); elseif ((x <= 2e+173) || !(x <= 6.4e+254)) tmp = Float64(Float64(x * x) * Float64(0.5 + Float64(-0.08333333333333333 * Float64(y * y)))); 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 <= 11.0) tmp = sin(y) / y; elseif ((x <= 2e+173) || ~((x <= 6.4e+254))) tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y))); else tmp = 1.0 + (0.5 * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 11.0], N[(N[Sin[y], $MachinePrecision] / y), $MachinePrecision], If[Or[LessEqual[x, 2e+173], N[Not[LessEqual[x, 6.4e+254]], $MachinePrecision]], N[(N[(x * x), $MachinePrecision] * N[(0.5 + N[(-0.08333333333333333 * N[(y * y), $MachinePrecision]), $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 11:\\
\;\;\;\;\frac{\sin y}{y}\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+173} \lor \neg \left(x \leq 6.4 \cdot 10^{+254}\right):\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(0.5 + -0.08333333333333333 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 11Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 68.5%
if 11 < x < 2e173 or 6.3999999999999996e254 < 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 42.1%
unpow242.1%
Simplified42.1%
Taylor expanded in y around 0 13.7%
fma-def13.7%
*-commutative13.7%
unpow213.7%
unpow213.7%
unpow213.7%
Simplified13.7%
Taylor expanded in x around inf 34.5%
*-commutative34.5%
unpow234.5%
unpow234.5%
Simplified34.5%
if 2e173 < x < 6.3999999999999996e254Initial 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 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 78.6%
unpow278.6%
Simplified78.6%
Final simplification62.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.5 (* x x)))))
(if (<= y 5.2e+47)
(/ t_0 (+ 1.0 (* (* y y) 0.16666666666666666)))
(if (<= y 7e+201)
(* (* x x) (+ 0.5 (* -0.08333333333333333 (* y y))))
t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (0.5 * (x * x));
double tmp;
if (y <= 5.2e+47) {
tmp = t_0 / (1.0 + ((y * y) * 0.16666666666666666));
} else if (y <= 7e+201) {
tmp = (x * x) * (0.5 + (-0.08333333333333333 * (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 = 1.0d0 + (0.5d0 * (x * x))
if (y <= 5.2d+47) then
tmp = t_0 / (1.0d0 + ((y * y) * 0.16666666666666666d0))
else if (y <= 7d+201) then
tmp = (x * x) * (0.5d0 + ((-0.08333333333333333d0) * (y * y)))
else
tmp = t_0
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 (y <= 5.2e+47) {
tmp = t_0 / (1.0 + ((y * y) * 0.16666666666666666));
} else if (y <= 7e+201) {
tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.5 * (x * x)) tmp = 0 if y <= 5.2e+47: tmp = t_0 / (1.0 + ((y * y) * 0.16666666666666666)) elif y <= 7e+201: tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.5 * Float64(x * x))) tmp = 0.0 if (y <= 5.2e+47) tmp = Float64(t_0 / Float64(1.0 + Float64(Float64(y * y) * 0.16666666666666666))); elseif (y <= 7e+201) tmp = Float64(Float64(x * x) * Float64(0.5 + Float64(-0.08333333333333333 * Float64(y * y)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.5 * (x * x)); tmp = 0.0; if (y <= 5.2e+47) tmp = t_0 / (1.0 + ((y * y) * 0.16666666666666666)); elseif (y <= 7e+201) tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y))); else tmp = t_0; 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[y, 5.2e+47], N[(t$95$0 / N[(1.0 + N[(N[(y * y), $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7e+201], N[(N[(x * x), $MachinePrecision] * N[(0.5 + N[(-0.08333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;y \leq 5.2 \cdot 10^{+47}:\\
\;\;\;\;\frac{t_0}{1 + \left(y \cdot y\right) \cdot 0.16666666666666666}\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+201}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(0.5 + -0.08333333333333333 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < 5.20000000000000007e47Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 82.0%
unpow282.0%
Simplified82.0%
Taylor expanded in y around inf 75.3%
associate-/l*75.3%
unpow275.3%
Simplified75.3%
Taylor expanded in y around 0 51.0%
unpow251.0%
Simplified51.0%
if 5.20000000000000007e47 < y < 7.0000000000000004e201Initial program 99.8%
*-commutative99.8%
associate-/r/99.8%
Simplified99.8%
clear-num99.7%
associate-/r/99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 68.4%
unpow268.4%
Simplified68.4%
Taylor expanded in y around 0 14.0%
fma-def14.0%
*-commutative14.0%
unpow214.0%
unpow214.0%
unpow214.0%
Simplified14.0%
Taylor expanded in x around inf 31.9%
*-commutative31.9%
unpow231.9%
unpow231.9%
Simplified31.9%
if 7.0000000000000004e201 < y Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
clear-num99.8%
associate-/r/99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 94.2%
unpow294.2%
Simplified94.2%
Taylor expanded in y around 0 24.5%
unpow224.5%
Simplified24.5%
Final simplification45.7%
(FPCore (x y) :precision binary64 (if (or (<= y 5.2e+47) (not (<= y 7e+201))) (+ 1.0 (* 0.5 (* x x))) (* (* x x) (+ 0.5 (* -0.08333333333333333 (* y y))))))
double code(double x, double y) {
double tmp;
if ((y <= 5.2e+47) || !(y <= 7e+201)) {
tmp = 1.0 + (0.5 * (x * x));
} else {
tmp = (x * x) * (0.5 + (-0.08333333333333333 * (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+47) .or. (.not. (y <= 7d+201))) then
tmp = 1.0d0 + (0.5d0 * (x * x))
else
tmp = (x * x) * (0.5d0 + ((-0.08333333333333333d0) * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 5.2e+47) || !(y <= 7e+201)) {
tmp = 1.0 + (0.5 * (x * x));
} else {
tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 5.2e+47) or not (y <= 7e+201): tmp = 1.0 + (0.5 * (x * x)) else: tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if ((y <= 5.2e+47) || !(y <= 7e+201)) tmp = Float64(1.0 + Float64(0.5 * Float64(x * x))); else tmp = Float64(Float64(x * x) * Float64(0.5 + Float64(-0.08333333333333333 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 5.2e+47) || ~((y <= 7e+201))) tmp = 1.0 + (0.5 * (x * x)); else tmp = (x * x) * (0.5 + (-0.08333333333333333 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 5.2e+47], N[Not[LessEqual[y, 7e+201]], $MachinePrecision]], N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(0.5 + N[(-0.08333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.2 \cdot 10^{+47} \lor \neg \left(y \leq 7 \cdot 10^{+201}\right):\\
\;\;\;\;1 + 0.5 \cdot \left(x \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(0.5 + -0.08333333333333333 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 5.20000000000000007e47 or 7.0000000000000004e201 < y Initial program 99.9%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
clear-num99.9%
associate-/r/99.8%
clear-num99.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 83.1%
unpow283.1%
Simplified83.1%
Taylor expanded in y around 0 50.4%
unpow250.4%
Simplified50.4%
if 5.20000000000000007e47 < y < 7.0000000000000004e201Initial program 99.8%
*-commutative99.8%
associate-/r/99.8%
Simplified99.8%
clear-num99.7%
associate-/r/99.7%
clear-num99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 68.4%
unpow268.4%
Simplified68.4%
Taylor expanded in y around 0 14.0%
fma-def14.0%
*-commutative14.0%
unpow214.0%
unpow214.0%
unpow214.0%
Simplified14.0%
Taylor expanded in x around inf 31.9%
*-commutative31.9%
unpow231.9%
unpow231.9%
Simplified31.9%
Final simplification47.1%
(FPCore (x y) :precision binary64 (+ 1.0 (* 0.5 (* x x))))
double code(double x, double y) {
return 1.0 + (0.5 * (x * x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + (0.5d0 * (x * x))
end function
public static double code(double x, double y) {
return 1.0 + (0.5 * (x * x));
}
def code(x, y): return 1.0 + (0.5 * (x * x))
function code(x, y) return Float64(1.0 + Float64(0.5 * Float64(x * x))) end
function tmp = code(x, y) tmp = 1.0 + (0.5 * (x * x)); end
code[x_, y_] := N[(1.0 + N[(0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.5 \cdot \left(x \cdot x\right)
\end{array}
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 80.4%
unpow280.4%
Simplified80.4%
Taylor expanded in y around 0 42.6%
unpow242.6%
Simplified42.6%
Final simplification42.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%
*-commutative99.9%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 51.3%
Taylor expanded in y around 0 24.0%
Final simplification24.0%
(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 2023274
(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)))