<!DOCTYPE html><htmllang='en'><head><title>[qty.get.common.base]</title><metacharset='UTF-8'/><linkrel='stylesheet'type='text/css'href='14882.css'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Serif'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Sans'/><linkrel='stylesheet'type='text/css'href='https://fonts.googleapis.com/css2?family=Noto+Sans+Mono'/><linkrel='icon'href='icon.png'/><linkrel='stylesheet'type='text/css'href='expanded.css'title='Normal'/><linkrel='alternate stylesheet'type='text/css'href='colored.css'title='Notes and examples colored'/><linkrel='alternate stylesheet'type='text/css'href='normative-only.css'title='Notes and examples hidden'/></head><body><divclass='wrapper'><h1><aclass='secnum'style='min-width:50pt'>5</a> Quantities and units library <aclass='abbr_ref'href='index.html#quantities'>[quantities]</a></h1><h2><aclass='secnum'style='min-width:65pt'>5.4</a> Reference <aclass='abbr_ref'href='qty.ref.html#qty.get.common.base'>[qty.ref]</a></h2><h3><aclass='secnum'style='min-width:80pt'>5.4.3</a> Quantity specification <aclass='abbr_ref'href='qty.spec.html#qty.get.common.base'>[qty.spec]</a></h3><h4><aclass='secnum'style='min-width:95pt'>5.4.3.6</a> Hierarchy algorithms <aclass='abbr_ref'href='qty.spec.hier.algos.html#qty.get.common.base'>[qty.spec.hier.algos]</a></h4><h4><aclass='secnum'style='min-width:110pt'>5.4.3.6.4</a> Get common base <aclass='abbr_ref'>[qty.get.common.base]</a></h4><divclass='para'id='1'><divclass='marginalizedparent'><aclass='marginalized'href='#1'>1</a></div><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L2216'>#</a></div><divclass='texpara'><divid='1.sentence-1'class='sentence'>In this subclause and <ahref='qty.is.child.of.html'title='5.4.3.6.5 Is child of'>[qty.<spanclass='shy'></span>is.<spanclass='shy'></span>child.<spanclass='shy'></span>of]</a>,
let the kind of quantity (<ahref="https://www.electropedia.org/iev/iev.nsf/display?openform&ievref=112-01-04">IEC 60050, 112-01-04</a>) hierarchy of <spanclass='texttt'>q</span> be the tuple
where <spanclass='texttt'>par</span> is <spanclass='texttt'><i>parent</i></span><aclass='hidden_link'href='#1.sentence-1'>.</a></div></div></div><divclass='texpara'><divid='lib:get-common-base,QuantitySpec'><divid='lib:QuantitySpec,get-common-base'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:QuantitySpec,get-common-base'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>template</span><spanclass='anglebracket'><</span><ahref='qty.spec.concepts.html#concept:QuantitySpec'title='5.4.3.2 Concepts [qty.spec.concepts]'><spanid='conceptref:QuantitySpec'><spanclass='texttt'>QuantitySpec</span></span></a><spanclass='keyword'>auto</span> A, <ahref='qty.spec.concepts.html#concept:QuantitySpec'title='5.4.3.2 Concepts [qty.spec.concepts]'><spanid='conceptref:QuantitySpec_'><spanclass='texttt'>QuantitySpec</span></span></a><spanclass='keyword'>auto</span> B<spanclass='anglebracket'>></span>
<ulclass='itemize'><liid='2.1'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#2.1'>(2.1)</a></div><spanclass="mjx-chtml"><spanclass="mjx-math"><spanclass="mjx-mrow"aria-hidden="true"><spanclass="mjx-msubsup"><spanclass="mjx-base"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-math-I"style="padding-top: 0.225em; padding-bottom: 0.298em;">a</span></span></span><spanclass="mjx-sub"style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-math-I"style="padding-top: 0.225em; padding-bottom: 0.298em;">s</span></span></span></span></span></span></span> be the number of elements in <spanclass='math'><spanclass='mathalpha'>h</span>(<spanclass='texttt'>A</span>)</span>,</li><liid='2.2'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#2.2'>(2.2)</a></div><spanclass="mjx-chtml"><spanclass="mjx-math"><spanclass="mjx-mrow"aria-hidden="true"><spanclass="mjx-msubsup"><spanclass="mjx-base"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-math-I"style="padding-top: 0.446em; padding-bottom: 0.298em;">b</span></span></span><spanclass="mjx-sub"style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-math-I"style="padding-top: 0.225em; padding-bottom: 0.298em;">s</span></span></span></span></span></span></span> be the number of elements in <spanclass='math'><spanclass='mathalpha'>h</span>(<spanclass='texttt'>B</span>)</span>,</li><liid='2.3'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#2.3'>(2.3)</a></div><spanclass='math'><spanclass='mathalpha'>s</span></span> be <spanclass="mjx-chtml"><spanclass="mjx-math"><spanclass="mjx-mrow"aria-hidden="true"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-main-R"style="padding-top: 0.372em; padding-bottom: 0.372em;">min</span></span><spanclass="mjx-mo"><spanclass="mjx-char"></span></span><spanclass="mjx-mo"><spanclass="mjx-char MJXc-TeX-main-R"style="padding-top: 0.446em; padding-bottom: 0.593em;">(</span></span><spanclass="mjx-msubsup"><spanclass="mjx-base"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-math-I"style="padding-top: 0.225em; padding-bottom: 0.298em;">a</span></span></span><spanclass="mjx-sub"style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-math-I"style="padding-top: 0.225em; padding-bottom: 0.298em;">s</span></span></span></span><spanclass="mjx-mo"><spanclass="mjx-char MJXc-TeX-main-R"style="margin-top: -0.144em; padding-bottom: 0.519em;">,</span></span><spanclass="mjx-msubsup MJXc-space1"><spanclass="mjx-base"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-math-I"style="padding-top: 0.446em; padding-bottom: 0.298em;">b</span></span></span><spanclass="mjx-sub"style="font-size: 70.7%; vertical-align: -0.212em; padding-right: 0.071em;"><spanclass="mjx-mi"><spanclass="mjx-char MJXc-TeX-math-I"style="padding-top: 0.225em; padding-bottom: 0.298em;">s</span></span></span></span><spanclass="mjx-mo"><spanclass="mjx-char MJXc-TeX-main-R"style="padding-top: 0.446em; padding-bottom: 0.593em;">)</span></span></span></span></span>,</li><liid='2.4'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#2.4'>(2.4)</a></div><spanclass='math'><spanclass='mathalpha'>A</span></span> be a tuple of the last <spanclass='math'><spanclass='mathalpha'>s</span></span> elements of <spanclass='math'><spanclass='mathalpha'>h</span>(<spanclass='texttt'>A</span>)</span>, and</li><liid='2.5'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#2.5'>(2.5)</a></div><spanclass='math'><spanclass='mathalpha'>B</span></span> be a tuple of the last <spanclass='math'><spanclass='mathalpha'>s</span></span> elements of <spanclass='math'><spanclass='mathalpha'>h</span>(<spanclass='texttt'>B</span>)</span><aclass='hidden_link'href='#2.sentence-1'>.</a></li>