Menu

#475 [manual] Wrong pgfmathdiv description

v1.0 (example)
closed-fixed
nobody
manual (41)
5
2018-05-24
2018-01-21
Timur
No

In the description of the \pgfmathdiv function the manual says:

Divide x by y and round to the nearest integer

It seems that in fact this function performs rounding not to the nearest, but to the largest integer not exceeding the quotient, i.e. works as \pgfmathfloor.

The inconsistency should somehow be corrected.

Discussion

  • Stefan Pinnow

    Stefan Pinnow - 2018-05-24
    • labels: doc, manual --> manual
    • summary: Wrong pgfmathdiv description --> [manual] Wrong pgfmathdiv description
    • status: open --> closed-fixed
     
  • Stefan Pinnow

    Stefan Pinnow - 2018-05-24

    You are right, the describing text is not totally clear. But your suggestion is wrong, as the MWE

    \documentclass[border=5pt,varwidth]{standalone}
    \usepackage{tikz}
    \begin{document}
        \pgfmathparse{div(+75,2)} \pgfmathresult     \qquad
        \pgfmathparse{div(-75,2)} \pgfmathresult
    
        \pgfmathparse{floor(divide(+75,2))} \pgfmathresult     \qquad
        \pgfmathparse{floor(divide(-75,2))} \pgfmathresult
    
        \pgfmathparse{ceil(divide(+75,2))} \pgfmathresult     \qquad
        \pgfmathparse{ceil(divide(-75,2))} \pgfmathresult
    
        \pgfmathparse{int(divide(+75,2))} \pgfmathresult     \qquad
        \pgfmathparse{int(divide(-75,2))} \pgfmathresult
    \end{document}
    

    reveils. Thus, the text was changed to

    Divide x by y and return the integer part of the result.

    which hopefully is an adequate description.

     
MongoDB Logo MongoDB