<html><head><metahttp-equiv="X-UA-Compatible"content="IE=edge"/><linkrel="shortcut icon"href="../icons/favicon.ico"/><linkrel="stylesheet"type="text/css"href="../styles/branding.css"/><linkrel="stylesheet"type="text/css"href="../styles/branding-en-US.css"/><scripttype="text/javascript"src="../scripts/branding.js"></script><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><title>gmp_lib.mpq_canonicalize Method </title><metaname="Language"content="en-us"/><metaname="System.Keywords"content="mpq_canonicalize method"/><metaname="System.Keywords"content="gmp_lib.mpq_canonicalize method"/><metaname="Microsoft.Help.F1"content="Math.Gmp.Native.gmp_lib.mpq_canonicalize"/><metaname="Microsoft.Help.Id"content="M:Math.Gmp.Native.gmp_lib.mpq_canonicalize(Math.Gmp.Native.mpq_t)"/><metaname="Description"content="Remove any factors that are common to the numerator and denominator of , and make the denominator positive."/><metaname="Microsoft.Help.ContentType"content="Reference"/><metaname="BrandingAware"content="true"/><metaname="container"content="Math.Gmp.Native"/><metaname="file"content="19d53697-65f1-2df5-62f3-988182af0c88"/><metaname="guid"content="19d53697-65f1-2df5-62f3-988182af0c88"/><linktype="text/css"rel="stylesheet"href="../styles/highlight.css"/><scripttype="text/javascript"src="../scripts/highlight.js"></script><linkrel="stylesheet"type="text/css"href="../styles/branding-Website.css"/><scripttype="text/javascript"src="../scripts/jquery-1.11.0.min.js"></script><scripttype="text/javascript"src="../scripts/branding-Website.js"></script><scripttype="text/javascript"src="../scripts/clipboard.min.js"></script></head><bodyonload="OnLoad('cs')"><inputtype="hidden"id="userDataCache"class="userDataStyle"/><divclass="pageHeader"id="PageHeader">GMP Native Interface for .NET<formid="SearchForm"method="get"action="#"onsubmit="javascript:TransferToSearchPage(); return false;"><inputid="SearchTextBox"type="text"maxlength="200"/><buttonid="SearchButton"type="submit"></button></form></div><divclass="pageBody"><divclass="leftNav"id="leftNav"><divid="tocNav"><divclass="toclevel0"data-toclevel="0"><aclass="tocCollapsed"onclick="javascript: Toggle(this);"href="#!"/><adata-tochassubtree="true"href="846f5c8a-6cba-433e-9f18-cde2ff5695cd.htm"title="GMP Native Interface for .NET"tocid="roottoc">GMP Native Interface for .NET</a></div><divclass="toclevel0"data-toclevel="0"><aclass="tocCollapsed"onclick="javascript: Toggle(this);"href="#!"/><adata-tochassubtree="true"href="d9c51b9f-0c54-770b-28ea-6eebd8fef368.htm"title="Math.Gmp.Native"tocid="d9c51b9f-0c54-770b-28ea-6eebd8fef368">Math.Gmp.Native</a></div><divclass="toclevel0"data-toclevel="0"><aclass="tocCollapsed"onclick="javascript: Toggle(this);"href="#!"/><adata-tochassubtree="true"href="3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm"title="gmp_lib Class"tocid="3af6b34c-3242-2b75-e7c7-ab79af8a4b0f">gmp_lib Class</a></div><divclass="toclevel1"data-toclevel="1"data-childrenloaded="true"><aclass="tocExpanded"onclick="javascript: Toggle(this);"href="#!"/><adata-tochassubtree="true"href="0fa7cbf3-e8f4-6b14-d829-8aa663e77c74.htm"title="gmp_lib Methods"tocid="0fa7cbf3-e8f4-6b14-d829-8aa663e77c74">gmp_lib Methods</a></div><divclass="toclevel2"data-toclevel="2"><adata-tochassubtree="false"href="c9cb6a67-59b8-5c03-f31d-f252441c53f6.htm"title="_mpz_realloc Method "tocid="c9cb6a67-59b8-5c03-f31d-f252441c53f6">_mpz_realloc Method </a></div><divclass="toclevel2"data-toclevel="2"><adata-tochassubtree="false"href="2c68671c-cd5c-e2ec-52a2-65b0ca31c3d1.htm"title="allocate Method "tocid="2c68671c-cd5c-e2ec-52a2-65b0ca31c3d1">allocate Method </a></div><divclass="toclevel2"data-toclevel="2"><aclass="tocCollapsed"onclick="javascript: Toggle(this);"href="#!"/><adata-tochassubtree="true"href="92160da3-b1af-e005-cb05-e3fb4dd524d8.htm"title="free Method "tocid="92160da3-b1af-e005-cb05-e3fb4dd524d8">free Method </a></div><divclass="toclevel2"data-toclevel="2
</pre></div></div></div><scripttype="text/javascript">AddLanguageTabSet("ID0EDCA");</script><h4class="subHeading">Parameters</h4><dl><dt><spanclass="parameter">op</span></dt><dd>Type:<ahref="635f1879-5f85-881e-cca8-3222baf5045a.htm">Math.Gmp.Native<spanid="LST9F394B14_1"></span><scripttype="text/javascript">AddLanguageSpecificTextSet("LST9F394B14_1?cs=.|vb=.|cpp=::|nu=.|fs=.");</script>mpq_t</a><br/>The operand rational.</dd></dl></div><divclass="collapsibleAreaRegion"><spanclass="collapsibleRegionTitle"onclick="SectionExpandCollapse('ID2RB')"onkeypress="SectionExpandCollapse_CheckKey('ID2RB', event)"tabindex="0"><imgid="ID2RBToggle"class="collapseToggle"src="../icons/SectionExpanded.png"/>Examples</span></div><divid="ID2RBSection"class="collapsibleSection"><divclass="codeSnippetContainer"><divclass="codeSnippetContainerTabs"><divid="ID0EDAABA_tab1"class="codeSnippetContainerTab"><ahref="#"onclick="javascript:ChangeTab('ID0EDAABA','cs','1','4');return false;">C#</a></div><divid="ID0EDAABA_tab2"class="codeSnippetContainerTab"><ahref="#"onclick="javascript:ChangeTab('ID0EDAABA','vb','2','4');return false;">VB</a></div><divid="ID0EDAABA_tab3"class="codeSnippetContainerTabPhantom"><ahref="#"onclick="javascript:ChangeTab('ID0EDAABA','cpp','3','4');return false;">C++</a></div><divid="ID0EDAABA_tab4"class="codeSnippetContainerTabPhantom"><ahref="#"onclick="javascript:ChangeTab('ID0EDAABA','fs','4','4');return false;">F#</a></div></div><divclass="codeSnippetContainerCodeContainer"><divclass="codeSnippetToolBar"><divclass="codeSnippetToolBarText"><aid="ID0EDAABA_copyCode"href="#"class="copyCodeSnippet"onclick="javascript:CopyToClipboard('ID0EDAABA');return false;"title="Copy">Copy</a></div></div><divid="ID0EDAABA_code_Div1"class="codeSnippetContainerCode"style="display: block"><prexml:space="preserve"></pre></div><divid="ID0EDAABA_code_Div2"class="codeSnippetContainerCode"style="display: none"><prexml:space="preserve"></pre></div><divid="ID0EDAABA_code_Div3"class="codeSnippetContainerCode"style="display: none"><p>No code example is currently available or this language may not be supported.</p></div><divid="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><scripttype="text/javascript">AddLanguageTabSet("ID0EDAABA");</script></div><divclass="collapsibleAreaRegion"id="seeAlsoSection"><spanclass="collapsibleRegionTitle"onclick="SectionExpandCollapse('ID3RB')"onkeypress="SectionExpandCollapse_CheckKey('ID3RB', event)"tabindex="0"><imgid="ID3RBToggle"class="collapseToggle"src="../icons/SectionExpanded.png"/>See Also</span></div><divid="ID3RBSection"class="collapsibleSection"><h4class="subHeading">Reference</h4><divclass="seeAlsoStyle"><ahref="3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm">gmp_lib Class</a></div><divclass="seeAlsoStyle"><ahref="d9c51b9f-0c54-770b-28ea-6eebd8fef368.htm">Math.Gmp.Native Namespace</a></div><divclass="seeAlsoStyle"><ahref="dbf3d252-fd6d-455f-2ba7-4091845b86a7.htm">mpq_init</a></div><divclass="seeAlsoStyle"><ahref="8ab8ea40-9723-f0c8-18f4-9558c73397b9.htm">mpq_inits</a></div><divclass="seeAlsoStyle"><ahref="cc2693e9-1cc5-3098-f2f7-bb05c8017f62.htm">mpq_clears</a></div><divclass="seeAlsoStyle"><ahref="9eac8ea9-0821-09b2-8091-e6638c562c7f.htm">mpq_set</a></div><divclass="seeAlsoStyle"><ahref="84d256a1-cd11-3bf9-3e8c-8a7e1980315d.htm">mpq_set_z</a></div><divclass="seeAlsoStyle"><ahref="915a7958-6821-bb64-468f-b0b48b351878.htm">mpq_set_ui</a></div><divclass="seeAlsoStyle"><ahref="ba898f37-20d0-a5cd-eff1-0663f18220dd.htm">mpq_set_si</a></div><divclass="seeAlsoStyle"><ahref="e98ec3cf-b539-8024-c401-ecd24bd43662.htm">mpq_set_str</a></div><divclass="seeAlsoStyle"><ahref="11e36fbc-ffc4-46df-50b7-2b07684c1755.htm">mpq_swap</a></div><divclass="seeAlsoStyle"><ahref="3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm"><ahref="/html/3af6b34c-3242-2b75-e7c7-ab79af8a4b0f.htm#Initializing_Rationals">Initializing Rati