2017-12-03 23:32:51 +01:00
< html > < head > < meta http-equiv = "X-UA-Compatible" content = "IE=edge" / > < link rel = "shortcut icon" href = "../icons/favicon.ico" / > < link rel = "stylesheet" type = "text/css" href = "../styles/branding.css" / > < link rel = "stylesheet" type = "text/css" href = "../styles/branding-en-US.css" / > < script type = "text/javascript" src = "../scripts/branding.js" > < / script > < meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" / > < title > gmp_lib.mpf_init Method < / title > < meta name = "Language" content = "en-us" / > < meta name = "System.Keywords" content = "mpf_init method" / > < meta name = "System.Keywords" content = "gmp_lib.mpf_init method" / > < meta name = "Microsoft.Help.F1" content = "Math.Gmp.Native.gmp_lib.mpf_init" / > < meta name = "Microsoft.Help.Id" content = "M:Math.Gmp.Native.gmp_lib.mpf_init(Math.Gmp.Native.mpf_t)" / > < meta name = "Description" content = "Initialize to 0." / > < meta name = "Microsoft.Help.ContentType" content = "Reference" / > < meta name = "BrandingAware" content = "true" / > < meta name = "container" content = "Math.Gmp.Native" / > < meta name = "file" content = "0dd846ac-56b6-3ea8-0441-12490f67fbf7" / > < meta name = "guid" content = "0dd846ac-56b6-3ea8-0441-12490f67fbf7" / > < link type = "text/css" rel = "stylesheet" href = "../styles/highlight.css" / > < script type = "text/javascript" src = "../scripts/highlight.js" > < / script > < link rel = "stylesheet" type = "text/css" href = "../styles/branding-Website.css" / > < script type = "text/javascript" src = "../scripts/jquery-1.11.0.min.js" > < / script > < script type = "text/javascript" src = "../scripts/branding-Website.js" > < / script > < script type = "text/javascript" src = "../scripts/clipboard.min.js" > < / script > < / head > < body onload = "OnLoad('cs')" > < input type = "hidden" id = "userDataCache" class = "userDataStyle" / > < div class = "pageHeader" id = "PageHeader" > GMP Native Interface for .NET< form id = "SearchForm" method = "get" action = "#" onsubmit = "javascript:TransferToSearchPage(); return false;" > < input id = "SearchTextBox" type = "text" maxlength = "200" / > < button id = "SearchButton" type = "submit" > < / button > < / form > < / div > < div class = "pageBody" > < div class = "leftNav" id = "leftNav" > < div id = "tocNav" > < div class = "toclevel0" data-toclevel = "0" > < a class = "tocCollapsed" onclick = "javascript: Toggle(this);" href = "#!" / > < a data-tochassubtree = "true" href = "846f5c8a-6cba-433e-9f18-cde2ff5695cd.htm" title = "GMP Native Interface for .NET" tocid = "roottoc" > GMP Native Interface for .NET< / a > < / div > < div class = "toclevel0" data-toclevel = "0" > < a class = "tocCollapsed" onclick = "javascript: Toggle(this);" href = "#!" / > < a data-tochassubtree = "true" href = "d9c51b9f-0c54-770b-28ea-6eebd8fef368.htm" title = "Math.Gmp.Native" tocid = "d9c51b9f-0c54-770b-28ea-6eebd8fef368" > Math.Gmp.Native< / a > < / div > < div class = "toclevel0" data-toclevel = "0" > < a class = "tocCollapsed" onclick = "javascript: Toggle(this);" href = "#!" / > < a data-tochassubtree = "true" href = "3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm" title = "gmp_lib Class" tocid = "3af6b34c-3242-2b75-e7c7-ab79af8a4b0f" > gmp_lib Class< / a > < / div > < div class = "toclevel1" data-toclevel = "1" data-childrenloaded = "true" > < a class = "tocExpanded" onclick = "javascript: Toggle(this);" href = "#!" / > < a data-tochassubtree = "true" href = "0fa7cbf3-e8f4-6b14-d829-8aa663e77c74.htm" title = "gmp_lib Methods" tocid = "0fa7cbf3-e8f4-6b14-d829-8aa663e77c74" > gmp_lib Methods< / a > < / div > < div class = "toclevel2" data-toclevel = "2" > < a data-tochassubtree = "false" href = "c9cb6a67-59b8-5c03-f31d-f252441c53f6.htm" title = "_mpz_realloc Method " tocid = "c9cb6a67-59b8-5c03-f31d-f252441c53f6" > _mpz_realloc Method < / a > < / div > < div class = "toclevel2" data-toclevel = "2" > < a data-tochassubtree = "false" href = "2c68671c-cd5c-e2ec-52a2-65b0ca31c3d1.htm" title = "allocate Method " tocid = "2c68671c-cd5c-e2ec-52a2-65b0ca31c3d1" > allocate Method < / a > < / div > < div class = "toclevel2" data-toclevel = "2" > < a class = "tocCollapsed" onclick = "javascript: Toggle(this);" href = "#!" / > < a data-tochassubtree = "true" href = "92160da3-b1af-e005-cb05-e3fb4dd524d8.htm" title = "free Method " tocid = "92160da3-b1af-e005-cb05-e3fb4dd524d8" > free Method < / a > < / div > < div class = "toclevel2" data-toclevel = "2" > < a data-tochassubtree = "false" href = "fe6e46c3-8464-a080-b5fc-718589320cd5.htm" title = "gmp_asprintf Method " tocid = "fe6e46c3-8464-a
2017-11-08 01:29:10 +01:00
Initialize < span class = "parameter" > x< / span > to 0.
2017-11-04 16:02:37 +01:00
< / div > < p > < / p >
< strong > Namespace:< / strong >
< a href = "d9c51b9f-0c54-770b-28ea-6eebd8fef368.htm" > Math.Gmp.Native< / a > < br / >
< strong > Assembly:< / strong >
Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)< div class = "collapsibleAreaRegion" > < span class = "collapsibleRegionTitle" onclick = "SectionExpandCollapse('ID1RB')" onkeypress = "SectionExpandCollapse_CheckKey('ID1RB', event)" tabindex = "0" > < img id = "ID1RBToggle" class = "collapseToggle" src = "../icons/SectionExpanded.png" / > Syntax< / span > < / div > < div id = "ID1RBSection" class = "collapsibleSection" > < div class = "codeSnippetContainer" > < div class = "codeSnippetContainerTabs" > < div id = "ID0EDCA_tab1" class = "codeSnippetContainerTab" > < a href = "#" onclick = "javascript:ChangeTab('ID0EDCA','cs','1','4');return false;" > C#< / a > < / div > < div id = "ID0EDCA_tab2" class = "codeSnippetContainerTab" > < a href = "#" onclick = "javascript:ChangeTab('ID0EDCA','vb','2','4');return false;" > VB< / a > < / div > < div id = "ID0EDCA_tab3" class = "codeSnippetContainerTab" > < a href = "#" onclick = "javascript:ChangeTab('ID0EDCA','cpp','3','4');return false;" > C++< / a > < / div > < div id = "ID0EDCA_tab4" class = "codeSnippetContainerTab" > < a href = "#" onclick = "javascript:ChangeTab('ID0EDCA','fs','4','4');return false;" > F#< / a > < / div > < / div > < div class = "codeSnippetContainerCodeContainer" > < div class = "codeSnippetToolBar" > < div class = "codeSnippetToolBarText" > < a id = "ID0EDCA_copyCode" href = "#" class = "copyCodeSnippet" onclick = "javascript:CopyToClipboard('ID0EDCA');return false;" title = "Copy" > Copy< / a > < / div > < / div > < div id = "ID0EDCA_code_Div1" class = "codeSnippetContainerCode" style = "display: block" > < pre xml:space = "preserve" > < span class = "keyword" > public< / span > < span class = "keyword" > static< / span > < span class = "keyword" > void< / span > < span class = "identifier" > mpf_init< / span > (
< span class = "identifier" > mpf_t< / span > < span class = "parameter" > x< / span >
)< / pre > < / div > < div id = "ID0EDCA_code_Div2" class = "codeSnippetContainerCode" style = "display: none" > < pre xml:space = "preserve" > < span class = "keyword" > Public< / span > < span class = "keyword" > Shared< / span > < span class = "keyword" > Sub< / span > < span class = "identifier" > mpf_init< / span > (
< span class = "parameter" > x< / span > < span class = "keyword" > As< / span > < span class = "identifier" > mpf_t< / span >
)< / pre > < / div > < div id = "ID0EDCA_code_Div3" class = "codeSnippetContainerCode" style = "display: none" > < pre xml:space = "preserve" > < span class = "keyword" > public< / span > :
< span class = "keyword" > static< / span > < span class = "keyword" > void< / span > < span class = "identifier" > mpf_init< / span > (
< span class = "identifier" > mpf_t< / span > ^ < span class = "parameter" > x< / span >
)< / pre > < / div > < div id = "ID0EDCA_code_Div4" class = "codeSnippetContainerCode" style = "display: none" > < pre xml:space = "preserve" > < span class = "keyword" > static< / span > < span class = "keyword" > member< / span > < span class = "identifier" > mpf_init< / span > :
< span class = "parameter" > x< / span > : < span class = "identifier" > mpf_t< / span > < span class = "keyword" > -> < / span > < span class = "keyword" > unit< / span >
< / pre > < / div > < / div > < / div > < script type = "text/javascript" > AddLanguageTabSet ( "ID0EDCA" ) ; < / script > < h4 class = "subHeading" > Parameters< / h4 > < dl > < dt > < span class = "parameter" > x< / span > < / dt > < dd > Type: < a href = "37c88d6c-8d02-2330-ad77-f20fb73d1677.htm" > Math.Gmp.Native< span id = "LST8CFCCA5C_1" > < / span > < script type = "text/javascript" > AddLanguageSpecificTextSet ( "LST8CFCCA5C_1?cs=.|vb=.|cpp=::|nu=.|fs=." ) ; < / script > mpf_t< / a > < br / > The operand float.< / dd > < / dl > < / div > < div class = "collapsibleAreaRegion" > < span class = "collapsibleRegionTitle" onclick = "SectionExpandCollapse('ID2RB')" onkeypress = "SectionExpandCollapse_CheckKey('ID2RB', event)" tabindex = "0" > < img id = "ID2RBToggle" class = "collapseToggle" src = "../icons/SectionExpanded.png" / > Remarks< / span > < / div > < div id = "ID2RBSection" class = "collapsibleSection" > < p >
2017-12-15 02:18:55 +01:00
Normally, a variable should be initialized once only or at least be cleared, using < a href = "3a2a17ed-a64c-8716-7f65-18c661a5279f.htm" > mpf_clear< / a > ,
2017-11-04 16:02:37 +01:00
between initializations. The precision of < span class = "parameter" > x< / span > is undefined unless a default precision has
2017-12-15 02:18:55 +01:00
already been established by a call to < a href = "9e93d02e-f5c7-1a6f-68fe-a33d793a93e2.htm" > mpf_set_default_prec< / a > .
2017-11-04 16:02:37 +01:00
< / p > < / div > < div class = "collapsibleAreaRegion" > < span class = "collapsibleRegionTitle" onclick = "SectionExpandCollapse('ID3RB')" onkeypress = "SectionExpandCollapse_CheckKey('ID3RB', event)" tabindex = "0" > < img id = "ID3RBToggle" class = "collapseToggle" src = "../icons/SectionExpanded.png" / > Examples< / span > < / div > < div id = "ID3RBSection" class = "collapsibleSection" > < div class = "codeSnippetContainer" > < div class = "codeSnippetContainerTabs" > < div id = "ID0EDAABA_tab1" class = "codeSnippetContainerTab" > < a href = "#" onclick = "javascript:ChangeTab('ID0EDAABA','cs','1','4');return false;" > C#< / a > < / div > < div id = "ID0EDAABA_tab2" class = "codeSnippetContainerTab" > < a href = "#" onclick = "javascript:ChangeTab('ID0EDAABA','vb','2','4');return false;" > VB< / a > < / div > < div id = "ID0EDAABA_tab3" class = "codeSnippetContainerTabPhantom" > < a href = "#" onclick = "javascript:ChangeTab('ID0EDAABA','cpp','3','4');return false;" > C++< / a > < / div > < div id = "ID0EDAABA_tab4" class = "codeSnippetContainerTabPhantom" > < a href = "#" onclick = "javascript:ChangeTab('ID0EDAABA','fs','4','4');return false;" > F#< / a > < / div > < / div > < div class = "codeSnippetContainerCodeContainer" > < div class = "codeSnippetToolBar" > < div class = "codeSnippetToolBarText" > < a id = "ID0EDAABA_copyCode" href = "#" class = "copyCodeSnippet" onclick = "javascript:CopyToClipboard('ID0EDAABA');return false;" title = "Copy" > Copy< / a > < / div > < / div > < div id = "ID0EDAABA_code_Div1" class = "codeSnippetContainerCode" style = "display: block" > < pre xml:space = "preserve" > < span class = "highlight-comment" > // Set default precision to 64 bits.< / span >
gmp_lib.mpf_set_default_prec(< span class = "highlight-number" > 64< / span > U);
< span class = "highlight-comment" > // Create and initialize a new floating-point number x.< / span >
mpf_t x = < span class = "highlight-keyword" > new< / span > mpf_t();
gmp_lib.mpf_init(x);
< span class = "highlight-comment" > // Assert that the value of x is 0.0.< / span >
Assert.IsTrue(gmp_lib.mpf_get_d(x) == < span class = "highlight-number" > 0.0< / span > );
< span class = "highlight-comment" > // Release unmanaged memory allocated for x.< / span >
gmp_lib.mpf_clear(x);< / pre > < / div > < div id = "ID0EDAABA_code_Div2" class = "codeSnippetContainerCode" style = "display: none" > < pre xml:space = "preserve" > < span class = "highlight-comment" > ' Set default precision to 64 bits.< / span >
gmp_lib.mpf_set_default_prec(< span class = "highlight-number" > 64< / span > UI)
< span class = "highlight-comment" > ' Create and initialize a new floating-point number x.< / span >
< span class = "highlight-keyword" > Dim< / span > x < span class = "highlight-keyword" > As< / span > < span class = "highlight-keyword" > New< / span > mpf_t()
gmp_lib.mpf_init(x)
< span class = "highlight-comment" > ' Assert that the value of x is 0.0.< / span >
Assert.IsTrue(gmp_lib.mpf_get_d(x) = < span class = "highlight-number" > 0.0< / span > )
< span class = "highlight-comment" > ' Release unmanaged memory allocated for x.< / span >
2017-12-15 02:18:55 +01:00
gmp_lib.mpf_clear(x)< / pre > < / div > < div id = "ID0EDAABA_code_Div3" class = "codeSnippetContainerCode" style = "display: none" > < p > No code example is currently available or this language may not be supported.< / p > < / div > < div id = "ID0EDAABA_code_Div4" class = "codeSnippetContainerCode" style = "display: none" > < p > No code example is currently available or this language may not be supported.< / p > < / div > < / div > < / div > < script type = "text/javascript" > AddLanguageTabSet ( "ID0EDAABA" ) ; < / script > < / div > < div class = "collapsibleAreaRegion" id = "seeAlsoSection" > < span class = "collapsibleRegionTitle" onclick = "SectionExpandCollapse('ID4RB')" onkeypress = "SectionExpandCollapse_CheckKey('ID4RB', event)" tabindex = "0" > < img id = "ID4RBToggle" class = "collapseToggle" src = "../icons/SectionExpanded.png" / > See Also< / span > < / div > < div id = "ID4RBSection" class = "collapsibleSection" > < h4 class = "subHeading" > Reference< / h4 > < div class = "seeAlsoStyle" > < a href = "3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm" > gmp_lib Class< / a > < / div > < div class = "seeAlsoStyle" > < a href = "d9c51b9f-0c54-770b-28ea-6eebd8fef368.htm" > Math.Gmp.Native Namespace< / a > < / div > < div class = "seeAlsoStyle" > < a href = "9e93d02e-f5c7-1a6f-68fe-a33d793a93e2.htm" > mpf_set_default_prec< / a > < / div > < div class = "seeAlsoStyle" > < a href = "1ca4ec7e-b5d1-3b51-8341-5a345990e62d.htm" > mpf_get_default_prec< / a > < / div > < div class = "seeAlsoStyle" > < a href = "98083eac-9993-41b2-4943-678785fce712.htm" > mpf_init2< / a > < / div > < div class = "seeAlsoStyle" > < a href = "018278a0-148f-c898-5bd0-42aae4ae0069.htm" > mpf_inits< / a > < / div > < div class = "seeAlsoStyle" > < a href = "3a2a17ed-a64c-8716-7f65-18c661a5279f.htm" > mpf_clear< / a > < / div > < div class = "seeAlsoStyle" > < a href = "bfb87570-3b2e-079a-1528-3746424bbdef.htm" > mpf_clears< / a > < / div > < div class = "seeAlsoStyle" > < a href = "96c4a09e-3f83-00ab-30d0-78a82764b0ce.htm" > mpf_get_prec< / a > < / div > < div class = "seeAlsoStyle" > < a href = "438e6843-fc7b-4e6f-9ac0-d97a2773b032.htm" > mpf_set_prec< / a > < / div > < div class = "seeAlsoStyle" > < a href = "b456f637-83f4-9d4f-18c5-052d77fbf981.htm" > mpf_set_prec_raw< / a > < / div > < div class = "seeAlsoStyle" > < a href = "3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm" > < a href = "/html/3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm#Initializing_Floats" > Initializing Floats< / a > < / a > < / div > < div class = "seeAlsoStyle" > < a href = "3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm" > < a href = "https://gmplib.org/manual/Initializing-Floats.html#Initializing-Floats" > GNU MP - Initializing Floats< / a > < / a > < / div > < / div > < / div > < / div > < div id = "pageFooter" class = "pageFooter" > < / div > < / body > < / html >