
(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 (<= y 215.0)
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 1.35e+154)
(*
x
(/
(- 1.0 (* 0.027777777777777776 (pow y 4.0)))
(- 1.0 (* y (* y 0.16666666666666666)))))
(* 0.16666666666666666 (* (sin x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 215.0) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.35e+154) {
tmp = x * ((1.0 - (0.027777777777777776 * pow(y, 4.0))) / (1.0 - (y * (y * 0.16666666666666666))));
} 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 <= 215.0d0) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 1.35d+154) then
tmp = x * ((1.0d0 - (0.027777777777777776d0 * (y ** 4.0d0))) / (1.0d0 - (y * (y * 0.16666666666666666d0))))
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 <= 215.0) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.35e+154) {
tmp = x * ((1.0 - (0.027777777777777776 * Math.pow(y, 4.0))) / (1.0 - (y * (y * 0.16666666666666666))));
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 215.0: tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 1.35e+154: tmp = x * ((1.0 - (0.027777777777777776 * math.pow(y, 4.0))) / (1.0 - (y * (y * 0.16666666666666666)))) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 215.0) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 1.35e+154) tmp = Float64(x * Float64(Float64(1.0 - Float64(0.027777777777777776 * (y ^ 4.0))) / Float64(1.0 - Float64(y * Float64(y * 0.16666666666666666))))); 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 <= 215.0) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 1.35e+154) tmp = x * ((1.0 - (0.027777777777777776 * (y ^ 4.0))) / (1.0 - (y * (y * 0.16666666666666666)))); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 215.0], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x * N[(N[(1.0 - N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 215:\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 - y \cdot \left(y \cdot 0.16666666666666666\right)}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 215Initial program 100.0%
Taylor expanded in y around 0 83.8%
unpow283.8%
Simplified83.8%
if 215 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 4.0%
unpow24.0%
Simplified4.0%
Taylor expanded in x around 0 17.5%
*-commutative17.5%
unpow217.5%
+-commutative17.5%
fma-udef17.5%
Simplified17.5%
fma-udef17.5%
*-commutative17.5%
Applied egg-rr17.5%
+-commutative17.5%
flip-+55.1%
metadata-eval55.1%
*-commutative55.1%
*-commutative55.1%
swap-sqr55.1%
metadata-eval55.1%
pow255.1%
pow255.1%
pow-prod-up55.1%
metadata-eval55.1%
associate-*l*55.1%
Applied egg-rr55.1%
if 1.35000000000000003e154 < 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 simplification82.9%
(FPCore (x y)
:precision binary64
(if (<= y 28000.0)
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 9e+153)
(*
(* y y)
(+ (* x 0.16666666666666666) (* (pow x 3.0) -0.027777777777777776)))
(* 0.16666666666666666 (* (sin x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 28000.0) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 9e+153) {
tmp = (y * y) * ((x * 0.16666666666666666) + (pow(x, 3.0) * -0.027777777777777776));
} 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 <= 28000.0d0) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 9d+153) then
tmp = (y * y) * ((x * 0.16666666666666666d0) + ((x ** 3.0d0) * (-0.027777777777777776d0)))
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 <= 28000.0) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 9e+153) {
tmp = (y * y) * ((x * 0.16666666666666666) + (Math.pow(x, 3.0) * -0.027777777777777776));
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 28000.0: tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 9e+153: tmp = (y * y) * ((x * 0.16666666666666666) + (math.pow(x, 3.0) * -0.027777777777777776)) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 28000.0) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 9e+153) tmp = Float64(Float64(y * y) * Float64(Float64(x * 0.16666666666666666) + Float64((x ^ 3.0) * -0.027777777777777776))); 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 <= 28000.0) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 9e+153) tmp = (y * y) * ((x * 0.16666666666666666) + ((x ^ 3.0) * -0.027777777777777776)); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 28000.0], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9e+153], N[(N[(y * y), $MachinePrecision] * N[(N[(x * 0.16666666666666666), $MachinePrecision] + N[(N[Power[x, 3.0], $MachinePrecision] * -0.027777777777777776), $MachinePrecision]), $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 28000:\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 9 \cdot 10^{+153}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(x \cdot 0.16666666666666666 + {x}^{3} \cdot -0.027777777777777776\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 28000Initial program 100.0%
Taylor expanded in y around 0 83.4%
unpow283.4%
Simplified83.4%
if 28000 < y < 9.0000000000000002e153Initial program 100.0%
Taylor expanded in y around 0 4.0%
unpow24.0%
Simplified4.0%
Taylor expanded in y around inf 4.0%
unpow24.0%
*-commutative4.0%
Simplified4.0%
Taylor expanded in x around 0 6.2%
associate-*r*6.2%
*-commutative6.2%
associate-*l*6.2%
*-commutative6.2%
associate-*l*6.2%
distribute-lft-out9.9%
unpow29.9%
*-commutative9.9%
Simplified9.9%
if 9.0000000000000002e153 < 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 simplification77.9%
(FPCore (x y)
:precision binary64
(if (<= y 58000.0)
(sin x)
(if (<= y 6e+153)
(+ x (* (pow x 3.0) -0.16666666666666666))
(* 0.16666666666666666 (* (sin x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 58000.0) {
tmp = sin(x);
} else if (y <= 6e+153) {
tmp = x + (pow(x, 3.0) * -0.16666666666666666);
} 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 <= 58000.0d0) then
tmp = sin(x)
else if (y <= 6d+153) then
tmp = x + ((x ** 3.0d0) * (-0.16666666666666666d0))
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 <= 58000.0) {
tmp = Math.sin(x);
} else if (y <= 6e+153) {
tmp = x + (Math.pow(x, 3.0) * -0.16666666666666666);
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 58000.0: tmp = math.sin(x) elif y <= 6e+153: tmp = x + (math.pow(x, 3.0) * -0.16666666666666666) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 58000.0) tmp = sin(x); elseif (y <= 6e+153) tmp = Float64(x + Float64((x ^ 3.0) * -0.16666666666666666)); 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 <= 58000.0) tmp = sin(x); elseif (y <= 6e+153) tmp = x + ((x ^ 3.0) * -0.16666666666666666); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 58000.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 6e+153], N[(x + N[(N[Power[x, 3.0], $MachinePrecision] * -0.16666666666666666), $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 58000:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 6 \cdot 10^{+153}:\\
\;\;\;\;x + {x}^{3} \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 58000Initial program 100.0%
Taylor expanded in y around 0 66.9%
if 58000 < y < 6.00000000000000037e153Initial program 100.0%
associate-*r/100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 5.4%
if 6.00000000000000037e153 < 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 simplification64.9%
(FPCore (x y)
:precision binary64
(if (<= y 25500.0)
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 4.4e+153)
(+ x (* (pow x 3.0) -0.16666666666666666))
(* 0.16666666666666666 (* (sin x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 25500.0) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 4.4e+153) {
tmp = x + (pow(x, 3.0) * -0.16666666666666666);
} 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 <= 25500.0d0) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 4.4d+153) then
tmp = x + ((x ** 3.0d0) * (-0.16666666666666666d0))
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 <= 25500.0) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 4.4e+153) {
tmp = x + (Math.pow(x, 3.0) * -0.16666666666666666);
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 25500.0: tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 4.4e+153: tmp = x + (math.pow(x, 3.0) * -0.16666666666666666) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 25500.0) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 4.4e+153) tmp = Float64(x + Float64((x ^ 3.0) * -0.16666666666666666)); 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 <= 25500.0) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 4.4e+153) tmp = x + ((x ^ 3.0) * -0.16666666666666666); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 25500.0], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.4e+153], N[(x + N[(N[Power[x, 3.0], $MachinePrecision] * -0.16666666666666666), $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 25500:\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+153}:\\
\;\;\;\;x + {x}^{3} \cdot -0.16666666666666666\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 25500Initial program 100.0%
Taylor expanded in y around 0 83.4%
unpow283.4%
Simplified83.4%
if 25500 < y < 4.3999999999999999e153Initial program 100.0%
associate-*r/100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 2.6%
Taylor expanded in x around 0 5.4%
if 4.3999999999999999e153 < 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 simplification77.4%
(FPCore (x y) :precision binary64 (if (<= y 450.0) (sin x) (* x (+ 1.0 (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 450.0) {
tmp = sin(x);
} 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 <= 450.0d0) then
tmp = sin(x)
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 <= 450.0) {
tmp = Math.sin(x);
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 450.0: tmp = math.sin(x) else: tmp = x * (1.0 + (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 450.0) tmp = sin(x); 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 <= 450.0) tmp = sin(x); else tmp = x * (1.0 + (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 450.0], N[Sin[x], $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 450:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 450Initial program 100.0%
Taylor expanded in y around 0 67.2%
if 450 < y Initial program 100.0%
Taylor expanded in y around 0 57.3%
unpow257.3%
Simplified57.3%
Taylor expanded in x around 0 53.8%
*-commutative53.8%
unpow253.8%
+-commutative53.8%
fma-udef53.8%
Simplified53.8%
fma-udef53.8%
*-commutative53.8%
Applied egg-rr53.8%
Final simplification63.9%
(FPCore (x y) :precision binary64 (if (<= y 1.95) x (* 0.16666666666666666 (* y (* x y)))))
double code(double x, double y) {
double tmp;
if (y <= 1.95) {
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 <= 1.95d0) 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 <= 1.95) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (y * (x * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.95: tmp = x else: tmp = 0.16666666666666666 * (y * (x * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.95) 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 <= 1.95) tmp = x; else tmp = 0.16666666666666666 * (y * (x * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.95], x, N[(0.16666666666666666 * N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.95:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(x \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 1.94999999999999996Initial program 100.0%
Taylor expanded in y around 0 84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in x around 0 54.3%
*-commutative54.3%
unpow254.3%
+-commutative54.3%
fma-udef54.3%
Simplified54.3%
Taylor expanded in y around 0 41.8%
if 1.94999999999999996 < y Initial program 100.0%
Taylor expanded in y around 0 56.3%
unpow256.3%
Simplified56.3%
Taylor expanded in y around inf 56.1%
unpow256.1%
*-commutative56.1%
Simplified56.1%
Taylor expanded in x around 0 52.2%
unpow252.2%
associate-*l*35.1%
Simplified35.1%
Final simplification40.1%
(FPCore (x y) :precision binary64 (if (<= y 1.95) x (* 0.16666666666666666 (* x (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 1.95) {
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.95d0) 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.95) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.95: tmp = x else: tmp = 0.16666666666666666 * (x * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.95) 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.95) tmp = x; else tmp = 0.16666666666666666 * (x * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.95], x, N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.95:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 1.94999999999999996Initial program 100.0%
Taylor expanded in y around 0 84.4%
unpow284.4%
Simplified84.4%
Taylor expanded in x around 0 54.3%
*-commutative54.3%
unpow254.3%
+-commutative54.3%
fma-udef54.3%
Simplified54.3%
Taylor expanded in y around 0 41.8%
if 1.94999999999999996 < y Initial program 100.0%
Taylor expanded in y around 0 56.3%
unpow256.3%
Simplified56.3%
Taylor expanded in y around inf 56.1%
unpow256.1%
*-commutative56.1%
Simplified56.1%
Taylor expanded in x around 0 52.2%
unpow252.2%
Simplified52.2%
Final simplification44.5%
(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 77.3%
unpow277.3%
Simplified77.3%
Taylor expanded in x around 0 53.8%
*-commutative53.8%
unpow253.8%
+-commutative53.8%
fma-udef53.8%
Simplified53.8%
fma-udef53.8%
*-commutative53.8%
Applied egg-rr53.8%
Final simplification53.8%
(FPCore (x y) :precision binary64 (if (<= y 3e-35) x (/ (* x y) y)))
double code(double x, double y) {
double tmp;
if (y <= 3e-35) {
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 <= 3d-35) 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 <= 3e-35) {
tmp = x;
} else {
tmp = (x * y) / y;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3e-35: tmp = x else: tmp = (x * y) / y return tmp
function code(x, y) tmp = 0.0 if (y <= 3e-35) tmp = x; else tmp = Float64(Float64(x * y) / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3e-35) tmp = x; else tmp = (x * y) / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3e-35], x, N[(N[(x * y), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3 \cdot 10^{-35}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{y}\\
\end{array}
\end{array}
if y < 2.99999999999999989e-35Initial program 100.0%
Taylor expanded in y around 0 83.8%
unpow283.8%
Simplified83.8%
Taylor expanded in x around 0 55.8%
*-commutative55.8%
unpow255.8%
+-commutative55.8%
fma-udef55.8%
Simplified55.8%
Taylor expanded in y around 0 42.5%
if 2.99999999999999989e-35 < y Initial program 100.0%
associate-*r/100.0%
Applied egg-rr100.0%
Taylor expanded in y around 0 19.0%
Taylor expanded in x around 0 24.0%
Final simplification36.7%
(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 53.8%
*-commutative53.8%
unpow253.8%
+-commutative53.8%
fma-udef53.8%
Simplified53.8%
Taylor expanded in y around 0 32.0%
Final simplification32.0%
herbie shell --seed 2023268
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))