<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Hi Vladimir,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Yang's expectation, that applying numer() and denom() to the same expression would produce expressions with consistent signs, is reasonable.  Even if the potential inconsistency of results is well documented, it will remain unexpected behavior by many users, potentially leading to errors.  The fact that consistent signs will sometimes be produced may make it difficult to detect or debug those errors.  The potential inconsistency of sign results also suggests that the concepts of numerator and denominator aren't well defined, which is unsettling even if there is a good underlying reason.  The explanation given, because a/b = (-a)/(-b), seems insufficient to justify an interface that can lead to errors.  Would enforcement of consistent signs result in a performance penalty?</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Respectfully,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">-Mark</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 23, 2018 at 6:31 PM Vladimir V. Kisil <<a href="mailto:kisilv@maths.leeds.ac.uk">kisilv@maths.leeds.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">        Hi,<br>
<br>
>>>>> On Thu, 23 Aug 2018 13:22:06 +0800 (GMT+08:00), 杨强  <<a href="mailto:acrobat@mail.ustc.edu.cn" target="_blank">acrobat@mail.ustc.edu.cn</a>> said:<br>
<br>
    > Dear all, I use GiNaC to perform analytic calculation, but when I<br>
    > try to use .numer() and .denom() methods, I get a wrong result.<br>
<br>
<br>
    > 1. expr.numer()/expr.denom() is not always equal to the original<br>
    > expression!!!  2. Using .numer_denom() method could always get the<br>
    > correct answer.<br>
<br>
    It is not actually a bug. Since a/b = (-a)/(-b), numer() and denom()<br>
  are only defined up to a sign. Thus their separate evaluation may lead<br>
  to expr.numer()/expr.denom() with the opposite sign to expr.<br>
<br>
  I am proposing a patch to tutorial reminding that,<br>
<br>
  Best wishes,<br>
  Vladimir<br>
-- <br>
Vladimir V. Kisil                 <a href="http://www.maths.leeds.ac.uk/~kisilv/" rel="noreferrer" target="_blank">http://www.maths.leeds.ac.uk/~kisilv/</a><br>
  Book:     Geometry of Mobius Transformations     <a href="http://goo.gl/EaG2Vu" rel="noreferrer" target="_blank">http://goo.gl/EaG2Vu</a><br>
  Software: Geometry of cycles          <a href="http://moebinv.sourceforge.net/" rel="noreferrer" target="_blank">http://moebinv.sourceforge.net/</a><br>
<br>
_______________________________________________<br>
GiNaC-list mailing list<br>
<a href="mailto:GiNaC-list@ginac.de" target="_blank">GiNaC-list@ginac.de</a><br>
<a href="https://www.cebix.net/mailman/listinfo/ginac-list" rel="noreferrer" target="_blank">https://www.cebix.net/mailman/listinfo/ginac-list</a><br>
</blockquote></div></div>