2017-11-06 13:38:19 +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.mpn_perfect_square_p Method < / title > < meta name = "Language" content = "en-us" / > < meta name = "System.Keywords" content = "mpn_perfect_square_p method" / > < meta name = "System.Keywords" content = "gmp_lib.mpn_perfect_square_p method" / > < meta name = "Microsoft.Help.F1" content = "Math.Gmp.Native.gmp_lib.mpn_perfect_square_p" / > < meta name = "Microsoft.Help.Id" content = "M:Math.Gmp.Native.gmp_lib.mpn_perfect_square_p(Math.Gmp.Native.mp_ptr,Math.Gmp.Native.mp_size_t)" / > < meta name = "Description" content = "Return non-zero iff {, } is a perfect square." / > < meta name = "Microsoft.Help.ContentType" content = "Reference" / > < meta name = "BrandingAware" content = "true" / > < meta name = "container" content = "Math.Gmp.Native" / > < meta name = "file" content = "a5dfd9bc-f86b-8a3b-69fc-8d2d5dea30ae" / > < meta name = "guid" content = "a5dfd9bc-f86b-8a3b-69fc-8d2d5dea30ae" / > < 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-tocha
2017-11-04 16:02:37 +01:00
Return non-zero iff {< span class = "parameter" > s1p< / span > , < span class = "parameter" > n< / span > } is a perfect square.
< / 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 = "identifier" > int< / span > < span class = "identifier" > mpn_perfect_square_p< / span > (
< span class = "identifier" > mp_ptr< / span > < span class = "parameter" > s1p< / span > ,
< span class = "identifier" > mp_size_t< / span > < span class = "parameter" > n< / 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" > Function< / span > < span class = "identifier" > mpn_perfect_square_p< / span > (
< span class = "parameter" > s1p< / span > < span class = "keyword" > As< / span > < span class = "identifier" > mp_ptr< / span > ,
< span class = "parameter" > n< / span > < span class = "keyword" > As< / span > < span class = "identifier" > mp_size_t< / span >
) < span class = "keyword" > As< / span > < span class = "identifier" > Integer< / 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 = "identifier" > int< / span > < span class = "identifier" > mpn_perfect_square_p< / span > (
< span class = "identifier" > mp_ptr< / span > ^ < span class = "parameter" > s1p< / span > ,
< span class = "identifier" > mp_size_t< / span > < span class = "parameter" > n< / 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" > mpn_perfect_square_p< / span > :
< span class = "parameter" > s1p< / span > : < span class = "identifier" > mp_ptr< / span > *
< span class = "parameter" > n< / span > : < span class = "identifier" > mp_size_t< / span > < span class = "keyword" > -> < / span > < span class = "identifier" > int< / span >
< / pre > < / div > < / div > < / div > < script type = "text/javascript" > AddLanguageTabSet ( "ID0EDCA" ) ; < / script > < h4 class = "subHeading" > Parameters< / h4 > < dl > < dt > < span class = "parameter" > s1p< / span > < / dt > < dd > Type: < a href = "4609ac5e-5cf9-cd20-2fa9-8040101c165c.htm" > Math.Gmp.Native< span id = "LST107DDE62_1" > < / span > < script type = "text/javascript" > AddLanguageSpecificTextSet ( "LST107DDE62_1?cs=.|vb=.|cpp=::|nu=.|fs=." ) ; < / script > mp_ptr< / a > < br / > The operand integer.< / dd > < dt > < span class = "parameter" > n< / span > < / dt > < dd > Type: < a href = "4b58a584-7a0e-b600-18fa-ebd493861eb3.htm" > Math.Gmp.Native< span id = "LST107DDE62_2" > < / span > < script type = "text/javascript" > AddLanguageSpecificTextSet ( "LST107DDE62_2?cs=.|vb=.|cpp=::|nu=.|fs=." ) ; < / script > mp_size_t< / a > < br / > The numbe rof limbs of < span class = "parameter" > s1p< / span > .< / dd > < / dl > < h4 class = "subHeading" > Return Value< / h4 > Type: < a href = "http://msdn2.microsoft.com/en-us/library/td2s409d" target = "_blank" > Int32< / a > < br / > Non-zero iff {< span class = "parameter" > s1p< / span > , < span class = "parameter" > n< / span > } is a perfect square.< / 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 >
The most significant limb of the input {< span class = "parameter" > s1p< / span > , < span class = "parameter" > n< / span > } must be non-zero.
< / 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" > // Create multi-precision operand.< / span >
mp_ptr s1p = < span class = "highlight-keyword" > new< / span > mp_ptr(< span class = "highlight-keyword" > new< / span > < span class = "highlight-keyword" > uint< / span > [] { < span class = "highlight-number" > 0xffffffff< / span > , < span class = "highlight-number" > 0xffffffff< / span > });
< span class = "highlight-comment" > // Assert s1p is not a perfect square.< / span >
Assert.IsTrue(gmp_lib.mpn_perfect_square_p(s1p, s1p.Size) == < span class = "highlight-number" > 0< / span > );
< span class = "highlight-comment" > // Release unmanaged memory.< / span >
gmp_lib.free(s1p);< / pre > < / div > < div id = "ID0EDAABA_code_Div2" class = "codeSnippetContainerCode" style = "display: none" > < pre xml:space = "preserve" > < span class = "highlight-comment" > ' Create multi-precision operand.< / span >
< span class = "highlight-keyword" > Dim< / span > s1p < span class = "highlight-keyword" > As< / span > < span class = "highlight-keyword" > New< / span > mp_ptr(< span class = "highlight-keyword" > New< / span > < span class = "highlight-keyword" > UInteger< / span > () { < span class = "highlight-number" > & Hffffffff< / span > UI, < span class = "highlight-number" > & Hffffffff< / span > UI})
< span class = "highlight-comment" > ' Assert s1p is not a perfect square.< / span >
Assert.IsTrue(gmp_lib.mpn_perfect_square_p(s1p, s1p.Size) = < span class = "highlight-number" > 0< / span > )
< span class = "highlight-comment" > ' Release unmanaged memory.< / span >
gmp_lib.free(s1p)< / 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 = "4fcc5434-e328-6730-f46e-bd0823ec7560.htm" > gmp_lib< span id = "LST107DDE62_3" > < / span > < script type = "text/javascript" > AddLanguageSpecificTextSet ( "LST107DDE62_3?cs=.|vb=.|cpp=::|nu=.|fs=." ) ; < / script > mpn_cmp(mp_ptr, mp_ptr, mp_size_t)< / a > < / div > < div class = "seeAlsoStyle" > < a href = "61401484-d06f-ab9e-110d-b46f4d0a9eba.htm" > gmp_lib< span id = "LST107DDE62_4" > < / span > < script type = "text/javascript" > AddLanguageSpecificTextSet ( "LST107DDE62_4?cs=.|vb=.|cpp=::|nu=.|fs=." ) ; < / script > mpn_perfect_power_p(mp_ptr, mp_size_t)< / a > < / div > < div class = "seeAlsoStyle" > < a href = "2e469258-d5e3-da86-aebe-025b92d7cf73.htm" > gmp_lib< span id = "LST107DDE62_5" > < / span > < script type = "text/javascript" > AddLanguageSpecificTextSet ( "LST107DDE62_5?cs=.|vb=.|cpp=::|nu=.|fs=." ) ; < / script > mpn_zero_p(mp_ptr, mp_size_t)< / a > < / div > < div class = "seeAlsoStyle" > < a href = "3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm" > < a href = "https://gmplib.org/manual/Low_002dlevel-Functions.html#Low_002dlevel-Functions" > GNU MP - Low-level Functions< / a > < / a > < / div > < / div > < / div > < / div > < div id = "pageFooter" class = "pageFooter" > < / div > < / body > < / html >