
(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) (pow (/ y (sinh y)) -1.0)))
double code(double x, double y) {
return sin(x) * pow((y / sinh(y)), -1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * ((y / sinh(y)) ** (-1.0d0))
end function
public static double code(double x, double y) {
return Math.sin(x) * Math.pow((y / Math.sinh(y)), -1.0);
}
def code(x, y): return math.sin(x) * math.pow((y / math.sinh(y)), -1.0)
function code(x, y) return Float64(sin(x) * (Float64(y / sinh(y)) ^ -1.0)) end
function tmp = code(x, y) tmp = sin(x) * ((y / sinh(y)) ^ -1.0); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[Power[N[(y / N[Sinh[y], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot {\left(\frac{y}{\sinh y}\right)}^{-1}
\end{array}
Initial program 100.0%
clear-num100.0%
inv-pow100.0%
Applied egg-rr100.0%
Final simplification100.0%
(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.36) (not (<= y 8e+152))) (* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y)))) (/ (sinh y) (/ y x))))
double code(double x, double y) {
double tmp;
if ((y <= 0.36) || !(y <= 8e+152)) {
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 <= 0.36d0) .or. (.not. (y <= 8d+152))) 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 <= 0.36) || !(y <= 8e+152)) {
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 <= 0.36) or not (y <= 8e+152): 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 <= 0.36) || !(y <= 8e+152)) 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 <= 0.36) || ~((y <= 8e+152))) 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, 0.36], N[Not[LessEqual[y, 8e+152]], $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 0.36 \lor \neg \left(y \leq 8 \cdot 10^{+152}\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 < 0.35999999999999999 or 8.0000000000000004e152 < y Initial program 100.0%
Taylor expanded in y around 0 86.6%
unpow286.6%
Simplified86.6%
if 0.35999999999999999 < y < 8.0000000000000004e152Initial program 100.0%
clear-num100.0%
inv-pow100.0%
Applied egg-rr100.0%
*-commutative100.0%
unpow-1100.0%
clear-num100.0%
associate-/r/89.7%
Applied egg-rr89.7%
Taylor expanded in x around 0 62.1%
Final simplification83.9%
(FPCore (x y)
:precision binary64
(if (<= y 0.0015)
(sin x)
(if (<= y 8e+152)
(/ (sinh y) (/ y x))
(* (sin x) (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 0.0015) {
tmp = sin(x);
} else if (y <= 8e+152) {
tmp = sinh(y) / (y / x);
} else {
tmp = sin(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 <= 0.0015d0) then
tmp = sin(x)
else if (y <= 8d+152) then
tmp = sinh(y) / (y / x)
else
tmp = sin(x) * (0.16666666666666666d0 * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.0015) {
tmp = Math.sin(x);
} else if (y <= 8e+152) {
tmp = Math.sinh(y) / (y / x);
} else {
tmp = Math.sin(x) * (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.0015: tmp = math.sin(x) elif y <= 8e+152: tmp = math.sinh(y) / (y / x) else: tmp = math.sin(x) * (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.0015) tmp = sin(x); elseif (y <= 8e+152) tmp = Float64(sinh(y) / Float64(y / x)); else tmp = Float64(sin(x) * Float64(0.16666666666666666 * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.0015) tmp = sin(x); elseif (y <= 8e+152) tmp = sinh(y) / (y / x); else tmp = sin(x) * (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.0015], N[Sin[x], $MachinePrecision], If[LessEqual[y, 8e+152], N[(N[Sinh[y], $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.0015:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+152}:\\
\;\;\;\;\frac{\sinh y}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.0015Initial program 100.0%
Taylor expanded in y around 0 67.1%
if 0.0015 < y < 8.0000000000000004e152Initial program 100.0%
clear-num100.0%
inv-pow100.0%
Applied egg-rr100.0%
*-commutative100.0%
unpow-1100.0%
clear-num100.0%
associate-/r/90.3%
Applied egg-rr90.3%
Taylor expanded in x around 0 61.3%
if 8.0000000000000004e152 < y Initial program 100.0%
Taylor expanded in y around 0 96.6%
unpow296.6%
Simplified96.6%
Taylor expanded in y around inf 96.6%
unpow296.6%
associate-*r*96.6%
Simplified96.6%
Final simplification69.6%
(FPCore (x y)
:precision binary64
(if (<= y 0.00135)
(sin x)
(if (<= y 4.1e+152)
(/ (sinh y) (/ y x))
(+ x (* x (* 0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (y <= 0.00135) {
tmp = sin(x);
} else if (y <= 4.1e+152) {
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 <= 0.00135d0) then
tmp = sin(x)
else if (y <= 4.1d+152) 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 <= 0.00135) {
tmp = Math.sin(x);
} else if (y <= 4.1e+152) {
tmp = Math.sinh(y) / (y / x);
} else {
tmp = x + (x * (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.00135: tmp = math.sin(x) elif y <= 4.1e+152: 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 <= 0.00135) tmp = sin(x); elseif (y <= 4.1e+152) 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 <= 0.00135) tmp = sin(x); elseif (y <= 4.1e+152) tmp = sinh(y) / (y / x); else tmp = x + (x * (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.00135], N[Sin[x], $MachinePrecision], If[LessEqual[y, 4.1e+152], 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 0.00135:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{+152}:\\
\;\;\;\;\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 < 0.0013500000000000001Initial program 100.0%
Taylor expanded in y around 0 67.1%
if 0.0013500000000000001 < y < 4.0999999999999998e152Initial program 100.0%
clear-num100.0%
inv-pow100.0%
Applied egg-rr100.0%
*-commutative100.0%
unpow-1100.0%
clear-num100.0%
associate-/r/90.3%
Applied egg-rr90.3%
Taylor expanded in x around 0 61.3%
if 4.0999999999999998e152 < y Initial program 100.0%
Taylor expanded in y around 0 96.6%
unpow296.6%
Simplified96.6%
Taylor expanded in x around 0 60.8%
+-commutative60.8%
unpow260.8%
fma-udef60.8%
Simplified60.8%
*-commutative60.8%
fma-udef60.8%
distribute-rgt-in60.8%
*-un-lft-identity60.8%
Applied egg-rr60.8%
Final simplification65.7%
(FPCore (x y)
:precision binary64
(if (<= y 13000.0)
(sin x)
(if (<= y 1.2e+96)
(* -0.16666666666666666 (pow x 3.0))
(+ x (* x (* 0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (y <= 13000.0) {
tmp = sin(x);
} else if (y <= 1.2e+96) {
tmp = -0.16666666666666666 * pow(x, 3.0);
} 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 <= 13000.0d0) then
tmp = sin(x)
else if (y <= 1.2d+96) then
tmp = (-0.16666666666666666d0) * (x ** 3.0d0)
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 <= 13000.0) {
tmp = Math.sin(x);
} else if (y <= 1.2e+96) {
tmp = -0.16666666666666666 * Math.pow(x, 3.0);
} else {
tmp = x + (x * (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 13000.0: tmp = math.sin(x) elif y <= 1.2e+96: tmp = -0.16666666666666666 * math.pow(x, 3.0) else: tmp = x + (x * (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 13000.0) tmp = sin(x); elseif (y <= 1.2e+96) tmp = Float64(-0.16666666666666666 * (x ^ 3.0)); 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 <= 13000.0) tmp = sin(x); elseif (y <= 1.2e+96) tmp = -0.16666666666666666 * (x ^ 3.0); else tmp = x + (x * (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 13000.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.2e+96], N[(-0.16666666666666666 * N[Power[x, 3.0], $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 13000:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+96}:\\
\;\;\;\;-0.16666666666666666 \cdot {x}^{3}\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 13000Initial program 100.0%
Taylor expanded in y around 0 66.8%
if 13000 < y < 1.19999999999999996e96Initial program 100.0%
*-commutative100.0%
associate-*l/100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 20.9%
Taylor expanded in x around inf 20.4%
if 1.19999999999999996e96 < y Initial program 100.0%
Taylor expanded in y around 0 76.2%
unpow276.2%
Simplified76.2%
Taylor expanded in x around 0 50.5%
+-commutative50.5%
unpow250.5%
fma-udef50.5%
Simplified50.5%
*-commutative50.5%
fma-udef50.5%
distribute-rgt-in50.5%
*-un-lft-identity50.5%
Applied egg-rr50.5%
Final simplification60.7%
(FPCore (x y) :precision binary64 (if (<= y 0.00048) (sin x) (+ x (* x (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 0.00048) {
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 <= 0.00048d0) 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 <= 0.00048) {
tmp = Math.sin(x);
} else {
tmp = x + (x * (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.00048: tmp = math.sin(x) else: tmp = x + (x * (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.00048) 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 <= 0.00048) tmp = sin(x); else tmp = x + (x * (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.00048], 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 0.00048:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 4.80000000000000012e-4Initial program 100.0%
Taylor expanded in y around 0 67.1%
if 4.80000000000000012e-4 < y Initial program 100.0%
Taylor expanded in y around 0 50.1%
unpow250.1%
Simplified50.1%
Taylor expanded in x around 0 34.9%
+-commutative34.9%
unpow234.9%
fma-udef34.9%
Simplified34.9%
*-commutative34.9%
fma-udef34.9%
distribute-rgt-in34.9%
*-un-lft-identity34.9%
Applied egg-rr34.9%
Final simplification59.7%
(FPCore (x y) :precision binary64 (if (<= y 480.0) x (* 0.16666666666666666 (* y (* x y)))))
double code(double x, double y) {
double tmp;
if (y <= 480.0) {
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 <= 480.0d0) 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 <= 480.0) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (y * (x * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 480.0: tmp = x else: tmp = 0.16666666666666666 * (y * (x * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 480.0) 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 <= 480.0) tmp = x; else tmp = 0.16666666666666666 * (y * (x * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 480.0], x, N[(0.16666666666666666 * N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 480:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(x \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 480Initial program 100.0%
Taylor expanded in y around 0 85.3%
unpow285.3%
Simplified85.3%
Taylor expanded in x around 0 52.7%
+-commutative52.7%
unpow252.7%
fma-udef52.7%
Simplified52.7%
Taylor expanded in y around 0 36.0%
if 480 < y Initial program 100.0%
Taylor expanded in y around 0 49.4%
unpow249.4%
Simplified49.4%
Taylor expanded in y around inf 49.4%
unpow249.4%
associate-*r*49.4%
Simplified49.4%
Taylor expanded in x around 0 34.6%
unpow234.6%
associate-*l*27.9%
Simplified27.9%
Final simplification34.2%
(FPCore (x y) :precision binary64 (if (<= y 450.0) x (* x (* y (* y 0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if (y <= 450.0) {
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 <= 450.0d0) 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 <= 450.0) {
tmp = x;
} else {
tmp = x * (y * (y * 0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 450.0: tmp = x else: tmp = x * (y * (y * 0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if (y <= 450.0) 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 <= 450.0) tmp = x; else tmp = x * (y * (y * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 450.0], x, N[(x * N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 450:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(y \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 450Initial program 100.0%
Taylor expanded in y around 0 85.3%
unpow285.3%
Simplified85.3%
Taylor expanded in x around 0 52.7%
+-commutative52.7%
unpow252.7%
fma-udef52.7%
Simplified52.7%
Taylor expanded in y around 0 36.0%
if 450 < y Initial program 100.0%
Taylor expanded in y around 0 49.4%
unpow249.4%
Simplified49.4%
Taylor expanded in x around 0 34.6%
+-commutative34.6%
unpow234.6%
fma-udef34.6%
Simplified34.6%
Taylor expanded in y around inf 34.6%
unpow234.6%
Simplified34.6%
Taylor expanded in y around 0 34.6%
associate-*r*34.6%
*-commutative34.6%
unpow234.6%
associate-*r*34.6%
*-commutative34.6%
Simplified34.6%
Final simplification35.7%
(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 77.3%
unpow277.3%
Simplified77.3%
Taylor expanded in x around 0 48.7%
+-commutative48.7%
unpow248.7%
fma-udef48.7%
Simplified48.7%
*-commutative48.7%
fma-udef48.7%
distribute-rgt-in48.7%
*-un-lft-identity48.7%
Applied egg-rr48.7%
Final simplification48.7%
(FPCore (x y) :precision binary64 (if (<= y 2e-9) x (/ (* x y) y)))
double code(double x, double y) {
double tmp;
if (y <= 2e-9) {
tmp = x;
} else {
tmp = (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 <= 2d-9) then
tmp = x
else
tmp = (x * y) / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2e-9) {
tmp = x;
} else {
tmp = (x * y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2e-9: tmp = x else: tmp = (x * y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= 2e-9) tmp = x; else tmp = Float64(Float64(x * y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2e-9) tmp = x; else tmp = (x * y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2e-9], x, N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{y}\\
\end{array}
\end{array}
if y < 2.00000000000000012e-9Initial program 100.0%
Taylor expanded in y around 0 85.4%
unpow285.4%
Simplified85.4%
Taylor expanded in x around 0 52.8%
+-commutative52.8%
unpow252.8%
fma-udef52.8%
Simplified52.8%
Taylor expanded in y around 0 36.1%
if 2.00000000000000012e-9 < y Initial program 100.0%
*-commutative100.0%
associate-*l/99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 4.0%
Taylor expanded in x around 0 12.4%
Final simplification30.6%
(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 77.3%
unpow277.3%
Simplified77.3%
Taylor expanded in x around 0 48.7%
+-commutative48.7%
unpow248.7%
fma-udef48.7%
Simplified48.7%
Taylor expanded in y around 0 28.5%
Final simplification28.5%
herbie shell --seed 2023208
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))