<!DOCTYPE html><htmllang='en'><head><title>[qty.val.cmp]</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.6</a> Quantity <aclass='abbr_ref'href='qty.html#val.cmp'>[qty]</a></h2><h3><aclass='secnum'style='min-width:80pt'>5.6.13</a> Value comparison <aclass='abbr_ref'>[qty.val.cmp]</a></h3><divclass='texpara'><divid='lib:quantity,is_gteq_zero'><divid='lib:is_gteq_zero,quantity'><divid='lib:quantity,is_lteq_zero'><divid='lib:is_lteq_zero,quantity'><divid='lib:quantity,is_gt_zero'><divid='lib:is_gt_zero,quantity'><divid='lib:quantity,is_lt_zero'><divid='lib:is_lt_zero,quantity'><divid='lib:quantity,is_neq_zero'><divid='lib:is_neq_zero,quantity'><divid='lib:quantity,is_eq_zero'><divid='lib:is_eq_zero,quantity'><divclass='itemdecl'><divclass='marginalizedparent'><aclass='itemDeclLink'href='#lib:is_eq_zero,quantity'>🔗</a></div><codeclass='itemdeclcode'><spanclass='keyword'>friend</span><spanclass='keyword'>constexpr</span><spanclass='keyword'>bool</span> is_eq_zero<spanclass='parenthesis'>(</span><spanclass='keyword'>const</span> quantity<spanclass='operator'>&</span> q<spanclass='parenthesis'>)</span><spanclass='keyword'>requires</span><i><spanclass='texttt'>see below</span></i>;
</code></div></div></div></div></div></div></div></div></div></div></div></div></div></div><divclass='para'id='1'><divclass='marginalizedparent'><aclass='marginalized'href='#1'>1</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5241'>#</a></div><divclass='texpara'><divid='1.sentence-1'class='sentence'>Let <spanclass='texttt'>is_<spanclass='shy'></span><i>F</i>_<spanclass='shy'></span>zero</span> be the function name<aclass='hidden_link'href='#1.sentence-1'>.</a></div></div></div></div><divclass='para'id='2'><divclass='marginalizedparent'><aclass='marginalized'href='#2'>2</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5244'>#</a></div><divclass='texpara'><divid='2.sentence-1'class='sentence'><i>Returns</i>: <ulclass='itemize'><liid='2.1'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#2.1'>(2.1)</a></div><divclass='texpara'><divid='2.1.sentence-1'class='sentence'>If <spanclass='texttt'><i>F</i></span> is <spanclass='texttt'>eq</span>, returns <spanclass='texttt'>q <spanclass='operator'>=</span><spanclass='operator'>=</span> zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span></span><aclass='hidden_link'href='#2.1.sentence-1'>.</a></div></div></li><liid='2.2'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#2.2'>(2.2)</a></div><divclass='texpara'><divid='2.2.sentence-1'class='sentence'>Otherwise, if <spanclass='texttt'><i>F</i></span> is <spanclass='texttt'>neq</span>, returns <spanclass='texttt'>q <spanclass='operator'>!</span><spanclass='operator'>=</span> zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span></span><aclass='hidden_link'href='#2.2.sentence-1'>.</a></div></div></li><liid='2.3'><divclass='marginalizedparent'style='left:-39mm'><aclass='marginalized'href='#2.3'>(2.3)</a></div><divclass='texpara'><divid='2.3.sentence-1'class='sentence'>Otherwise, returns <spanclass='texttt'>is_<spanclass='shy'></span><i>F</i><spanclass='parenthesis'>(</span>q <spanclass='anglebracket'><</span><spanclass='operator'>=</span><spanclass='anglebracket'>></span> zero<spanclass='parenthesis'>(</span><spanclass='parenthesis'>)</span><spanclass='parenthesis'>)</span></span> (<ahref="https://wg21.link/compare.syn">N4971, [compare.syn]</a>)<aclass='hidden_link'href='#2.3.sentence-1'>.</a></div></div></li></ul></div></div></div></div><divclass='para'id='3'><divclass='marginalizedparent'><aclass='marginalized'href='#3'>3</a></div><divclass='itemdescr'><divclass='sourceLinkParent'><aclass='sourceLink'href='https://github.com/mpusz/mp-unitse9c5f7236ebfe1b287a5a4a49aaf57fbefa87233/source/quantities.tex#L5255'>#</a></div><divclass='texpara'><divid='3.sentence-1'class='sentence'><i>Remarks</i>: Let <i>C</i> be
<spanclass='texttt'>std<spanclass='operator'>​::​</span>equality_<spanclass='shy'></span>comparable_<spanclass='shy'></span>with</span> if <i>F</i> is <spanclass='texttt'>eq</span> or <spanclass='texttt'>neq</span>, and
<spanclass='texttt'>std<spanclass='operator'>​::​</span>three_<spanclass='shy'></span>way_<spanclass='shy'></span>comparable_<spanclass='shy'></span>with</span> otherwise<aclass='hidden_link'href='#3.sentence-1'>.</a></div><divid='3.sentence-2'class='sentence'>The expression in the <spanclass='textsf'><i>requires-clause</i></span> is equivalent to: