You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1753 lines
45 KiB

8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="theme-color" content="#375EAB">
  7. <title>math - The Go Programming Language</title>
  8. <link type="text/css" rel="stylesheet" href="../../lib/godoc/style.css">
  9. <link rel="stylesheet" href="../../lib/godoc/jquery.treeview.css">
  10. <script type="text/javascript">window.initFuncs = [];</script>
  11. </head>
  12. <body>
  13. <div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
  14. ...
  15. </div><!-- #lowframe -->
  16. <div id="topbar" class="wide"><div class="container">
  17. <div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
  18. <div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
  19. <a href="index.html#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a>
  20. <form method="GET" action="http://localhost:6060/search">
  21. <div id="menu">
  22. <a href="http://localhost:6060/doc/">Documents</a>
  23. <a href="http://localhost:6060/pkg/">Packages</a>
  24. <a href="http://localhost:6060/project/">The Project</a>
  25. <a href="http://localhost:6060/help/">Help</a>
  26. <a href="http://localhost:6060/blog/">Blog</a>
  27. <input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
  28. </div>
  29. </form>
  30. </div></div>
  31. <div id="page" class="wide">
  32. <div class="container">
  33. <h1>Package math</h1>
  34. <div id="nav"></div>
  35. <!--
  36. Copyright 2009 The Go Authors. All rights reserved.
  37. Use of this source code is governed by a BSD-style
  38. license that can be found in the LICENSE file.
  39. -->
  40. <!--
  41. Note: Static (i.e., not template-generated) href and id
  42. attributes start with "pkg-" to make it impossible for
  43. them to conflict with generated attributes (some of which
  44. correspond to Go identifiers).
  45. -->
  46. <script type='text/javascript'>
  47. document.ANALYSIS_DATA = null;
  48. document.CALLGRAPH = null;
  49. </script>
  50. <div id="short-nav">
  51. <dl>
  52. <dd><code>import "math"</code></dd>
  53. </dl>
  54. <dl>
  55. <dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
  56. <dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
  57. <dd><a href="index.html#pkg-subdirectories">Subdirectories</a></dd>
  58. </dl>
  59. </div>
  60. <!-- The package's Name is printed as title by the top-level template -->
  61. <div id="pkg-overview" class="toggleVisible">
  62. <div class="collapsed">
  63. <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
  64. </div>
  65. <div class="expanded">
  66. <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
  67. <p>
  68. Package math provides basic constants and mathematical functions.
  69. </p>
  70. </div>
  71. </div>
  72. <div id="pkg-index" class="toggleVisible">
  73. <div class="collapsed">
  74. <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
  75. </div>
  76. <div class="expanded">
  77. <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
  78. <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
  79. <div id="manual-nav">
  80. <dl>
  81. <dd><a href="index.html#pkg-constants">Constants</a></dd>
  82. <dd><a href="index.html#Abs">func Abs(x float64) float64</a></dd>
  83. <dd><a href="index.html#Acos">func Acos(x float64) float64</a></dd>
  84. <dd><a href="index.html#Acosh">func Acosh(x float64) float64</a></dd>
  85. <dd><a href="index.html#Asin">func Asin(x float64) float64</a></dd>
  86. <dd><a href="index.html#Asinh">func Asinh(x float64) float64</a></dd>
  87. <dd><a href="index.html#Atan">func Atan(x float64) float64</a></dd>
  88. <dd><a href="index.html#Atan2">func Atan2(y, x float64) float64</a></dd>
  89. <dd><a href="index.html#Atanh">func Atanh(x float64) float64</a></dd>
  90. <dd><a href="index.html#Cbrt">func Cbrt(x float64) float64</a></dd>
  91. <dd><a href="index.html#Ceil">func Ceil(x float64) float64</a></dd>
  92. <dd><a href="index.html#Copysign">func Copysign(x, y float64) float64</a></dd>
  93. <dd><a href="index.html#Cos">func Cos(x float64) float64</a></dd>
  94. <dd><a href="index.html#Cosh">func Cosh(x float64) float64</a></dd>
  95. <dd><a href="index.html#Dim">func Dim(x, y float64) float64</a></dd>
  96. <dd><a href="index.html#Erf">func Erf(x float64) float64</a></dd>
  97. <dd><a href="index.html#Erfc">func Erfc(x float64) float64</a></dd>
  98. <dd><a href="index.html#Exp">func Exp(x float64) float64</a></dd>
  99. <dd><a href="index.html#Exp2">func Exp2(x float64) float64</a></dd>
  100. <dd><a href="index.html#Expm1">func Expm1(x float64) float64</a></dd>
  101. <dd><a href="index.html#Float32bits">func Float32bits(f float32) uint32</a></dd>
  102. <dd><a href="index.html#Float32frombits">func Float32frombits(b uint32) float32</a></dd>
  103. <dd><a href="index.html#Float64bits">func Float64bits(f float64) uint64</a></dd>
  104. <dd><a href="index.html#Float64frombits">func Float64frombits(b uint64) float64</a></dd>
  105. <dd><a href="index.html#Floor">func Floor(x float64) float64</a></dd>
  106. <dd><a href="index.html#Frexp">func Frexp(f float64) (frac float64, exp int)</a></dd>
  107. <dd><a href="index.html#Gamma">func Gamma(x float64) float64</a></dd>
  108. <dd><a href="index.html#Hypot">func Hypot(p, q float64) float64</a></dd>
  109. <dd><a href="index.html#Ilogb">func Ilogb(x float64) int</a></dd>
  110. <dd><a href="index.html#Inf">func Inf(sign int) float64</a></dd>
  111. <dd><a href="index.html#IsInf">func IsInf(f float64, sign int) bool</a></dd>
  112. <dd><a href="index.html#IsNaN">func IsNaN(f float64) (is bool)</a></dd>
  113. <dd><a href="index.html#J0">func J0(x float64) float64</a></dd>
  114. <dd><a href="index.html#J1">func J1(x float64) float64</a></dd>
  115. <dd><a href="index.html#Jn">func Jn(n int, x float64) float64</a></dd>
  116. <dd><a href="index.html#Ldexp">func Ldexp(frac float64, exp int) float64</a></dd>
  117. <dd><a href="index.html#Lgamma">func Lgamma(x float64) (lgamma float64, sign int)</a></dd>
  118. <dd><a href="index.html#Log">func Log(x float64) float64</a></dd>
  119. <dd><a href="index.html#Log10">func Log10(x float64) float64</a></dd>
  120. <dd><a href="index.html#Log1p">func Log1p(x float64) float64</a></dd>
  121. <dd><a href="index.html#Log2">func Log2(x float64) float64</a></dd>
  122. <dd><a href="index.html#Logb">func Logb(x float64) float64</a></dd>
  123. <dd><a href="index.html#Max">func Max(x, y float64) float64</a></dd>
  124. <dd><a href="index.html#Min">func Min(x, y float64) float64</a></dd>
  125. <dd><a href="index.html#Mod">func Mod(x, y float64) float64</a></dd>
  126. <dd><a href="index.html#Modf">func Modf(f float64) (int float64, frac float64)</a></dd>
  127. <dd><a href="index.html#NaN">func NaN() float64</a></dd>
  128. <dd><a href="index.html#Nextafter">func Nextafter(x, y float64) (r float64)</a></dd>
  129. <dd><a href="index.html#Nextafter32">func Nextafter32(x, y float32) (r float32)</a></dd>
  130. <dd><a href="index.html#Pow">func Pow(x, y float64) float64</a></dd>
  131. <dd><a href="index.html#Pow10">func Pow10(e int) float64</a></dd>
  132. <dd><a href="index.html#Remainder">func Remainder(x, y float64) float64</a></dd>
  133. <dd><a href="index.html#Signbit">func Signbit(x float64) bool</a></dd>
  134. <dd><a href="index.html#Sin">func Sin(x float64) float64</a></dd>
  135. <dd><a href="index.html#Sincos">func Sincos(x float64) (sin, cos float64)</a></dd>
  136. <dd><a href="index.html#Sinh">func Sinh(x float64) float64</a></dd>
  137. <dd><a href="index.html#Sqrt">func Sqrt(x float64) float64</a></dd>
  138. <dd><a href="index.html#Tan">func Tan(x float64) float64</a></dd>
  139. <dd><a href="index.html#Tanh">func Tanh(x float64) float64</a></dd>
  140. <dd><a href="index.html#Trunc">func Trunc(x float64) float64</a></dd>
  141. <dd><a href="index.html#Y0">func Y0(x float64) float64</a></dd>
  142. <dd><a href="index.html#Y1">func Y1(x float64) float64</a></dd>
  143. <dd><a href="index.html#Yn">func Yn(n int, x float64) float64</a></dd>
  144. </dl>
  145. </div><!-- #manual-nav -->
  146. <h4>Package files</h4>
  147. <p>
  148. <span style="font-size:90%">
  149. <a href="http://localhost:6060/src/math/abs.go">abs.go</a>
  150. <a href="http://localhost:6060/src/math/acosh.go">acosh.go</a>
  151. <a href="http://localhost:6060/src/math/asin.go">asin.go</a>
  152. <a href="http://localhost:6060/src/math/asinh.go">asinh.go</a>
  153. <a href="http://localhost:6060/src/math/atan.go">atan.go</a>
  154. <a href="http://localhost:6060/src/math/atan2.go">atan2.go</a>
  155. <a href="http://localhost:6060/src/math/atanh.go">atanh.go</a>
  156. <a href="http://localhost:6060/src/math/bits.go">bits.go</a>
  157. <a href="http://localhost:6060/src/math/cbrt.go">cbrt.go</a>
  158. <a href="http://localhost:6060/src/math/const.go">const.go</a>
  159. <a href="http://localhost:6060/src/math/copysign.go">copysign.go</a>
  160. <a href="http://localhost:6060/src/math/dim.go">dim.go</a>
  161. <a href="http://localhost:6060/src/math/erf.go">erf.go</a>
  162. <a href="http://localhost:6060/src/math/exp.go">exp.go</a>
  163. <a href="http://localhost:6060/src/math/expm1.go">expm1.go</a>
  164. <a href="http://localhost:6060/src/math/floor.go">floor.go</a>
  165. <a href="http://localhost:6060/src/math/floor_asm.go">floor_asm.go</a>
  166. <a href="http://localhost:6060/src/math/frexp.go">frexp.go</a>
  167. <a href="http://localhost:6060/src/math/gamma.go">gamma.go</a>
  168. <a href="http://localhost:6060/src/math/hypot.go">hypot.go</a>
  169. <a href="http://localhost:6060/src/math/j0.go">j0.go</a>
  170. <a href="http://localhost:6060/src/math/j1.go">j1.go</a>
  171. <a href="http://localhost:6060/src/math/jn.go">jn.go</a>
  172. <a href="http://localhost:6060/src/math/ldexp.go">ldexp.go</a>
  173. <a href="http://localhost:6060/src/math/lgamma.go">lgamma.go</a>
  174. <a href="http://localhost:6060/src/math/log.go">log.go</a>
  175. <a href="http://localhost:6060/src/math/log10.go">log10.go</a>
  176. <a href="http://localhost:6060/src/math/log1p.go">log1p.go</a>
  177. <a href="http://localhost:6060/src/math/logb.go">logb.go</a>
  178. <a href="http://localhost:6060/src/math/mod.go">mod.go</a>
  179. <a href="http://localhost:6060/src/math/modf.go">modf.go</a>
  180. <a href="http://localhost:6060/src/math/nextafter.go">nextafter.go</a>
  181. <a href="http://localhost:6060/src/math/pow.go">pow.go</a>
  182. <a href="http://localhost:6060/src/math/pow10.go">pow10.go</a>
  183. <a href="http://localhost:6060/src/math/remainder.go">remainder.go</a>
  184. <a href="http://localhost:6060/src/math/signbit.go">signbit.go</a>
  185. <a href="http://localhost:6060/src/math/sin.go">sin.go</a>
  186. <a href="http://localhost:6060/src/math/sincos.go">sincos.go</a>
  187. <a href="http://localhost:6060/src/math/sinh.go">sinh.go</a>
  188. <a href="http://localhost:6060/src/math/sqrt.go">sqrt.go</a>
  189. <a href="http://localhost:6060/src/math/tan.go">tan.go</a>
  190. <a href="http://localhost:6060/src/math/tanh.go">tanh.go</a>
  191. <a href="http://localhost:6060/src/math/unsafe.go">unsafe.go</a>
  192. </span>
  193. </p>
  194. </div><!-- .expanded -->
  195. </div><!-- #pkg-index -->
  196. <div id="pkg-callgraph" class="toggle" style="display: none">
  197. <div class="collapsed">
  198. <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
  199. </div> <!-- .expanded -->
  200. <div class="expanded">
  201. <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
  202. <p>
  203. In the call graph viewer below, each node
  204. is a function belonging to this package
  205. and its children are the functions it
  206. calls&mdash;perhaps dynamically.
  207. </p>
  208. <p>
  209. The root nodes are the entry points of the
  210. package: functions that may be called from
  211. outside the package.
  212. There may be non-exported or anonymous
  213. functions among them if they are called
  214. dynamically from another package.
  215. </p>
  216. <p>
  217. Click a node to visit that function's source code.
  218. From there you can visit its callers by
  219. clicking its declaring <code>func</code>
  220. token.
  221. </p>
  222. <p>
  223. Functions may be omitted if they were
  224. determined to be unreachable in the
  225. particular programs or tests that were
  226. analyzed.
  227. </p>
  228. <!-- Zero means show all package entry points. -->
  229. <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
  230. </div>
  231. </div> <!-- #pkg-callgraph -->
  232. <h2 id="pkg-constants">Constants</h2>
  233. <pre>const (
  234. <span id="E">E</span> = 2.71828182845904523536028747135266249775724709369995957496696763 <span class="comment">// http://oeis.org/A001113</span>
  235. <span id="Pi">Pi</span> = 3.14159265358979323846264338327950288419716939937510582097494459 <span class="comment">// http://oeis.org/A000796</span>
  236. <span id="Phi">Phi</span> = 1.61803398874989484820458683436563811772030917980576286213544862 <span class="comment">// http://oeis.org/A001622</span>
  237. <span id="Sqrt2">Sqrt2</span> = 1.41421356237309504880168872420969807856967187537694807317667974 <span class="comment">// http://oeis.org/A002193</span>
  238. <span id="SqrtE">SqrtE</span> = 1.64872127070012814684865078781416357165377610071014801157507931 <span class="comment">// http://oeis.org/A019774</span>
  239. <span id="SqrtPi">SqrtPi</span> = 1.77245385090551602729816748334114518279754945612238712821380779 <span class="comment">// http://oeis.org/A002161</span>
  240. <span id="SqrtPhi">SqrtPhi</span> = 1.27201964951406896425242246173749149171560804184009624861664038 <span class="comment">// http://oeis.org/A139339</span>
  241. <span id="Ln2">Ln2</span> = 0.693147180559945309417232121458176568075500134360255254120680009 <span class="comment">// http://oeis.org/A002162</span>
  242. <span id="Log2E">Log2E</span> = 1 / <a href="index.html#Ln2">Ln2</a>
  243. <span id="Ln10">Ln10</span> = 2.30258509299404568401799145468436420760110148862877297603332790 <span class="comment">// http://oeis.org/A002392</span>
  244. <span id="Log10E">Log10E</span> = 1 / <a href="index.html#Ln10">Ln10</a>
  245. )</pre>
  246. <p>
  247. Mathematical constants.
  248. </p>
  249. <pre>const (
  250. <span id="MaxFloat32">MaxFloat32</span> = 3.40282346638528859811704183484516925440e+38 <span class="comment">// 2**127 * (2**24 - 1) / 2**23</span>
  251. <span id="SmallestNonzeroFloat32">SmallestNonzeroFloat32</span> = 1.401298464324817070923729583289916131280e-45 <span class="comment">// 1 / 2**(127 - 1 + 23)</span>
  252. <span id="MaxFloat64">MaxFloat64</span> = 1.797693134862315708145274237317043567981e+308 <span class="comment">// 2**1023 * (2**53 - 1) / 2**52</span>
  253. <span id="SmallestNonzeroFloat64">SmallestNonzeroFloat64</span> = 4.940656458412465441765687928682213723651e-324 <span class="comment">// 1 / 2**(1023 - 1 + 52)</span>
  254. )</pre>
  255. <p>
  256. Floating-point limit values.
  257. Max is the largest finite value representable by the type.
  258. SmallestNonzero is the smallest positive, non-zero value representable by the type.
  259. </p>
  260. <pre>const (
  261. <span id="MaxInt8">MaxInt8</span> = 1&lt;&lt;7 - 1
  262. <span id="MinInt8">MinInt8</span> = -1 &lt;&lt; 7
  263. <span id="MaxInt16">MaxInt16</span> = 1&lt;&lt;15 - 1
  264. <span id="MinInt16">MinInt16</span> = -1 &lt;&lt; 15
  265. <span id="MaxInt32">MaxInt32</span> = 1&lt;&lt;31 - 1
  266. <span id="MinInt32">MinInt32</span> = -1 &lt;&lt; 31
  267. <span id="MaxInt64">MaxInt64</span> = 1&lt;&lt;63 - 1
  268. <span id="MinInt64">MinInt64</span> = -1 &lt;&lt; 63
  269. <span id="MaxUint8">MaxUint8</span> = 1&lt;&lt;8 - 1
  270. <span id="MaxUint16">MaxUint16</span> = 1&lt;&lt;16 - 1
  271. <span id="MaxUint32">MaxUint32</span> = 1&lt;&lt;32 - 1
  272. <span id="MaxUint64">MaxUint64</span> = 1&lt;&lt;64 - 1
  273. )</pre>
  274. <p>
  275. Integer limit values.
  276. </p>
  277. <h2 id="Abs">func <a href="http://localhost:6060/src/math/abs.go?s=278:305#L2">Abs</a></h2>
  278. <pre>func Abs(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  279. <p>
  280. Abs returns the absolute value of x.
  281. </p>
  282. <p>
  283. Special cases are:
  284. </p>
  285. <pre>Abs(±Inf) = +Inf
  286. Abs(NaN) = NaN
  287. </pre>
  288. <h2 id="Acos">func <a href="http://localhost:6060/src/math/asin.go?s=897:925#L41">Acos</a></h2>
  289. <pre>func Acos(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  290. <p>
  291. Acos returns the arccosine, in radians, of x.
  292. </p>
  293. <p>
  294. Special case is:
  295. </p>
  296. <pre>Acos(x) = NaN if x &lt; -1 or x &gt; 1
  297. </pre>
  298. <h2 id="Acosh">func <a href="http://localhost:6060/src/math/acosh.go?s=1295:1324#L32">Acosh</a></h2>
  299. <pre>func Acosh(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  300. <p>
  301. Acosh returns the inverse hyperbolic cosine of x.
  302. </p>
  303. <p>
  304. Special cases are:
  305. </p>
  306. <pre>Acosh(+Inf) = +Inf
  307. Acosh(x) = NaN if x &lt; 1
  308. Acosh(NaN) = NaN
  309. </pre>
  310. <h2 id="Asin">func <a href="http://localhost:6060/src/math/asin.go?s=434:462#L9">Asin</a></h2>
  311. <pre>func Asin(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  312. <p>
  313. Asin returns the arcsine, in radians, of x.
  314. </p>
  315. <p>
  316. Special cases are:
  317. </p>
  318. <pre>Asin(±0) = ±0
  319. Asin(x) = NaN if x &lt; -1 or x &gt; 1
  320. </pre>
  321. <h2 id="Asinh">func <a href="http://localhost:6060/src/math/asinh.go?s=1229:1258#L29">Asinh</a></h2>
  322. <pre>func Asinh(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  323. <p>
  324. Asinh returns the inverse hyperbolic sine of x.
  325. </p>
  326. <p>
  327. Special cases are:
  328. </p>
  329. <pre>Asinh(±0) = ±0
  330. Asinh(±Inf) = ±Inf
  331. Asinh(NaN) = NaN
  332. </pre>
  333. <h2 id="Atan">func <a href="http://localhost:6060/src/math/atan.go?s=2901:2929#L85">Atan</a></h2>
  334. <pre>func Atan(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  335. <p>
  336. Atan returns the arctangent, in radians, of x.
  337. </p>
  338. <p>
  339. Special cases are:
  340. </p>
  341. <pre>Atan(±0) = ±0
  342. Atan(±Inf) = ±Pi/2
  343. </pre>
  344. <h2 id="Atan2">func <a href="http://localhost:6060/src/math/atan2.go?s=770:802#L19">Atan2</a></h2>
  345. <pre>func Atan2(y, x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  346. <p>
  347. Atan2 returns the arc tangent of y/x, using
  348. the signs of the two to determine the quadrant
  349. of the return value.
  350. </p>
  351. <p>
  352. Special cases are (in order):
  353. </p>
  354. <pre>Atan2(y, NaN) = NaN
  355. Atan2(NaN, x) = NaN
  356. Atan2(+0, x&gt;=0) = +0
  357. Atan2(-0, x&gt;=0) = -0
  358. Atan2(+0, x&lt;=-0) = +Pi
  359. Atan2(-0, x&lt;=-0) = -Pi
  360. Atan2(y&gt;0, 0) = +Pi/2
  361. Atan2(y&lt;0, 0) = -Pi/2
  362. Atan2(+Inf, +Inf) = +Pi/4
  363. Atan2(-Inf, +Inf) = -Pi/4
  364. Atan2(+Inf, -Inf) = 3Pi/4
  365. Atan2(-Inf, -Inf) = -3Pi/4
  366. Atan2(y, +Inf) = 0
  367. Atan2(y&gt;0, -Inf) = +Pi
  368. Atan2(y&lt;0, -Inf) = -Pi
  369. Atan2(+Inf, x) = +Pi/2
  370. Atan2(-Inf, x) = -Pi/2
  371. </pre>
  372. <h2 id="Atanh">func <a href="http://localhost:6060/src/math/atanh.go?s=1451:1480#L37">Atanh</a></h2>
  373. <pre>func Atanh(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  374. <p>
  375. Atanh returns the inverse hyperbolic tangent of x.
  376. </p>
  377. <p>
  378. Special cases are:
  379. </p>
  380. <pre>Atanh(1) = +Inf
  381. Atanh(±0) = ±0
  382. Atanh(-1) = -Inf
  383. Atanh(x) = NaN if x &lt; -1 or x &gt; 1
  384. Atanh(NaN) = NaN
  385. </pre>
  386. <h2 id="Cbrt">func <a href="http://localhost:6060/src/math/cbrt.go?s=807:835#L15">Cbrt</a></h2>
  387. <pre>func Cbrt(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  388. <p>
  389. Cbrt returns the cube root of x.
  390. </p>
  391. <p>
  392. Special cases are:
  393. </p>
  394. <pre>Cbrt(±0) = ±0
  395. Cbrt(±Inf) = ±Inf
  396. Cbrt(NaN) = NaN
  397. </pre>
  398. <h2 id="Ceil">func <a href="http://localhost:6060/src/math/floor.go?s=725:753#L26">Ceil</a></h2>
  399. <pre>func Ceil(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  400. <p>
  401. Ceil returns the least integer value greater than or equal to x.
  402. </p>
  403. <p>
  404. Special cases are:
  405. </p>
  406. <pre>Ceil(±0) = ±0
  407. Ceil(±Inf) = ±Inf
  408. Ceil(NaN) = NaN
  409. </pre>
  410. <h2 id="Copysign">func <a href="http://localhost:6060/src/math/copysign.go?s=248:283#L1">Copysign</a></h2>
  411. <pre>func Copysign(x, y <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  412. <p>
  413. Copysign returns a value with the magnitude
  414. of x and the sign of y.
  415. </p>
  416. <h2 id="Cos">func <a href="http://localhost:6060/src/math/sin.go?s=3697:3724#L107">Cos</a></h2>
  417. <pre>func Cos(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  418. <p>
  419. Cos returns the cosine of the radian argument x.
  420. </p>
  421. <p>
  422. Special cases are:
  423. </p>
  424. <pre>Cos(±Inf) = NaN
  425. Cos(NaN) = NaN
  426. </pre>
  427. <h2 id="Cosh">func <a href="http://localhost:6060/src/math/sinh.go?s=1411:1439#L59">Cosh</a></h2>
  428. <pre>func Cosh(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  429. <p>
  430. Cosh returns the hyperbolic cosine of x.
  431. </p>
  432. <p>
  433. Special cases are:
  434. </p>
  435. <pre>Cosh(±0) = 1
  436. Cosh(±Inf) = +Inf
  437. Cosh(NaN) = NaN
  438. </pre>
  439. <h2 id="Dim">func <a href="http://localhost:6060/src/math/dim.go?s=324:354#L3">Dim</a></h2>
  440. <pre>func Dim(x, y <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  441. <p>
  442. Dim returns the maximum of x-y or 0.
  443. </p>
  444. <p>
  445. Special cases are:
  446. </p>
  447. <pre>Dim(+Inf, +Inf) = NaN
  448. Dim(-Inf, -Inf) = NaN
  449. Dim(x, NaN) = Dim(NaN, x) = NaN
  450. </pre>
  451. <h2 id="Erf">func <a href="http://localhost:6060/src/math/erf.go?s=8275:8302#L178">Erf</a></h2>
  452. <pre>func Erf(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  453. <p>
  454. Erf returns the error function of x.
  455. </p>
  456. <p>
  457. Special cases are:
  458. </p>
  459. <pre>Erf(+Inf) = 1
  460. Erf(-Inf) = -1
  461. Erf(NaN) = NaN
  462. </pre>
  463. <h2 id="Erfc">func <a href="http://localhost:6060/src/math/erf.go?s=10020:10048#L255">Erfc</a></h2>
  464. <pre>func Erfc(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  465. <p>
  466. Erfc returns the complementary error function of x.
  467. </p>
  468. <p>
  469. Special cases are:
  470. </p>
  471. <pre>Erfc(+Inf) = 0
  472. Erfc(-Inf) = 2
  473. Erfc(NaN) = NaN
  474. </pre>
  475. <h2 id="Exp">func <a href="http://localhost:6060/src/math/exp.go?s=368:395#L4">Exp</a></h2>
  476. <pre>func Exp(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  477. <p>
  478. Exp returns e**x, the base-e exponential of x.
  479. </p>
  480. <p>
  481. Special cases are:
  482. </p>
  483. <pre>Exp(+Inf) = +Inf
  484. Exp(NaN) = NaN
  485. </pre>
  486. <p>
  487. Very large values overflow to 0 or +Inf.
  488. Very small values underflow to 1.
  489. </p>
  490. <h2 id="Exp2">func <a href="http://localhost:6060/src/math/exp.go?s=4062:4090#L125">Exp2</a></h2>
  491. <pre>func Exp2(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  492. <p>
  493. Exp2 returns 2**x, the base-2 exponential of x.
  494. </p>
  495. <p>
  496. Special cases are the same as Exp.
  497. </p>
  498. <h2 id="Expm1">func <a href="http://localhost:6060/src/math/expm1.go?s=5196:5225#L114">Expm1</a></h2>
  499. <pre>func Expm1(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  500. <p>
  501. Expm1 returns e**x - 1, the base-e exponential of x minus 1.
  502. It is more accurate than Exp(x) - 1 when x is near zero.
  503. </p>
  504. <p>
  505. Special cases are:
  506. </p>
  507. <pre>Expm1(+Inf) = +Inf
  508. Expm1(-Inf) = -1
  509. Expm1(NaN) = NaN
  510. </pre>
  511. <p>
  512. Very large values overflow to -1 or +Inf.
  513. </p>
  514. <h2 id="Float32bits">func <a href="http://localhost:6060/src/math/unsafe.go?s=255:289#L1">Float32bits</a></h2>
  515. <pre>func Float32bits(f <a href="../builtin/index.html#float32">float32</a>) <a href="../builtin/index.html#uint32">uint32</a></pre>
  516. <p>
  517. Float32bits returns the IEEE 754 binary representation of f.
  518. </p>
  519. <h2 id="Float32frombits">func <a href="http://localhost:6060/src/math/unsafe.go?s=444:482#L4">Float32frombits</a></h2>
  520. <pre>func Float32frombits(b <a href="../builtin/index.html#uint32">uint32</a>) <a href="../builtin/index.html#float32">float32</a></pre>
  521. <p>
  522. Float32frombits returns the floating point number corresponding
  523. to the IEEE 754 binary representation b.
  524. </p>
  525. <h2 id="Float64bits">func <a href="http://localhost:6060/src/math/unsafe.go?s=591:625#L7">Float64bits</a></h2>
  526. <pre>func Float64bits(f <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#uint64">uint64</a></pre>
  527. <p>
  528. Float64bits returns the IEEE 754 binary representation of f.
  529. </p>
  530. <h2 id="Float64frombits">func <a href="http://localhost:6060/src/math/unsafe.go?s=777:815#L11">Float64frombits</a></h2>
  531. <pre>func Float64frombits(b <a href="../builtin/index.html#uint64">uint64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  532. <p>
  533. Float64frombits returns the floating point number corresponding
  534. the IEEE 754 binary representation b.
  535. </p>
  536. <h2 id="Floor">func <a href="http://localhost:6060/src/math/floor.go?s=337:366#L3">Floor</a></h2>
  537. <pre>func Floor(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  538. <p>
  539. Floor returns the greatest integer value less than or equal to x.
  540. </p>
  541. <p>
  542. Special cases are:
  543. </p>
  544. <pre>Floor(±0) = ±0
  545. Floor(±Inf) = ±Inf
  546. Floor(NaN) = NaN
  547. </pre>
  548. <h2 id="Frexp">func <a href="http://localhost:6060/src/math/frexp.go?s=469:514#L6">Frexp</a></h2>
  549. <pre>func Frexp(f <a href="../builtin/index.html#float64">float64</a>) (frac <a href="../builtin/index.html#float64">float64</a>, exp <a href="../builtin/index.html#int">int</a>)</pre>
  550. <p>
  551. Frexp breaks f into a normalized fraction
  552. and an integral power of two.
  553. It returns frac and exp satisfying f == frac × 2**exp,
  554. with the absolute value of frac in the interval [½, 1).
  555. </p>
  556. <p>
  557. Special cases are:
  558. </p>
  559. <pre>Frexp(±0) = ±0, 0
  560. Frexp(±Inf) = ±Inf, 0
  561. Frexp(NaN) = NaN, 0
  562. </pre>
  563. <h2 id="Gamma">func <a href="http://localhost:6060/src/math/gamma.go?s=3626:3655#L112">Gamma</a></h2>
  564. <pre>func Gamma(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  565. <p>
  566. Gamma returns the Gamma function of x.
  567. </p>
  568. <p>
  569. Special cases are:
  570. </p>
  571. <pre>Gamma(+Inf) = +Inf
  572. Gamma(+0) = +Inf
  573. Gamma(-0) = -Inf
  574. Gamma(x) = NaN for integer x &lt; 0
  575. Gamma(-Inf) = NaN
  576. Gamma(NaN) = NaN
  577. </pre>
  578. <h2 id="Hypot">func <a href="http://localhost:6060/src/math/hypot.go?s=464:496#L9">Hypot</a></h2>
  579. <pre>func Hypot(p, q <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  580. <p>
  581. Hypot returns Sqrt(p*p + q*q), taking care to avoid
  582. unnecessary overflow and underflow.
  583. </p>
  584. <p>
  585. Special cases are:
  586. </p>
  587. <pre>Hypot(±Inf, q) = +Inf
  588. Hypot(p, ±Inf) = +Inf
  589. Hypot(NaN, q) = NaN
  590. Hypot(p, NaN) = NaN
  591. </pre>
  592. <h2 id="Ilogb">func <a href="http://localhost:6060/src/math/logb.go?s=641:666#L22">Ilogb</a></h2>
  593. <pre>func Ilogb(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#int">int</a></pre>
  594. <p>
  595. Ilogb returns the binary exponent of x as an integer.
  596. </p>
  597. <p>
  598. Special cases are:
  599. </p>
  600. <pre>Ilogb(±Inf) = MaxInt32
  601. Ilogb(0) = MinInt32
  602. Ilogb(NaN) = MaxInt32
  603. </pre>
  604. <h2 id="Inf">func <a href="http://localhost:6060/src/math/bits.go?s=415:441#L7">Inf</a></h2>
  605. <pre>func Inf(sign <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  606. <p>
  607. Inf returns positive infinity if sign &gt;= 0, negative infinity if sign &lt; 0.
  608. </p>
  609. <h2 id="IsInf">func <a href="http://localhost:6060/src/math/bits.go?s=1213:1249#L33">IsInf</a></h2>
  610. <pre>func IsInf(f <a href="../builtin/index.html#float64">float64</a>, sign <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#bool">bool</a></pre>
  611. <p>
  612. IsInf reports whether f is an infinity, according to sign.
  613. If sign &gt; 0, IsInf reports whether f is positive infinity.
  614. If sign &lt; 0, IsInf reports whether f is negative infinity.
  615. If sign == 0, IsInf reports whether f is either infinity.
  616. </p>
  617. <h2 id="IsNaN">func <a href="http://localhost:6060/src/math/bits.go?s=715:746#L21">IsNaN</a></h2>
  618. <pre>func IsNaN(f <a href="../builtin/index.html#float64">float64</a>) (is <a href="../builtin/index.html#bool">bool</a>)</pre>
  619. <p>
  620. IsNaN reports whether f is an IEEE 754 &ldquo;not-a-number&rdquo; value.
  621. </p>
  622. <h2 id="J0">func <a href="http://localhost:6060/src/math/j0.go?s=2892:2918#L66">J0</a></h2>
  623. <pre>func J0(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  624. <p>
  625. J0 returns the order-zero Bessel function of the first kind.
  626. </p>
  627. <p>
  628. Special cases are:
  629. </p>
  630. <pre>J0(±Inf) = 0
  631. J0(0) = 1
  632. J0(NaN) = NaN
  633. </pre>
  634. <h2 id="J1">func <a href="http://localhost:6060/src/math/j1.go?s=2945:2971#L64">J1</a></h2>
  635. <pre>func J1(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  636. <p>
  637. J1 returns the order-one Bessel function of the first kind.
  638. </p>
  639. <p>
  640. Special cases are:
  641. </p>
  642. <pre>J1(±Inf) = 0
  643. J1(NaN) = NaN
  644. </pre>
  645. <h2 id="Jn">func <a href="http://localhost:6060/src/math/jn.go?s=1827:1860#L43">Jn</a></h2>
  646. <pre>func Jn(n <a href="../builtin/index.html#int">int</a>, x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  647. <p>
  648. Jn returns the order-n Bessel function of the first kind.
  649. </p>
  650. <p>
  651. Special cases are:
  652. </p>
  653. <pre>Jn(n, ±Inf) = 0
  654. Jn(n, NaN) = NaN
  655. </pre>
  656. <h2 id="Ldexp">func <a href="http://localhost:6060/src/math/ldexp.go?s=342:383#L4">Ldexp</a></h2>
  657. <pre>func Ldexp(frac <a href="../builtin/index.html#float64">float64</a>, exp <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  658. <p>
  659. Ldexp is the inverse of Frexp.
  660. It returns frac × 2**exp.
  661. </p>
  662. <p>
  663. Special cases are:
  664. </p>
  665. <pre>Ldexp(±0, exp) = ±0
  666. Ldexp(±Inf, exp) = ±Inf
  667. Ldexp(NaN, exp) = NaN
  668. </pre>
  669. <h2 id="Lgamma">func <a href="http://localhost:6060/src/math/lgamma.go?s=6985:7034#L164">Lgamma</a></h2>
  670. <pre>func Lgamma(x <a href="../builtin/index.html#float64">float64</a>) (lgamma <a href="../builtin/index.html#float64">float64</a>, sign <a href="../builtin/index.html#int">int</a>)</pre>
  671. <p>
  672. Lgamma returns the natural logarithm and sign (-1 or +1) of Gamma(x).
  673. </p>
  674. <p>
  675. Special cases are:
  676. </p>
  677. <pre>Lgamma(+Inf) = +Inf
  678. Lgamma(0) = +Inf
  679. Lgamma(-integer) = +Inf
  680. Lgamma(-Inf) = -Inf
  681. Lgamma(NaN) = NaN
  682. </pre>
  683. <h2 id="Log">func <a href="http://localhost:6060/src/math/log.go?s=2810:2837#L70">Log</a></h2>
  684. <pre>func Log(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  685. <p>
  686. Log returns the natural logarithm of x.
  687. </p>
  688. <p>
  689. Special cases are:
  690. </p>
  691. <pre>Log(+Inf) = +Inf
  692. Log(0) = -Inf
  693. Log(x &lt; 0) = NaN
  694. Log(NaN) = NaN
  695. </pre>
  696. <h2 id="Log10">func <a href="http://localhost:6060/src/math/log10.go?s=265:294#L1">Log10</a></h2>
  697. <pre>func Log10(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  698. <p>
  699. Log10 returns the decimal logarithm of x.
  700. The special cases are the same as for Log.
  701. </p>
  702. <h2 id="Log1p">func <a href="http://localhost:6060/src/math/log1p.go?s=3723:3752#L85">Log1p</a></h2>
  703. <pre>func Log1p(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  704. <p>
  705. Log1p returns the natural logarithm of 1 plus its argument x.
  706. It is more accurate than Log(1 + x) when x is near zero.
  707. </p>
  708. <p>
  709. Special cases are:
  710. </p>
  711. <pre>Log1p(+Inf) = +Inf
  712. Log1p(±0) = ±0
  713. Log1p(-1) = -Inf
  714. Log1p(x &lt; -1) = NaN
  715. Log1p(NaN) = NaN
  716. </pre>
  717. <h2 id="Log2">func <a href="http://localhost:6060/src/math/log10.go?s=448:476#L7">Log2</a></h2>
  718. <pre>func Log2(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  719. <p>
  720. Log2 returns the binary logarithm of x.
  721. The special cases are the same as for Log.
  722. </p>
  723. <h2 id="Logb">func <a href="http://localhost:6060/src/math/logb.go?s=300:328#L3">Logb</a></h2>
  724. <pre>func Logb(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  725. <p>
  726. Logb returns the binary exponent of x.
  727. </p>
  728. <p>
  729. Special cases are:
  730. </p>
  731. <pre>Logb(±Inf) = +Inf
  732. Logb(0) = -Inf
  733. Logb(NaN) = NaN
  734. </pre>
  735. <h2 id="Max">func <a href="http://localhost:6060/src/math/dim.go?s=603:633#L16">Max</a></h2>
  736. <pre>func Max(x, y <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  737. <p>
  738. Max returns the larger of x or y.
  739. </p>
  740. <p>
  741. Special cases are:
  742. </p>
  743. <pre>Max(x, +Inf) = Max(+Inf, x) = +Inf
  744. Max(x, NaN) = Max(NaN, x) = NaN
  745. Max(+0, ±0) = Max(±0, +0) = +0
  746. Max(-0, -0) = -0
  747. </pre>
  748. <h2 id="Min">func <a href="http://localhost:6060/src/math/dim.go?s=1072:1102#L43">Min</a></h2>
  749. <pre>func Min(x, y <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  750. <p>
  751. Min returns the smaller of x or y.
  752. </p>
  753. <p>
  754. Special cases are:
  755. </p>
  756. <pre>Min(x, -Inf) = Min(-Inf, x) = -Inf
  757. Min(x, NaN) = Min(NaN, x) = NaN
  758. Min(-0, ±0) = Min(±0, -0) = -0
  759. </pre>
  760. <h2 id="Mod">func <a href="http://localhost:6060/src/math/mod.go?s=483:513#L11">Mod</a></h2>
  761. <pre>func Mod(x, y <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  762. <p>
  763. Mod returns the floating-point remainder of x/y.
  764. The magnitude of the result is less than y and its
  765. sign agrees with that of x.
  766. </p>
  767. <p>
  768. Special cases are:
  769. </p>
  770. <pre>Mod(±Inf, y) = NaN
  771. Mod(NaN, y) = NaN
  772. Mod(x, 0) = NaN
  773. Mod(x, ±Inf) = x
  774. Mod(x, NaN) = NaN
  775. </pre>
  776. <h2 id="Modf">func <a href="http://localhost:6060/src/math/modf.go?s=369:417#L3">Modf</a></h2>
  777. <pre>func Modf(f <a href="../builtin/index.html#float64">float64</a>) (int <a href="../builtin/index.html#float64">float64</a>, frac <a href="../builtin/index.html#float64">float64</a>)</pre>
  778. <p>
  779. Modf returns integer and fractional floating-point numbers
  780. that sum to f. Both values have the same sign as f.
  781. </p>
  782. <p>
  783. Special cases are:
  784. </p>
  785. <pre>Modf(±Inf) = ±Inf, NaN
  786. Modf(NaN) = NaN, NaN
  787. </pre>
  788. <h2 id="NaN">func <a href="http://localhost:6060/src/math/bits.go?s=595:613#L18">NaN</a></h2>
  789. <pre>func NaN() <a href="../builtin/index.html#float64">float64</a></pre>
  790. <p>
  791. NaN returns an IEEE 754 &ldquo;not-a-number&rdquo; value.
  792. </p>
  793. <h2 id="Nextafter">func <a href="http://localhost:6060/src/math/nextafter.go?s=917:957#L25">Nextafter</a></h2>
  794. <pre>func Nextafter(x, y <a href="../builtin/index.html#float64">float64</a>) (r <a href="../builtin/index.html#float64">float64</a>)</pre>
  795. <p>
  796. Nextafter returns the next representable float64 value after x towards y.
  797. </p>
  798. <p>
  799. Special cases are:
  800. </p>
  801. <pre>Nextafter(x, x) = x
  802. Nextafter(NaN, y) = NaN
  803. Nextafter(x, NaN) = NaN
  804. </pre>
  805. <h2 id="Nextafter32">func <a href="http://localhost:6060/src/math/nextafter.go?s=363:405#L3">Nextafter32</a></h2>
  806. <pre>func Nextafter32(x, y <a href="../builtin/index.html#float32">float32</a>) (r <a href="../builtin/index.html#float32">float32</a>)</pre>
  807. <p>
  808. Nextafter32 returns the next representable float32 value after x towards y.
  809. </p>
  810. <p>
  811. Special cases are:
  812. </p>
  813. <pre>Nextafter32(x, x) = x
  814. Nextafter32(NaN, y) = NaN
  815. Nextafter32(x, NaN) = NaN
  816. </pre>
  817. <h2 id="Pow">func <a href="http://localhost:6060/src/math/pow.go?s=1186:1216#L28">Pow</a></h2>
  818. <pre>func Pow(x, y <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  819. <p>
  820. Pow returns x**y, the base-x exponential of y.
  821. </p>
  822. <p>
  823. Special cases are (in order):
  824. </p>
  825. <pre>Pow(x, ±0) = 1 for any x
  826. Pow(1, y) = 1 for any y
  827. Pow(x, 1) = x for any x
  828. Pow(NaN, y) = NaN
  829. Pow(x, NaN) = NaN
  830. Pow(±0, y) = ±Inf for y an odd integer &lt; 0
  831. Pow(±0, -Inf) = +Inf
  832. Pow(±0, +Inf) = +0
  833. Pow(±0, y) = +Inf for finite y &lt; 0 and not an odd integer
  834. Pow(±0, y) = ±0 for y an odd integer &gt; 0
  835. Pow(±0, y) = +0 for finite y &gt; 0 and not an odd integer
  836. Pow(-1, ±Inf) = 1
  837. Pow(x, +Inf) = +Inf for |x| &gt; 1
  838. Pow(x, -Inf) = +0 for |x| &gt; 1
  839. Pow(x, +Inf) = +0 for |x| &lt; 1
  840. Pow(x, -Inf) = +Inf for |x| &lt; 1
  841. Pow(+Inf, y) = +Inf for y &gt; 0
  842. Pow(+Inf, y) = +0 for y &lt; 0
  843. Pow(-Inf, y) = Pow(-0, -y)
  844. Pow(x, y) = NaN for finite x &lt; 0 and finite non-integer y
  845. </pre>
  846. <h2 id="Pow10">func <a href="http://localhost:6060/src/math/pow10.go?s=445:470#L6">Pow10</a></h2>
  847. <pre>func Pow10(e <a href="../builtin/index.html#int">int</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  848. <p>
  849. Pow10 returns 10**e, the base-10 exponential of e.
  850. </p>
  851. <p>
  852. Special cases are:
  853. </p>
  854. <pre>Pow10(e) = +Inf for e &gt; 309
  855. Pow10(e) = 0 for e &lt; -324
  856. </pre>
  857. <h2 id="Remainder">func <a href="http://localhost:6060/src/math/remainder.go?s=1284:1320#L27">Remainder</a></h2>
  858. <pre>func Remainder(x, y <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  859. <p>
  860. Remainder returns the IEEE 754 floating-point remainder of x/y.
  861. </p>
  862. <p>
  863. Special cases are:
  864. </p>
  865. <pre>Remainder(±Inf, y) = NaN
  866. Remainder(NaN, y) = NaN
  867. Remainder(x, 0) = NaN
  868. Remainder(x, ±Inf) = x
  869. Remainder(x, NaN) = NaN
  870. </pre>
  871. <h2 id="Signbit">func <a href="http://localhost:6060/src/math/signbit.go?s=233:261#L1">Signbit</a></h2>
  872. <pre>func Signbit(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#bool">bool</a></pre>
  873. <p>
  874. Signbit returns true if x is negative or negative zero.
  875. </p>
  876. <h2 id="Sin">func <a href="http://localhost:6060/src/math/sin.go?s=5091:5118#L164">Sin</a></h2>
  877. <pre>func Sin(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  878. <p>
  879. Sin returns the sine of the radian argument x.
  880. </p>
  881. <p>
  882. Special cases are:
  883. </p>
  884. <pre>Sin(±0) = ±0
  885. Sin(±Inf) = NaN
  886. Sin(NaN) = NaN
  887. </pre>
  888. <h2 id="Sincos">func <a href="http://localhost:6060/src/math/sincos.go?s=376:417#L5">Sincos</a></h2>
  889. <pre>func Sincos(x <a href="../builtin/index.html#float64">float64</a>) (sin, cos <a href="../builtin/index.html#float64">float64</a>)</pre>
  890. <p>
  891. Sincos returns Sin(x), Cos(x).
  892. </p>
  893. <p>
  894. Special cases are:
  895. </p>
  896. <pre>Sincos(±0) = ±0, 1
  897. Sincos(±Inf) = NaN, NaN
  898. Sincos(NaN) = NaN, NaN
  899. </pre>
  900. <h2 id="Sinh">func <a href="http://localhost:6060/src/math/sinh.go?s=564:592#L15">Sinh</a></h2>
  901. <pre>func Sinh(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  902. <p>
  903. Sinh returns the hyperbolic sine of x.
  904. </p>
  905. <p>
  906. Special cases are:
  907. </p>
  908. <pre>Sinh(±0) = ±0
  909. Sinh(±Inf) = ±Inf
  910. Sinh(NaN) = NaN
  911. </pre>
  912. <h2 id="Sqrt">func <a href="http://localhost:6060/src/math/sqrt.go?s=3704:3732#L82">Sqrt</a></h2>
  913. <pre>func Sqrt(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  914. <p>
  915. Sqrt returns the square root of x.
  916. </p>
  917. <p>
  918. Special cases are:
  919. </p>
  920. <pre>Sqrt(+Inf) = +Inf
  921. Sqrt(±0) = ±0
  922. Sqrt(x &lt; 0) = NaN
  923. Sqrt(NaN) = NaN
  924. </pre>
  925. <h2 id="Tan">func <a href="http://localhost:6060/src/math/tan.go?s=2594:2621#L72">Tan</a></h2>
  926. <pre>func Tan(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  927. <p>
  928. Tan returns the tangent of the radian argument x.
  929. </p>
  930. <p>
  931. Special cases are:
  932. </p>
  933. <pre>Tan(±0) = ±0
  934. Tan(±Inf) = NaN
  935. Tan(NaN) = NaN
  936. </pre>
  937. <h2 id="Tanh">func <a href="http://localhost:6060/src/math/tanh.go?s=2211:2239#L64">Tanh</a></h2>
  938. <pre>func Tanh(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  939. <p>
  940. Tanh returns the hyperbolic tangent of x.
  941. </p>
  942. <p>
  943. Special cases are:
  944. </p>
  945. <pre>Tanh(±0) = ±0
  946. Tanh(±Inf) = ±1
  947. Tanh(NaN) = NaN
  948. </pre>
  949. <h2 id="Trunc">func <a href="http://localhost:6060/src/math/floor.go?s=938:967#L38">Trunc</a></h2>
  950. <pre>func Trunc(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  951. <p>
  952. Trunc returns the integer value of x.
  953. </p>
  954. <p>
  955. Special cases are:
  956. </p>
  957. <pre>Trunc(±0) = ±0
  958. Trunc(±Inf) = ±Inf
  959. Trunc(NaN) = NaN
  960. </pre>
  961. <h2 id="Y0">func <a href="http://localhost:6060/src/math/j0.go?s=4811:4837#L146">Y0</a></h2>
  962. <pre>func Y0(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  963. <p>
  964. Y0 returns the order-zero Bessel function of the second kind.
  965. </p>
  966. <p>
  967. Special cases are:
  968. </p>
  969. <pre>Y0(+Inf) = 0
  970. Y0(0) = -Inf
  971. Y0(x &lt; 0) = NaN
  972. Y0(NaN) = NaN
  973. </pre>
  974. <h2 id="Y1">func <a href="http://localhost:6060/src/math/j1.go?s=4735:4761#L144">Y1</a></h2>
  975. <pre>func Y1(x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  976. <p>
  977. Y1 returns the order-one Bessel function of the second kind.
  978. </p>
  979. <p>
  980. Special cases are:
  981. </p>
  982. <pre>Y1(+Inf) = 0
  983. Y1(0) = -Inf
  984. Y1(x &lt; 0) = NaN
  985. Y1(NaN) = NaN
  986. </pre>
  987. <h2 id="Yn">func <a href="http://localhost:6060/src/math/jn.go?s=6101:6134#L223">Yn</a></h2>
  988. <pre>func Yn(n <a href="../builtin/index.html#int">int</a>, x <a href="../builtin/index.html#float64">float64</a>) <a href="../builtin/index.html#float64">float64</a></pre>
  989. <p>
  990. Yn returns the order-n Bessel function of the second kind.
  991. </p>
  992. <p>
  993. Special cases are:
  994. </p>
  995. <pre>Yn(n, +Inf) = 0
  996. Yn(n &gt; 0, 0) = -Inf
  997. Yn(n &lt; 0, 0) = +Inf if n is odd, -Inf if n is even
  998. Y1(n, x &lt; 0) = NaN
  999. Y1(n, NaN) = NaN
  1000. </pre>
  1001. <h2 id="pkg-subdirectories">Subdirectories</h2>
  1002. <div class="pkg-dir">
  1003. <table>
  1004. <tr>
  1005. <th class="pkg-name">Name</th>
  1006. <th class="pkg-synopsis">Synopsis</th>
  1007. </tr>
  1008. <tr>
  1009. <td colspan="2"><a href="http://localhost:6060/pkg/">..</a></td>
  1010. </tr>
  1011. <tr>
  1012. <td class="pkg-name" style="padding-left: 0px;">
  1013. <a href="big/index.html">big</a>
  1014. </td>
  1015. <td class="pkg-synopsis">
  1016. Package big implements arbitrary-precision arithmetic (big numbers).
  1017. </td>
  1018. </tr>
  1019. <tr>
  1020. <td class="pkg-name" style="padding-left: 0px;">
  1021. <a href="cmplx/index.html">cmplx</a>
  1022. </td>
  1023. <td class="pkg-synopsis">
  1024. Package cmplx provides basic constants and mathematical functions for complex numbers.
  1025. </td>
  1026. </tr>
  1027. <tr>
  1028. <td class="pkg-name" style="padding-left: 0px;">
  1029. <a href="rand/index.html">rand</a>
  1030. </td>
  1031. <td class="pkg-synopsis">
  1032. Package rand implements pseudo-random number generators.
  1033. </td>
  1034. </tr>
  1035. </table>
  1036. </div>
  1037. <div id="footer">
  1038. Build version go1.6.<br>
  1039. Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
  1040. the content of this page is licensed under the
  1041. Creative Commons Attribution 3.0 License,
  1042. and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
  1043. <a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
  1044. <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
  1045. </div>
  1046. </div><!-- .container -->
  1047. </div><!-- #page -->
  1048. <!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
  1049. <script type="text/javascript" src="../../lib/godoc/jquery.js"></script>
  1050. <script type="text/javascript" src="../../lib/godoc/jquery.treeview.js"></script>
  1051. <script type="text/javascript" src="../../lib/godoc/jquery.treeview.edit.js"></script>
  1052. <script type="text/javascript" src="../../lib/godoc/godocs.js"></script>
  1053. </body>
  1054. </html>