diff options
Diffstat (limited to 'graphics/pgf/base/tex/generic/math/pgfmathfunctions.comparison.code.tex')
-rw-r--r-- | graphics/pgf/base/tex/generic/math/pgfmathfunctions.comparison.code.tex | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/graphics/pgf/base/tex/generic/math/pgfmathfunctions.comparison.code.tex b/graphics/pgf/base/tex/generic/math/pgfmathfunctions.comparison.code.tex new file mode 100644 index 0000000000..a0632670d8 --- /dev/null +++ b/graphics/pgf/base/tex/generic/math/pgfmathfunctions.comparison.code.tex @@ -0,0 +1,179 @@ +% Copyright 2019 by Mark Wibrow +% +% This file may be distributed and/or modified +% +% 1. under the LaTeX Project Public License and/or +% 2. under the GNU Public License. +% +% See the file doc/generic/pgf/licenses/LICENSE for more details. + +% This file defines the mathematical functions and operators. +% +% Version 1.4142135 11/8/2008 + +\pgfmathdeclarefunction{greater}{2}{% + \begingroup% + \ifdim#1pt>#2pt\relax% + \def\pgfmathresult{1}% + \else% + \def\pgfmathresult{0}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} +\let\pgfmathgreaterthan=\pgfmathgreater + +\pgfmathdeclarefunction{less}{2}{% + \begingroup% + \ifdim#1pt<#2pt\relax% + \def\pgfmathresult{1}% + \else% + \def\pgfmathresult{0}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} +\let\pgfmathlessthan=\pgfmathless + +\pgfmathdeclarefunction{equal}{2}{% + \begingroup% + \ifdim#1pt=#2pt\relax% + \def\pgfmathresult{1}% + \else% + \def\pgfmathresult{0}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} +\let\pgfmathequalto=\pgfmathequal + + +% approxequalto function from Christian Feuersaenger. +% +\newif\ifpgfmathcomparison +\pgfmathdeclarefunction{approxequalto}{2}{% + \begingroup% + \pgfmath@x=#1pt\relax% + \pgfmath@y=#2pt\relax% + \advance\pgfmath@x by-\pgfmath@y% + \ifdim\pgfmath@x<0pt\relax% + \multiply\pgfmath@x by-1\relax% + \fi + \ifdim\pgfmath@x<0.0001pt\relax% + \def\pgfmathresult{1.0}% + \global\pgfmathcomparisontrue% + \else% + \def\pgfmathresult{0.0}% + \global\pgfmathcomparisonfalse% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + + + +% ifthenelse function. +% +\pgfmathdeclarefunction{ifthenelse}{3}{% + \begingroup% + \ifdim#1pt=0.0pt\relax% + \expandafter\def\expandafter\pgfmathresult\expandafter{#3}% + \else% + \expandafter\def\expandafter\pgfmathresult\expandafter{#2}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + +% notequal function. +% +\pgfmathdeclarefunction{notequal}{2}{% + \begingroup% + \ifdim#1pt=#2pt\relax% + \def\pgfmathresult{0}% + \else% + \def\pgfmathresult{1}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + +% notless function. +% +\pgfmathdeclarefunction{notless}{2}{% + \begingroup% + \ifdim#1pt<#2pt\relax% + \def\pgfmathresult{0}% + \else% + \def\pgfmathresult{1}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + +% notgreater function. +% +\pgfmathdeclarefunction{notgreater}{2}{% + \begingroup% + \ifdim#1pt>#2pt\relax% + \def\pgfmathresult{0}% + \else% + \def\pgfmathresult{1}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + +% and function. +% +\pgfmathdeclarefunction{and}{2}{% + \begingroup% + \def\pgfmathresult{1}% + \ifdim#1pt=0pt\relax% + \def\pgfmathresult{0}% + \else% + \ifdim#2pt=0pt\relax% + \def\pgfmathresult{0}% + \fi% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + +% or function. +% +\pgfmathdeclarefunction{or}{2}{% + \begingroup% + \def\pgfmathresult{0}% + \ifdim#1pt=0pt\relax% + \ifdim#2pt=0pt\relax% + \else% + \def\pgfmathresult{1}% + \fi% + \else% + \def\pgfmathresult{1}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + +% not function. +% +\pgfmathdeclarefunction{not}{1}{% + \begingroup% + \ifdim#1pt=0pt\relax% + \def\pgfmathresult{1}% + \else% + \def\pgfmathresult{0}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} + +% true function. +% +\pgfmathdeclarefunction{true}{0}{\def\pgfmathresult{1}} + +% false function. +% +\pgfmathdeclarefunction{false}{0}{\def\pgfmathresult{0}} |