The MWE below works fine as is, but fails with the following error message if the pgfplots package is uncommented.

Package PGF Math Error: Sorry, the operation 'Mod' has not yet been implemented in the floating point unit (in 'Mod(0+2,5)').


  • Code for the graph is from How to draw graphs in LaTeX?.
  • The listfiles output below is following an update of TeXLive 2016 on May 5, 2017.



%\usepackage{pgfplots}% <---- Problem if comment this out.



standalone.cls    2015/07/15 v1.2 Class to compile TeX sub-files standalone
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
   ifpdf.sty    2017/03/15 v3.2 Provides the ifpdf switch
 ifxetex.sty    2010/09/12 v0.6 Provides ifxetex conditional
 xkeyval.sty    2014/12/03 v2.7a package option processing (HA)
 xkeyval.tex    2014/12/03 v2.7a key=value parser (HA)
standalone.cfg    2015/07/15 v1.2 Default configuration file for 'standalone' c
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
pgfplots.sty    2016/08/10 v1.14 Data Visualization (1.14)
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty    2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  pdftex.def    2017/01/12 v0.06k Graphics/color for pdfTeX
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
    tikz.sty    2015/08/07 v3.0.1a (rcs-revision 1.151)
     pgf.sty    2015/08/07 v3.0.1a (rcs-revision 1.15)
  pgfrcs.sty    2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
 pgfcore.sty    2010/04/11 v3.0.1a (rcs-revision 1.7)
  pgfsys.sty    2014/07/09 v3.0.1a (rcs-revision 1.48)
pgfsyssoftpath.code.tex    2013/09/09  (rcs-revision 1.9)
pgfsysprotocol.code.tex    2006/10/16  (rcs-revision 1.4)
  xcolor.sty    2016/05/11 v2.12 LaTeX color extensions (UK)
   color.cfg    2016/01/02 v1.6 sample color configuration
pgfcomp-version-0-65.sty    2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty    2007/07/23 v3.0.1a (rcs-revision 1.1)
  pgffor.sty    2013/12/13 v3.0.1a (rcs-revision 1.25)
tkz-berge.sty    2011/06/01 1.00 c tkz-berge for named graphs
tkz-graph.sty    2011/06/01 ctan v 1.00 base for graphs
    etex.sty    2016/08/01 v2.7 eTeX basic definition package (PEB,DPC)
  ifthen.sty    2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
tkz-arith.sty    2011/02/28 v 1.00 c integers numbers
pdftexcmds.sty    2017/03/19 v0.25 Utility functions of pdfTeX for LuaTeX (HO)
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
  • I think this is a duplicate of this tex.stackexchange.com/questions/328972/… – percusse May 5 '17 at 18:03
  • @percusse yes, that looks like the same bug. But it looks as if it has been corrected only for pgf in sources on sourceforge but not for pgfplots. – Ulrike Fischer May 5 '17 at 19:07
  • 4
    I'm voting to close this question because it is solved by updating PGFPlots to v1.15. – Stefan Pinnow Jun 26 '17 at 18:44
  • Yep, works fine with current version of TeXLive 2017. – Peter Grill Aug 17 '17 at 9:13

pdfplots activates the fpu library. And as the error says Mod used by tkz-berge is not implemented there. But it seems not to be possible to deactivate the change:


\pgfmathsetcounter{section}{Mod(4,8)} %works

\pgfmathsetcounter{section}{Mod(5,3)} %fails

This looks like a bug to me.


It is an error in this definition from the fpu-library code:

    \expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath@#1@\endcsname%
    \expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}%

There is a @ to much in the second line after \csname pgfmath.

But the problem is that pgfplots uses its own version of the fpu-library (pgfplotsoldpgfsupp_pgflibraryfpu.code.tex) which is loaded in the middle of pgfplots and so it is quite hard to interfere in your extended example. Patching \pgfmathfloat@uninstall didn't work either. At the end I got rid of the error only by editing a local version of pgfplotsoldpgfsupp_pgflibraryfpu.code.tex.

Not the answer you're looking for? Browse other questions tagged or ask your own question.