<div dir="ltr"><div dir="ltr"><div><div style="margin:0px;min-width:0px;padding:0px 0px 20px;width:initial;font-size:medium"><div id="m_3293285455989331557m_-9132670190805887162gmail-:262" style="direction:ltr;margin:8px 0px 0px;padding:0px;font-size:0.875rem;overflow-x:hidden"><div id="m_3293285455989331557m_-9132670190805887162gmail-:261" style="direction:initial;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;font-size:small;line-height:1.5;overflow:auto hidden"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Fred reported this issue and Jim provided significant background. This proposal supersedes a prior version. The task is to refine the exceptional cases in gamma and log gamma. The topic expanded into the naming of the exception.</div><span style="color:rgb(80,0,80)"><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><br></div></blockquote><div dir="ltr"><div>Proposal 1 -- C sect 7.12.1 #3</div><div>Current:</div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div>Similarly, a pole error (also known as a singularity or infinitary) occurs if and only if the mathematical function has an exact infinite result as the finite input argument(s) are approached in the limit (for example, log(0.0)). The description of each function lists any required pole errors; an implementation may define additional pole errors, provided that such errors are consistent with the mathematical definition of the function. On a pole error, the function returns an implementation-defined value; if the integer expression math_errhandling & MATH_ERRNO is nonzero, the integer expression errno acquires the value ERANGE; if the integer expression math_errhandling & MATH_ERREXCEPT is nonzero, the "divide-by-zero" floating-point exception is raised.</div></div></blockquote><div dir="ltr"><div>Proposed:</div></div></span><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">Similarly, a <span style="background-color:rgb(255,255,0)">divide-by-zero</span> error occurs if and only if the <span style="background-color:rgb(255,255,0)">function returns an infinite value for finite arguments, where the mathematical function has an infinite limit</span> (for example, <b>log(0.0</b><b style="font-family:monospace">)</b><b> </b><font face="arial, sans-serif">= -∞</font>). The description of each function lists any required <span style="background-color:rgb(255,255,0)">divide-by-zero</span> errors; an implementation may define additional <span style="background-color:rgb(255,255,0)">divide-by-zero</span> errors, provided that such errors are consistent with the mathematical definition of the function. On a <span style="background-color:rgb(255,255,0)">divide-by-zero</span> error, the function returns an implementation-defined value; if the integer expression math_errhandling & MATH_ERRNO is nonzero, the integer expression errno acquires the value ERANGE; if the integer expression math_errhandling & MATH_ERREXCEPT is nonzero, the "divide-by-zero" floating-point exception is raised. </blockquote><span style="color:rgb(80,0,80)"><div><br></div>Proposal 2 -- C sect 7.12.x, Change 25 instances<div>Current:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>pole error</div></blockquote><div>Proposed:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><span style="background-color:rgb(255,255,0)">divide-by-zero</span> error</blockquote><div><br></div>Proposal 3 -- C sect 1.12.8.3 #2 on log gamma<div>Current:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>A pole error may occur if x is a negative integer or zero.</div></blockquote><div>Proposed:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>A <span style="background-color:rgb(255,255,0)">domain error or </span><span style="background-color:rgb(255,255,0)">divide-by-zero</span><span style="background-color:rgb(255,255,0)"> error</span> may occur if x is a negative integer or zero.</div></blockquote><br>Proposal 4 -- C sect 1.12.8.4 p#2 on tgamma<div>Current:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>A domain error or a pole error may occur if x is a negative integer or zero.</div></blockquote><div>Proposed:</div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div>A <span style="background-color:rgb(255,255,0)">domain error or </span><span style="background-color:rgb(255,255,0)">divide-by-zero</span><span style="background-color:rgb(255,255,0)"> error</span> may occur if x is a negative integer or zero.</div></blockquote></span><div><span style="color:rgb(80,0,80)"><div dir="ltr"><div><br></div><div><br></div>DISCUSSION</div></span><div dir="ltr"><br><div>Proposals 1 & 2 -- "Pole error" (perhaps inspired by a single mention in sect. 9.2 of 60559) has several problems. It draws from the language of singularities in complex analysis, which is not a prerequisite for using real types in C. And "pole" is misleading. Not every singularity encountered in the library functions is a pole (as in the given example log(0), which is an essential singularity). It's far simpler to use the legacy term "divide-by-zero" for what is going to be reported as a "divide-by-zero" error on modern systems. </div><div><br></div><span style="color:rgb(80,0,80)"><div>Proposals 3&4 -- The gamma function approaches ±inf on either side of the negative integers, so tgamma must have a domain error at the negative integers. The sign of the infinite result at zero is resolved by the sign of zero on 60559 systems. Function lgamma is better behaved because it is defined as the absolute value of the log of gamma. On 60559 systems, it has a divide-by-zero error at the negative integers and never a domain error.<br></div><div><br></div><div>Proposal 1 -- The language of section 7.12.1 -- "...lists any required divide-by-zero errors" -- is not consistent with the language later in section 7 -- "A divide-by-zero error may occur..." If the error is required, a stronger verb form is called for.</div></span></div></div></div></div></div></div></div></div></div></div><div dir="ltr"><div><div dir="ltr" class="gmail_signature"><div dir="ltr">-Jerome Coonen<div> 650.996.4738</div><div> <a href="mailto:jcoonen@gmail.com" target="_blank">jcoonen@gmail.com</a></div></div></div></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
</blockquote></div>
</blockquote></div></div>