It seems that the mod() function in PGF/TikZ has problems with negative values. The code

\draw [domain=-5:5, samples=100] plot (\x, {exp(mod(\x+1,2)-1)-1.5431});

will produce this:

enter image description here

Any ideas?

  • There are two modulo functions mod() and Mod(). You are using the wrong one. See the manual for details
    – percusse
    Aug 18, 2013 at 22:16

1 Answer 1


TikZ has two modulo functions: mod() and Mod(). Mod() will handle correctly negative values.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .