
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin 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 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (/ (sin x) (/ y (sinh y))))
double code(double x, double y) {
return sin(x) / (y / sinh(y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) / (y / sinh(y))
end function
public static double code(double x, double y) {
return Math.sin(x) / (y / Math.sinh(y));
}
def code(x, y): return math.sin(x) / (y / math.sinh(y))
function code(x, y) return Float64(sin(x) / Float64(y / sinh(y))) end
function tmp = code(x, y) tmp = sin(x) / (y / sinh(y)); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] / N[(y / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin x}{\frac{y}{\sinh y}}
\end{array}
Initial program 100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (let* ((t_0 (/ (sinh y) y))) (if (<= t_0 2.0) (sin x) (* x t_0))))
double code(double x, double y) {
double t_0 = sinh(y) / y;
double tmp;
if (t_0 <= 2.0) {
tmp = sin(x);
} else {
tmp = 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 = sinh(y) / y
if (t_0 <= 2.0d0) then
tmp = sin(x)
else
tmp = x * 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.sin(x);
} else {
tmp = x * t_0;
}
return tmp;
}
def code(x, y): t_0 = math.sinh(y) / y tmp = 0 if t_0 <= 2.0: tmp = math.sin(x) else: tmp = x * t_0 return tmp
function code(x, y) t_0 = Float64(sinh(y) / y) tmp = 0.0 if (t_0 <= 2.0) tmp = sin(x); else tmp = Float64(x * 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 = sin(x); else tmp = x * 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[Sin[x], $MachinePrecision], N[(x * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sinh y}{y}\\
\mathbf{if}\;t_0 \leq 2:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;x \cdot t_0\\
\end{array}
\end{array}
if (/.f64 (sinh.f64 y) y) < 2Initial program 99.9%
Taylor expanded in y around 0 98.7%
if 2 < (/.f64 (sinh.f64 y) y) Initial program 100.0%
Taylor expanded in x around 0 81.4%
Final simplification90.3%
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin 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 1.6e+149))) (* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y)))) (/ x (/ y (sinh y)))))
double code(double x, double y) {
double tmp;
if ((y <= 0.29) || !(y <= 1.6e+149)) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = x / (y / sinh(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 <= 1.6d+149))) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else
tmp = x / (y / sinh(y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 0.29) || !(y <= 1.6e+149)) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = x / (y / Math.sinh(y));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 0.29) or not (y <= 1.6e+149): tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) else: tmp = x / (y / math.sinh(y)) return tmp
function code(x, y) tmp = 0.0 if ((y <= 0.29) || !(y <= 1.6e+149)) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(x / Float64(y / sinh(y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 0.29) || ~((y <= 1.6e+149))) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); else tmp = x / (y / sinh(y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 0.29], N[Not[LessEqual[y, 1.6e+149]], $MachinePrecision]], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.29 \lor \neg \left(y \leq 1.6 \cdot 10^{+149}\right):\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{\sinh y}}\\
\end{array}
\end{array}
if y < 0.28999999999999998 or 1.6000000000000001e149 < y Initial program 100.0%
Taylor expanded in y around 0 87.0%
unpow287.0%
Simplified87.0%
if 0.28999999999999998 < y < 1.6000000000000001e149Initial program 100.0%
Taylor expanded in x around 0 74.3%
clear-num74.3%
un-div-inv74.3%
Applied egg-rr74.3%
Final simplification85.3%
(FPCore (x y)
:precision binary64
(if (<= y 0.29)
(sin x)
(if (<= y 1.6e+149)
(/ x (/ y (sinh y)))
(* (sin x) (* y (* y 0.16666666666666666))))))
double code(double x, double y) {
double tmp;
if (y <= 0.29) {
tmp = sin(x);
} else if (y <= 1.6e+149) {
tmp = x / (y / sinh(y));
} else {
tmp = sin(x) * (y * (y * 0.16666666666666666));
}
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 = sin(x)
else if (y <= 1.6d+149) then
tmp = x / (y / sinh(y))
else
tmp = sin(x) * (y * (y * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.29) {
tmp = Math.sin(x);
} else if (y <= 1.6e+149) {
tmp = x / (y / Math.sinh(y));
} else {
tmp = Math.sin(x) * (y * (y * 0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.29: tmp = math.sin(x) elif y <= 1.6e+149: tmp = x / (y / math.sinh(y)) else: tmp = math.sin(x) * (y * (y * 0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.29) tmp = sin(x); elseif (y <= 1.6e+149) tmp = Float64(x / Float64(y / sinh(y))); else tmp = Float64(sin(x) * Float64(y * Float64(y * 0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.29) tmp = sin(x); elseif (y <= 1.6e+149) tmp = x / (y / sinh(y)); else tmp = sin(x) * (y * (y * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.29], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.6e+149], N[(x / N[(y / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.29:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+149}:\\
\;\;\;\;\frac{x}{\frac{y}{\sinh y}}\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 0.28999999999999998Initial program 99.9%
Taylor expanded in y around 0 69.0%
if 0.28999999999999998 < y < 1.6000000000000001e149Initial program 100.0%
Taylor expanded in x around 0 74.3%
clear-num74.3%
un-div-inv74.3%
Applied egg-rr74.3%
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%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification73.4%
(FPCore (x y) :precision binary64 (if (<= y 0.29) (sin x) (/ x (/ y (sinh y)))))
double code(double x, double y) {
double tmp;
if (y <= 0.29) {
tmp = sin(x);
} else {
tmp = x / (y / sinh(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 = sin(x)
else
tmp = x / (y / sinh(y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.29) {
tmp = Math.sin(x);
} else {
tmp = x / (y / Math.sinh(y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.29: tmp = math.sin(x) else: tmp = x / (y / math.sinh(y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.29) tmp = sin(x); else tmp = Float64(x / Float64(y / sinh(y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.29) tmp = sin(x); else tmp = x / (y / sinh(y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.29], N[Sin[x], $MachinePrecision], N[(x / N[(y / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.29:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{y}{\sinh y}}\\
\end{array}
\end{array}
if y < 0.28999999999999998Initial program 99.9%
Taylor expanded in y around 0 69.0%
if 0.28999999999999998 < y Initial program 100.0%
Taylor expanded in x around 0 80.0%
clear-num80.0%
un-div-inv80.0%
Applied egg-rr80.0%
Final simplification71.8%
(FPCore (x y)
:precision binary64
(if (<= y 2.3e+50)
(sin x)
(if (<= y 4.5e+153)
(+ x (* x (* y (* y -0.16666666666666666))))
(* x (+ 1.0 (* 0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (y <= 2.3e+50) {
tmp = sin(x);
} else if (y <= 4.5e+153) {
tmp = x + (x * (y * (y * -0.16666666666666666)));
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.3d+50) then
tmp = sin(x)
else if (y <= 4.5d+153) then
tmp = x + (x * (y * (y * (-0.16666666666666666d0))))
else
tmp = x * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.3e+50) {
tmp = Math.sin(x);
} else if (y <= 4.5e+153) {
tmp = x + (x * (y * (y * -0.16666666666666666)));
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.3e+50: tmp = math.sin(x) elif y <= 4.5e+153: tmp = x + (x * (y * (y * -0.16666666666666666))) else: tmp = x * (1.0 + (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.3e+50) tmp = sin(x); elseif (y <= 4.5e+153) tmp = Float64(x + Float64(x * Float64(y * Float64(y * -0.16666666666666666)))); else tmp = Float64(x * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.3e+50) tmp = sin(x); elseif (y <= 4.5e+153) tmp = x + (x * (y * (y * -0.16666666666666666))); else tmp = x * (1.0 + (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.3e+50], N[Sin[x], $MachinePrecision], If[LessEqual[y, 4.5e+153], N[(x + N[(x * N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{+50}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+153}:\\
\;\;\;\;x + x \cdot \left(y \cdot \left(y \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 2.29999999999999997e50Initial program 99.9%
Taylor expanded in y around 0 64.5%
if 2.29999999999999997e50 < y < 4.5000000000000001e153Initial program 100.0%
Taylor expanded in y around 0 4.4%
unpow24.4%
Simplified4.4%
Taylor expanded in x around 0 11.5%
+-commutative11.5%
distribute-lft-in11.5%
add-sqr-sqrt11.5%
sqrt-unprod43.6%
swap-sqr43.6%
metadata-eval43.6%
metadata-eval43.6%
swap-sqr43.6%
associate-*l*43.6%
associate-*l*43.6%
sqrt-unprod0.0%
add-sqr-sqrt25.1%
*-commutative25.1%
*-commutative25.1%
*-rgt-identity25.1%
Applied egg-rr25.1%
if 4.5000000000000001e153 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 86.7%
Final simplification63.9%
(FPCore (x y) :precision binary64 (if (<= y 1.15e+151) (+ x (* x (* y (* y -0.16666666666666666)))) (* x (+ 1.0 (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 1.15e+151) {
tmp = x + (x * (y * (y * -0.16666666666666666)));
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.15d+151) then
tmp = x + (x * (y * (y * (-0.16666666666666666d0))))
else
tmp = x * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.15e+151) {
tmp = x + (x * (y * (y * -0.16666666666666666)));
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.15e+151: tmp = x + (x * (y * (y * -0.16666666666666666))) else: tmp = x * (1.0 + (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.15e+151) tmp = Float64(x + Float64(x * Float64(y * Float64(y * -0.16666666666666666)))); else tmp = Float64(x * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.15e+151) tmp = x + (x * (y * (y * -0.16666666666666666))); else tmp = x * (1.0 + (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.15e+151], N[(x + N[(x * N[(y * N[(y * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{+151}:\\
\;\;\;\;x + x \cdot \left(y \cdot \left(y \cdot -0.16666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 1.15e151Initial program 100.0%
Taylor expanded in y around 0 72.4%
unpow272.4%
Simplified72.4%
Taylor expanded in x around 0 43.3%
+-commutative43.3%
distribute-lft-in43.3%
add-sqr-sqrt43.3%
sqrt-unprod52.2%
swap-sqr52.2%
metadata-eval52.2%
metadata-eval52.2%
swap-sqr52.2%
associate-*l*52.2%
associate-*l*52.2%
sqrt-unprod12.2%
add-sqr-sqrt37.5%
*-commutative37.5%
*-commutative37.5%
*-rgt-identity37.5%
Applied egg-rr37.5%
if 1.15e151 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 86.7%
Final simplification43.2%
(FPCore (x y) :precision binary64 (if (<= y 1.42e-8) x (* 0.16666666666666666 (* x (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 1.42e-8) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (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 <= 1.42d-8) then
tmp = x
else
tmp = 0.16666666666666666d0 * (x * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.42e-8) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.42e-8: tmp = x else: tmp = 0.16666666666666666 * (x * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.42e-8) tmp = x; else tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.42e-8) tmp = x; else tmp = 0.16666666666666666 * (x * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.42e-8], x, N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.42 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 1.41999999999999998e-8Initial program 100.0%
Taylor expanded in x around 0 63.1%
Taylor expanded in y around 0 37.6%
if 1.41999999999999998e-8 < y Initial program 99.9%
Taylor expanded in y around 0 50.6%
unpow250.6%
Simplified50.6%
Taylor expanded in x around 0 42.1%
Taylor expanded in y around inf 42.1%
*-commutative42.1%
unpow242.1%
Simplified42.1%
Final simplification38.8%
(FPCore (x y) :precision binary64 (if (<= y 1.42e-8) x (* x (* y (* y 0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if (y <= 1.42e-8) {
tmp = x;
} else {
tmp = x * (y * (y * 0.16666666666666666));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.42d-8) then
tmp = x
else
tmp = x * (y * (y * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.42e-8) {
tmp = x;
} else {
tmp = x * (y * (y * 0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.42e-8: tmp = x else: tmp = x * (y * (y * 0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.42e-8) tmp = x; else tmp = Float64(x * Float64(y * Float64(y * 0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.42e-8) tmp = x; else tmp = x * (y * (y * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.42e-8], x, N[(x * N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.42 \cdot 10^{-8}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 1.41999999999999998e-8Initial program 100.0%
Taylor expanded in x around 0 63.1%
Taylor expanded in y around 0 37.6%
if 1.41999999999999998e-8 < y Initial program 99.9%
Taylor expanded in y around 0 50.6%
unpow250.6%
Simplified50.6%
Taylor expanded in x around 0 42.1%
Taylor expanded in y around inf 42.1%
*-commutative42.1%
*-commutative42.1%
associate-*l*42.1%
unpow242.1%
associate-*l*42.1%
Simplified42.1%
Final simplification38.8%
(FPCore (x y) :precision binary64 (* x (+ 1.0 (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
return x * (1.0 + (0.16666666666666666 * (y * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end function
public static double code(double x, double y) {
return x * (1.0 + (0.16666666666666666 * (y * y)));
}
def code(x, y): return x * (1.0 + (0.16666666666666666 * (y * y)))
function code(x, y) return Float64(x * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))) end
function tmp = code(x, y) tmp = x * (1.0 + (0.16666666666666666 * (y * y))); end
code[x_, y_] := N[(x * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 75.7%
unpow275.7%
Simplified75.7%
Taylor expanded in x around 0 48.4%
Final simplification48.4%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in x around 0 66.4%
Taylor expanded in y around 0 28.1%
Final simplification28.1%
herbie shell --seed 2023238
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))