
(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 11 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) (/ (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 190.0) (not (<= y 1.9e+153))) (* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y)))) (/ (sinh y) (/ y x))))
double code(double x, double y) {
double tmp;
if ((y <= 190.0) || !(y <= 1.9e+153)) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = sinh(y) / (y / x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= 190.0d0) .or. (.not. (y <= 1.9d+153))) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else
tmp = sinh(y) / (y / x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 190.0) || !(y <= 1.9e+153)) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = Math.sinh(y) / (y / x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 190.0) or not (y <= 1.9e+153): tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) else: tmp = math.sinh(y) / (y / x) return tmp
function code(x, y) tmp = 0.0 if ((y <= 190.0) || !(y <= 1.9e+153)) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(sinh(y) / Float64(y / x)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 190.0) || ~((y <= 1.9e+153))) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); else tmp = sinh(y) / (y / x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 190.0], N[Not[LessEqual[y, 1.9e+153]], $MachinePrecision]], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sinh[y], $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 190 \lor \neg \left(y \leq 1.9 \cdot 10^{+153}\right):\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sinh y}{\frac{y}{x}}\\
\end{array}
\end{array}
if y < 190 or 1.89999999999999983e153 < y Initial program 100.0%
Taylor expanded in y around 0 86.8%
unpow286.8%
Simplified86.8%
if 190 < y < 1.89999999999999983e153Initial program 100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
unpow3100.0%
add-cube-cbrt100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*85.2%
Applied egg-rr85.2%
Taylor expanded in x around 0 59.3%
Final simplification83.9%
(FPCore (x y)
:precision binary64
(if (<= y 190.0)
(sin x)
(if (<= y 1.9e+153)
(/ (sinh y) (/ y x))
(* 0.16666666666666666 (* y (* (sin x) y))))))
double code(double x, double y) {
double tmp;
if (y <= 190.0) {
tmp = sin(x);
} else if (y <= 1.9e+153) {
tmp = sinh(y) / (y / x);
} else {
tmp = 0.16666666666666666 * (y * (sin(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 <= 190.0d0) then
tmp = sin(x)
else if (y <= 1.9d+153) then
tmp = sinh(y) / (y / x)
else
tmp = 0.16666666666666666d0 * (y * (sin(x) * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 190.0) {
tmp = Math.sin(x);
} else if (y <= 1.9e+153) {
tmp = Math.sinh(y) / (y / x);
} else {
tmp = 0.16666666666666666 * (y * (Math.sin(x) * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 190.0: tmp = math.sin(x) elif y <= 1.9e+153: tmp = math.sinh(y) / (y / x) else: tmp = 0.16666666666666666 * (y * (math.sin(x) * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 190.0) tmp = sin(x); elseif (y <= 1.9e+153) tmp = Float64(sinh(y) / Float64(y / x)); else tmp = Float64(0.16666666666666666 * Float64(y * Float64(sin(x) * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 190.0) tmp = sin(x); elseif (y <= 1.9e+153) tmp = sinh(y) / (y / x); else tmp = 0.16666666666666666 * (y * (sin(x) * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 190.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.9e+153], N[(N[Sinh[y], $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Sin[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 190:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;\frac{\sinh y}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\sin x \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 190Initial program 100.0%
Taylor expanded in y around 0 69.8%
if 190 < y < 1.89999999999999983e153Initial program 100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
unpow3100.0%
add-cube-cbrt100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*85.2%
Applied egg-rr85.2%
Taylor expanded in x around 0 59.3%
if 1.89999999999999983e153 < 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-*l*78.0%
Simplified78.0%
Final simplification69.8%
(FPCore (x y)
:precision binary64
(if (<= y 190.0)
(sin x)
(if (<= y 1.9e+153)
(/ (sinh y) (/ y x))
(* 0.16666666666666666 (* (sin x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 190.0) {
tmp = sin(x);
} else if (y <= 1.9e+153) {
tmp = sinh(y) / (y / x);
} else {
tmp = 0.16666666666666666 * (sin(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 <= 190.0d0) then
tmp = sin(x)
else if (y <= 1.9d+153) then
tmp = sinh(y) / (y / x)
else
tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 190.0) {
tmp = Math.sin(x);
} else if (y <= 1.9e+153) {
tmp = Math.sinh(y) / (y / x);
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 190.0: tmp = math.sin(x) elif y <= 1.9e+153: tmp = math.sinh(y) / (y / x) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 190.0) tmp = sin(x); elseif (y <= 1.9e+153) tmp = Float64(sinh(y) / Float64(y / x)); else tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 190.0) tmp = sin(x); elseif (y <= 1.9e+153) tmp = sinh(y) / (y / x); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 190.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.9e+153], N[(N[Sinh[y], $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 190:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;\frac{\sinh y}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 190Initial program 100.0%
Taylor expanded in y around 0 69.8%
if 190 < y < 1.89999999999999983e153Initial program 100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
unpow3100.0%
add-cube-cbrt100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*85.2%
Applied egg-rr85.2%
Taylor expanded in x around 0 59.3%
if 1.89999999999999983e153 < 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%
Simplified100.0%
Final simplification72.7%
(FPCore (x y)
:precision binary64
(if (<= y 190.0)
(sin x)
(if (<= y 2.6e+151)
(/ (sinh y) (/ y x))
(+ x (* x (* 0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (y <= 190.0) {
tmp = sin(x);
} else if (y <= 2.6e+151) {
tmp = sinh(y) / (y / x);
} else {
tmp = x + (x * (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 <= 190.0d0) then
tmp = sin(x)
else if (y <= 2.6d+151) then
tmp = sinh(y) / (y / x)
else
tmp = x + (x * (0.16666666666666666d0 * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 190.0) {
tmp = Math.sin(x);
} else if (y <= 2.6e+151) {
tmp = Math.sinh(y) / (y / x);
} else {
tmp = x + (x * (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 190.0: tmp = math.sin(x) elif y <= 2.6e+151: tmp = math.sinh(y) / (y / x) else: tmp = x + (x * (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 190.0) tmp = sin(x); elseif (y <= 2.6e+151) tmp = Float64(sinh(y) / Float64(y / x)); else tmp = Float64(x + Float64(x * Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 190.0) tmp = sin(x); elseif (y <= 2.6e+151) tmp = sinh(y) / (y / x); else tmp = x + (x * (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 190.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 2.6e+151], N[(N[Sinh[y], $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 190:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+151}:\\
\;\;\;\;\frac{\sinh y}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 190Initial program 100.0%
Taylor expanded in y around 0 69.8%
if 190 < y < 2.60000000000000013e151Initial program 100.0%
add-cube-cbrt100.0%
pow3100.0%
Applied egg-rr100.0%
unpow3100.0%
add-cube-cbrt100.0%
associate-*r/100.0%
*-commutative100.0%
associate-/l*84.6%
Applied egg-rr84.6%
Taylor expanded in x around 0 57.7%
if 2.60000000000000013e151 < y Initial program 100.0%
Taylor expanded in y around 0 97.5%
unpow297.5%
Simplified97.5%
Taylor expanded in x around 0 74.3%
+-commutative74.3%
unpow274.3%
fma-udef74.3%
Simplified74.3%
*-commutative74.3%
fma-udef74.3%
distribute-rgt-in74.3%
*-un-lft-identity74.3%
Applied egg-rr74.3%
Final simplification69.2%
(FPCore (x y) :precision binary64 (if (<= y 3.7e+71) (sin x) (+ x (* x (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 3.7e+71) {
tmp = sin(x);
} else {
tmp = x + (x * (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 <= 3.7d+71) then
tmp = sin(x)
else
tmp = x + (x * (0.16666666666666666d0 * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3.7e+71) {
tmp = Math.sin(x);
} else {
tmp = x + (x * (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3.7e+71: tmp = math.sin(x) else: tmp = x + (x * (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 3.7e+71) tmp = sin(x); else tmp = Float64(x + Float64(x * Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.7e+71) tmp = sin(x); else tmp = x + (x * (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3.7e+71], N[Sin[x], $MachinePrecision], N[(x + N[(x * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.7 \cdot 10^{+71}:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 3.7e71Initial program 100.0%
Taylor expanded in y around 0 65.3%
if 3.7e71 < y Initial program 100.0%
Taylor expanded in y around 0 73.9%
unpow273.9%
Simplified73.9%
Taylor expanded in x around 0 60.3%
+-commutative60.3%
unpow260.3%
fma-udef60.3%
Simplified60.3%
*-commutative60.3%
fma-udef60.3%
distribute-rgt-in60.3%
*-un-lft-identity60.3%
Applied egg-rr60.3%
Final simplification64.4%
(FPCore (x y) :precision binary64 (if (<= y 4.9e-6) x (* 0.16666666666666666 (* y (* x y)))))
double code(double x, double y) {
double tmp;
if (y <= 4.9e-6) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (y * (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 <= 4.9d-6) then
tmp = x
else
tmp = 0.16666666666666666d0 * (y * (x * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 4.9e-6) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (y * (x * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4.9e-6: tmp = x else: tmp = 0.16666666666666666 * (y * (x * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 4.9e-6) tmp = x; else tmp = Float64(0.16666666666666666 * Float64(y * Float64(x * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 4.9e-6) tmp = x; else tmp = 0.16666666666666666 * (y * (x * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 4.9e-6], x, N[(0.16666666666666666 * N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.9 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(x \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 4.89999999999999967e-6Initial program 100.0%
Taylor expanded in y around 0 84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in x around 0 52.8%
+-commutative52.8%
unpow252.8%
fma-udef52.8%
Simplified52.8%
Taylor expanded in y around 0 40.6%
if 4.89999999999999967e-6 < y Initial program 100.0%
Taylor expanded in y around 0 58.3%
unpow258.3%
Simplified58.3%
Taylor expanded in y around inf 56.9%
unpow256.9%
associate-*l*44.8%
Simplified44.8%
Taylor expanded in x around 0 34.2%
Final simplification39.1%
(FPCore (x y) :precision binary64 (if (<= y 4.9e-6) x (* 0.16666666666666666 (* x (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 4.9e-6) {
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 <= 4.9d-6) 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 <= 4.9e-6) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4.9e-6: tmp = x else: tmp = 0.16666666666666666 * (x * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 4.9e-6) 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 <= 4.9e-6) tmp = x; else tmp = 0.16666666666666666 * (x * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 4.9e-6], x, N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.9 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 4.89999999999999967e-6Initial program 100.0%
Taylor expanded in y around 0 84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in x around 0 52.8%
+-commutative52.8%
unpow252.8%
fma-udef52.8%
Simplified52.8%
Taylor expanded in y around 0 40.6%
if 4.89999999999999967e-6 < y Initial program 100.0%
Taylor expanded in y around 0 58.3%
unpow258.3%
Simplified58.3%
Taylor expanded in y around inf 56.9%
unpow256.9%
associate-*l*44.8%
Simplified44.8%
Taylor expanded in x around 0 46.3%
unpow246.3%
Simplified46.3%
Final simplification42.0%
(FPCore (x y) :precision binary64 (if (<= y 4.9e-6) x (* x (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 4.9e-6) {
tmp = x;
} else {
tmp = x * (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 <= 4.9d-6) then
tmp = x
else
tmp = x * (0.16666666666666666d0 * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 4.9e-6) {
tmp = x;
} else {
tmp = x * (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4.9e-6: tmp = x else: tmp = x * (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 4.9e-6) tmp = x; else tmp = Float64(x * Float64(0.16666666666666666 * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 4.9e-6) tmp = x; else tmp = x * (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 4.9e-6], x, N[(x * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.9 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 4.89999999999999967e-6Initial program 100.0%
Taylor expanded in y around 0 84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in x around 0 52.8%
+-commutative52.8%
unpow252.8%
fma-udef52.8%
Simplified52.8%
Taylor expanded in y around 0 40.6%
if 4.89999999999999967e-6 < y Initial program 100.0%
Taylor expanded in y around 0 58.3%
unpow258.3%
Simplified58.3%
Taylor expanded in x around 0 46.3%
+-commutative46.3%
unpow246.3%
fma-udef46.3%
Simplified46.3%
Taylor expanded in y around inf 46.3%
unpow246.3%
Simplified46.3%
Final simplification42.0%
(FPCore (x y) :precision binary64 (+ x (* x (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
return x + (x * (0.16666666666666666 * (y * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (x * (0.16666666666666666d0 * (y * y)))
end function
public static double code(double x, double y) {
return x + (x * (0.16666666666666666 * (y * y)));
}
def code(x, y): return x + (x * (0.16666666666666666 * (y * y)))
function code(x, y) return Float64(x + Float64(x * Float64(0.16666666666666666 * Float64(y * y)))) end
function tmp = code(x, y) tmp = x + (x * (0.16666666666666666 * (y * y))); end
code[x_, y_] := N[(x + N[(x * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 78.0%
unpow278.0%
Simplified78.0%
Taylor expanded in x around 0 51.2%
+-commutative51.2%
unpow251.2%
fma-udef51.2%
Simplified51.2%
*-commutative51.2%
fma-udef51.2%
distribute-rgt-in51.2%
*-un-lft-identity51.2%
Applied egg-rr51.2%
Final simplification51.2%
(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 y around 0 78.0%
unpow278.0%
Simplified78.0%
Taylor expanded in x around 0 51.2%
+-commutative51.2%
unpow251.2%
fma-udef51.2%
Simplified51.2%
Taylor expanded in y around 0 31.4%
Final simplification31.4%
herbie shell --seed 2023242
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))