summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xintlog.sty
blob: b93e1c2bb05f501f5694c59205ef5c29a8265a90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
%%
%% This is file `xintlog.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xint.dtx  (with options: `xintlog')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from xintlog.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file xint.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
%% The xint bundle 1.3f 2019/09/10
%% Copyright (C) 2013-2019 by Jean-Francois Burnol
%% xintlog: Logarithms and exponentials for xintexpr
%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5    % ^^M
  \endlinechar=13 %
  \catcode123=1   % {
  \catcode125=2   % }
  \catcode64=11   % @
  \catcode35=6    % #
  \catcode44=12   % ,
  \catcode45=12   % -
  \catcode46=12   % .
  \catcode58=12   % :
  \catcode94=7    % ^
  \def\z{\endgroup}%
  \def\empty{}\def\space{ }\newlinechar10
  \expandafter\let\expandafter\w\csname ver@xintexpr.sty\endcsname
  \expandafter\let\expandafter\x\csname ver@xintlog.sty\endcsname
  \expandafter
    \ifx\csname PackageInfo\endcsname\relax
      \def\y#1#2{\immediate\write-1{Package #1 Info:^^J%
                 \space\space\space\space#2.}}%
    \else
      \def\y#1#2{\PackageInfo{#1}{#2}}%
    \fi
  \expandafter
  \ifx\csname numexpr\endcsname\relax
     \y{xintlog}{\numexpr not available, aborting input}%
     \aftergroup\endinput
  \else
    \ifx\w\relax % xintexpr.sty not yet loaded.
        \y{xintlog}%
          {Loading should be via \ifx\x\empty\string\usepackage{xintexpr.sty}
                          \else\string\input\space xintexpr.sty \fi
           rather, aborting}%
        \aftergroup\endinput
    \else
      \ifx\x\relax % first loading (initiated from xintexpr.sty)
      \else
        \ifx\x\empty % LaTeX first loading, \ProvidesPackage not yet seen
        \else
          \y{xintlog}{Already loaded, aborting}%
          \aftergroup\endinput
        \fi
      \fi
    \fi
  \fi
\z%
\xintexprSafeCatcodes\catcode`_ 11
\XINT_providespackage
\ProvidesPackage{xintlog}%
[2019/09/10 v1.3f Logarithms and exponentials for xintexpr (JFB)]%
\ifdefined\RequirePackage
  \RequirePackage{poormanlog}%
\else
  \input poormanlog.tex
\fi
\xintexprRestoreCatcodes\csname XINT_setcatcodes\endcsname\catcode`\! 11
\expandafter\def\csname XINT_expr_func_log10\endcsname#1#2#3%
{%
    \expandafter #1\expandafter #2\csname.=%
    \XINT:NEhook:one\PoorManLogBaseTen{\XINT_expr_unlock #3}\endcsname
}%
\expandafter\let\csname XINT_flexpr_func_log10\expandafter\endcsname
                \csname XINT_expr_func_log10\endcsname
\expandafter\def\csname XINT_expr_func_pow10\endcsname#1#2#3%
{%
    \expandafter #1\expandafter #2\csname.=%
    \XINT:NEhook:one\PoorManPowerOfTen{\XINT_expr_unlock #3}\endcsname
}%
\expandafter\let\csname XINT_flexpr_func_pow10\expandafter\endcsname
                \csname XINT_expr_func_pow10\endcsname
\def\XINT_expr_func_log #1#2#3%
{%
    \expandafter #1\expandafter #2\csname.=%
    \XINT:NEhook:one\xintLog{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_log #1#2#3%
{%
    \expandafter #1\expandafter #2\csname.=%
    \XINT:NEhook:one\XINTinFloatLog{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_exp #1#2#3%
{%
    \expandafter #1\expandafter #2\csname.=%
    \XINT:NEhook:one\xintExp{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_flexpr_func_exp #1#2#3%
{%
    \expandafter #1\expandafter #2\csname.=%
    \XINT:NEhook:one\XINTinFloatExp{\XINT_expr_unlock #3}\endcsname
}%
\def\XINT_expr_func_pow #1#2#3%
{%
    \expandafter #1\expandafter #2\csname.=%
    \expandafter\XINT:NEhook:twosp
    \romannumeral`&&@\XINT_expr_unlock #3,!\PoorManPower
    \endcsname
}%
\let\XINT_flexpr_func_pow\XINT_expr_func_pow
\catcode`\* 11
\def\poormanloghack**{%
\def\XINT_expr_op_** ##1%
{%
    \expandafter \XINT_expr_until_**_a
    \expandafter ##1\romannumeral`&&@\expandafter\XINT_expr_getnext
}%
\def\XINT_expr_until_**_a ##1{%
\def\XINT_expr_until_**_a ####1####2%
{%
    \xint_UDsignfork
      ####2{\expandafter \XINT_expr_until_**_a \expandafter ##1%
         \romannumeral`&&@##1}%
       -{\XINT_expr_until_**_b ####1####2}%
    \krof
}}\expandafter\XINT_expr_until_**_a\csname XINT_expr_op_-ix\endcsname
\def\XINT_expr_until_**_b ##1##2##3##4%
{%
    \ifnum ##2>\XINT_expr_precedence_**
       \xint_afterfi
       {\expandafter \XINT_expr_until_**_a \expandafter ##1%
        \romannumeral`&&@\csname XINT_expr_op_##3\endcsname{##4}}%
    \else
       \xint_afterfi
       {\expandafter ##2\expandafter ##3%
        \csname .=\XINT:NEhook:two
        \PoorManPower{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname
       }%
     \fi
}%
\let\XINT_flexpr_op_** \XINT_expr_op_**
\let\XINT_flexpr_until_**_a\XINT_expr_until_**_a
\let\XINT_flexpr_until_**_b\XINT_expr_until_**_b
}%
\def\poormanloghack^{%
\def\XINT_expr_until_^_b ##1##2##3##4%
{%
    \ifnum ##2>\XINT_expr_precedence_^
       \xint_afterfi
       {\expandafter \XINT_expr_until_^_a \expandafter ##1%
        \romannumeral`&&@\csname XINT_expr_op_##3\endcsname {##4}}%
    \else
       \xint_afterfi
       {\expandafter ##2\expandafter ##3%
        \csname .=\XINT:NEhook:two
        \PoorManPower{\XINT_expr_unlock ##1}{\XINT_expr_unlock ##4}\endcsname
       }%
     \fi
}%
\let\XINT_flexpr_until_^_b\XINT_expr_until_^_b
}%
\def\poormanloghack#1{\csname poormanloghack#1\endcsname}%
\endinput
%%
%% End of file `xintlog.sty'.