| 1 |
% Copyright 2018 by Mark Wibrow |
| 2 |
% |
| 3 |
% This file may be distributed and/or modified |
| 4 |
% |
| 5 |
% 1. under the LaTeX Project Public License and/or |
| 6 |
% 2. under the GNU Free Documentation License. |
| 7 |
% |
| 8 |
% See the file doc/generic/pgf/licenses/LICENSE for more details. |
| 9 |
|
| 10 |
|
| 11 |
\pgfkeys{/pgf/.cd, |
| 12 |
fixed point arithmetic/.code={% |
| 13 |
\pgfmathfp@plots@install% |
| 14 |
\pgfmathfp@parser@install% |
| 15 |
\let\pgfmathparse=\pgfmathfpparse% |
| 16 |
\pgfkeys{/pgf/fixed point/.cd, #1}% |
| 17 |
},% |
| 18 |
fixed point/.cd, |
| 19 |
scale results/.code={% |
| 20 |
\pgfmathfpparse{#1}% |
| 21 |
\let\pgfmathfpscale=\pgfmathresult% |
| 22 |
}% |
| 23 |
}% |
| 24 |
|
| 25 |
\def\pgfmathfpscale{1}% |
| 26 |
|
| 27 |
\def\pgfmathfpparse{% |
| 28 |
\begingroup% |
| 29 |
\let\pgfmathpostparse=\relax% |
| 30 |
\pgfmath@catcodes% |
| 31 |
\pgfmath@quickparsefalse% |
| 32 |
\pgfmathfpparse@}% |
| 33 |
|
| 34 |
\def\pgfmathfpparse@#1{% |
| 35 |
\edef\pgfmathfp@expression{#1}% |
| 36 |
\expandafter\pgfmathfpparse@@\pgfmathfp@expression\pgfmathfp@}% |
| 37 |
|
| 38 |
\def\pgfmathfp@char@asterisk{*}% |
| 39 |
\def\pgfmathfpparse@@#1#2\pgfmathfp@{% |
| 40 |
\def\pgfmathfp@test{#1}% |
| 41 |
\ifx\pgfmathfp@test\pgfmathfp@char@asterisk% |
| 42 |
\edef\pgfmathfp@expression{\pgfmathfpscale#1#2}% |
| 43 |
\else% |
| 44 |
\edef\pgfmathfp@expression{#1#2}% |
| 45 |
\fi% |
| 46 |
\expandafter\pgfmathparse@\expandafter{\pgfmathfp@expression}% |
| 47 |
% \endgroup provided by \pgfpathmarse@end |
| 48 |
}% |
| 49 |
|
| 50 |
% Crude handling of file plots |
| 51 |
% |
| 52 |
\pgfkeys{/pgf/fixed point/.cd, |
| 53 |
scale file plot x/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscalex{\pgfmathresult*}, |
| 54 |
scale file plot y/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscaley{\pgfmathresult*}, |
| 55 |
scale file plot z/.code=\pgfmathfpparse{#1}\edef\pgfmathfpplotscalez{\pgfmathresult*}, |
| 56 |
}% |
| 57 |
|
| 58 |
\def\pgfmathfp@plots@install{% |
| 59 |
\let\pgfmathfpplotscalex=\pgfutil@empty |
| 60 |
\let\pgfmathfpplotscaley=\pgfutil@empty |
| 61 |
\let\pgfmathfpplotscalez=\pgfutil@empty |
| 62 |
\let\pgf@parsexyline=\pgfmathfp@parsexyline% |
| 63 |
\let\pgf@parsexyzline=\pgfmathfp@parsexyzline% |
| 64 |
}% |
| 65 |
|
| 66 |
\def\pgfmathfp@parsexyline#1 #2 #3\pgf@stop{% |
| 67 |
\edef\pgfmathfp@marshal{% |
| 68 |
\noexpand\pgfplotstreampoint{\noexpand\pgfpointxy{\pgfmathfpplotscalex#1}{\pgfmathfpplotscaley#2}}% |
| 69 |
}% |
| 70 |
\pgfmathfp@marshal% |
| 71 |
}% |
| 72 |
|
| 73 |
\def\pgfmathfp@parsexyzline#1 #2 #3 #4\pgf@stop{% |
| 74 |
\edef\pgfmathfp@marshal{% |
| 75 |
\noexpand\pgfplotstreampoint{% |
| 76 |
\noexpand\pgfpointxyz{\pgfmathfpplotscalex#1}{\pgfmathfpplotscaley#2}{\pgfmathfpplotscalez#3}% |
| 77 |
}% |
| 78 |
}% |
| 79 |
\pgfmathfp@marshal% |
| 80 |
}% |
| 81 |
|
| 82 |
% |
| 83 |
\def\pgfmathfp@parser@install{% |
| 84 |
% |
| 85 |
\expandafter\ifx\csname FP@version\endcsname\relax% |
| 86 |
\pgferror{You need to say `\string\usepackage{fp}' to use % |
| 87 |
fixed point arithmetic}% |
| 88 |
\else% |
| 89 |
% |
| 90 |
% Don't want messages. |
| 91 |
% |
| 92 |
\FPmessagesfalse% |
| 93 |
\FPdebugfalse% |
| 94 |
% |
| 95 |
% Install float commands... |
| 96 |
% |
| 97 |
\let\pgfmathadd@=\pgfmathfpadd@% |
| 98 |
\let\pgfmathsubtract@=\pgfmathfpsubtract@% |
| 99 |
\let\pgfmathmultiply@=\pgfmathfpmultiply@% |
| 100 |
\let\pgfmathdivide@=\pgfmathfpdivide@% |
| 101 |
\let\pgfmathabs@=\pgfmathfpabs@% |
| 102 |
\let\pgfmathneg@=\pgfmathfpneg@% |
| 103 |
\let\pgfmathround@=\pgfmathfpround@% |
| 104 |
\let\pgfmathfloor@=\pgfmathfpfloor@% |
| 105 |
\let\pgfmathceil@=\pgfmathfpceil@% |
| 106 |
\let\pgfmathmod@=\pgfmathfpmod@% |
| 107 |
\let\pgfmathmax@=\pgfmathfpmax@% |
| 108 |
\let\pgfmathmin@=\pgfmathfpmin@% |
| 109 |
\let\pgfmathsin@=\pgfmathfpsin@% |
| 110 |
\let\pgfmathcos@=\pgfmathfpcos@% |
| 111 |
\let\pgfmathtan@=\pgfmathfptan@% |
| 112 |
\let\pgfmathdeg@=\pgfmathfpdeg@% |
| 113 |
\let\pgfmathrad@=\pgfmathfprad@% |
| 114 |
\let\pgfmathatan@=\pgfmathfpatan@% |
| 115 |
\let\pgfmathasin@=\pgfmathfpasin@% |
| 116 |
\let\pgfmathacos@=\pgfmathfpacos@% |
| 117 |
\let\pgfmathcot@=\pgfmathfpcot@% |
| 118 |
\let\pgfmathsec@=\pgfmathfpsec@% |
| 119 |
\let\pgfmathcosec@=\pgfmathfpcosec@% |
| 120 |
\let\pgfmathpow@=\pgfmathfppow@% |
| 121 |
\let\pgfmathexp@=\pgfmathfpexp@% |
| 122 |
\let\pgfmathln@=\pgfmathfpln@% |
| 123 |
\let\pgfmathsqrt@=\pgfmathfpsqrt@% |
| 124 |
\let\pgfmath@pi=\pgfmathfppi@% |
| 125 |
\let\pgfmathveclen@=\pgfmathfpveclen@% |
| 126 |
\let\pgfmathe@=\pgfmathfpe@% |
| 127 |
% |
| 128 |
\let\pgfmathlessthan@=\pgfmathfplessthan@% |
| 129 |
\let\pgfmathgreaterthan@=\pgfmathfpgreaterthan@% |
| 130 |
\let\pgfmathequalto@=\pgfmathfpequalto@% |
| 131 |
% |
| 132 |
\let\pgfmathrnd=\pgfmathfprnd% |
| 133 |
\let\pgfmathrand=\pgfmathfprand% |
| 134 |
\let\pgfmathsetseed=\pgfmathfpsetseed% |
| 135 |
% |
| 136 |
\let\pgfmathscientific=\pgfmathfpscientific% |
| 137 |
\fi% |
| 138 |
}% |
| 139 |
|
| 140 |
\def\pgfmathfpe@{let\pgfmathresult=\FPe}% |
| 141 |
\def\pgfmathfppi@{let\pgfmathresult=\FPpi}% |
| 142 |
|
| 143 |
|
| 144 |
% Scientific notation. |
| 145 |
|
| 146 |
\def\pgfmathfpscientific#1#2{% |
| 147 |
\begingroup% |
| 148 |
\FPpow\pgfmathresult{10}{#2}\unskip% Needed. |
| 149 |
\FPmul\pgfmathresult{#1}{\pgfmathresult}% |
| 150 |
\pgfmath@smuggleone\pgfmathresult% |
| 151 |
\endgroup% |
| 152 |
}% |
| 153 |
|
| 154 |
% Comparison stuff... |
| 155 |
|
| 156 |
% lessthan |
| 157 |
% |
| 158 |
\def\pgfmathfplessthan#1#2{% |
| 159 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 160 |
\pgfmathfpparse{#1}% |
| 161 |
\pgfmathfplessthan@{\pgfmathresult}{\pgfmath@result}% |
| 162 |
}% |
| 163 |
\def\pgfmathfplessthan@#1#2{% |
| 164 |
\begingroup% |
| 165 |
\FPiflt{#1}{#2}% |
| 166 |
\def\pgfmathresult{1.0}% |
| 167 |
\else% |
| 168 |
\def\pgfmathresult{0.0}% |
| 169 |
\fi% |
| 170 |
\pgfmath@smuggleone\pgfmathresult% |
| 171 |
\endgroup% |
| 172 |
}% |
| 173 |
|
| 174 |
% greaterthan |
| 175 |
% |
| 176 |
\def\pgfmathfpgreaterthan#1#2{% |
| 177 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 178 |
\pgfmathfpparse{#1}% |
| 179 |
\pgfmathfpgreaterthan@{\pgfmathresult}{\pgfmath@result}% |
| 180 |
}% |
| 181 |
\def\pgfmathfpgreaterthan@#1#2{% |
| 182 |
\begingroup% |
| 183 |
\FPifgt{#1}{#2}% |
| 184 |
\def\pgfmathresult{1.0}% |
| 185 |
\else% |
| 186 |
\def\pgfmathresult{0.0}% |
| 187 |
\fi% |
| 188 |
\pgfmath@smuggleone\pgfmathresult% |
| 189 |
\endgroup% |
| 190 |
}% |
| 191 |
|
| 192 |
% equalto |
| 193 |
% |
| 194 |
\def\pgfmathfpequalto#1#2{% |
| 195 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 196 |
\pgfmathfpparse{#1}% |
| 197 |
\pgfmathfpequalto@{\pgfmathresult}{\pgfmath@result}% |
| 198 |
}% |
| 199 |
\def\pgfmathfpequalto@#1#2{% |
| 200 |
\begingroup% |
| 201 |
\FPifeq{#1}{#2}% |
| 202 |
\def\pgfmathresult{1.0}% |
| 203 |
\else% |
| 204 |
\def\pgfmathresult{0.0}% |
| 205 |
\fi% |
| 206 |
\pgfmath@smuggleone\pgfmathresult% |
| 207 |
\endgroup% |
| 208 |
}% |
| 209 |
|
| 210 |
|
| 211 |
% Basic arithmetic stuff... |
| 212 |
|
| 213 |
% add |
| 214 |
% |
| 215 |
\def\pgfmathfpadd#1#2{% |
| 216 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 217 |
\pgfmathfpparse{#1}% |
| 218 |
\pgfmathfpadd@{\pgfmathresult}{\pgfmath@result}% |
| 219 |
}% |
| 220 |
\def\pgfmathfpadd@#1#2{% |
| 221 |
\begingroup% |
| 222 |
\FPadd\pgfmathresult{#1}{#2}% |
| 223 |
\pgfmath@smuggleone\pgfmathresult% |
| 224 |
\endgroup% |
| 225 |
}% |
| 226 |
|
| 227 |
% subtract |
| 228 |
% |
| 229 |
\def\pgfmathfpsubtract#1#2{% |
| 230 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 231 |
\pgfmathfpparse{#1}% |
| 232 |
\pgfmathfpsubtract@{\pgfmathresult}{\pgfmath@result}% |
| 233 |
}% |
| 234 |
\def\pgfmathfpsubtract@#1#2{% |
| 235 |
\begingroup% |
| 236 |
\FPsub\pgfmathresult{#1}{#2}% |
| 237 |
\pgfmath@smuggleone\pgfmathresult% |
| 238 |
\endgroup% |
| 239 |
}% |
| 240 |
|
| 241 |
% multiply |
| 242 |
% |
| 243 |
\def\pgfmathfpmultiply#1#2{% |
| 244 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 245 |
\pgfmathfpparse{#1}% |
| 246 |
\pgfmathfpmultiply@{\pgfmathresult}{\pgfmath@result}% |
| 247 |
}% |
| 248 |
\def\pgfmathfpmultiply@#1#2{% |
| 249 |
\begingroup% |
| 250 |
\FPmul\pgfmathresult{#1}{#2}% |
| 251 |
\pgfmath@smuggleone\pgfmathresult% |
| 252 |
\endgroup% |
| 253 |
}% |
| 254 |
|
| 255 |
% divide |
| 256 |
% |
| 257 |
\def\pgfmathfpdivide#1#2{% |
| 258 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 259 |
\pgfmathfpparse{#1}% |
| 260 |
\pgfmathfpdivide@{\pgfmathresult}{\pgfmath@result}% |
| 261 |
}% |
| 262 |
\def\pgfmathfpdivide@#1#2{% |
| 263 |
\begingroup% |
| 264 |
\FPdiv\pgfmathresult{#1}{#2}% |
| 265 |
\pgfmath@smuggleone\pgfmathresult% |
| 266 |
\endgroup% |
| 267 |
}% |
| 268 |
|
| 269 |
% abs |
| 270 |
% |
| 271 |
\def\pgfmathfpabs#1{% |
| 272 |
\pgfmathfpparse{#1}% |
| 273 |
\pgfmathfpabs@{\pgfmathresult}% |
| 274 |
}% |
| 275 |
\def\pgfmathfpabs@#1{% |
| 276 |
\begingroup% |
| 277 |
\FPabs\pgfmathresult{#1}% |
| 278 |
\pgfmath@smuggleone\pgfmathresult% |
| 279 |
\endgroup% |
| 280 |
}% |
| 281 |
|
| 282 |
% neg |
| 283 |
% |
| 284 |
\def\pgfmathfpneg#1{% |
| 285 |
\pgfmathfpparse{#1}% |
| 286 |
\pgfmathfpneg@{\pgfmathresult}% |
| 287 |
}% |
| 288 |
\def\pgfmathfpneg@#1{% |
| 289 |
\begingroup% |
| 290 |
\FPneg\pgfmathresult{#1}% |
| 291 |
\pgfmath@smuggleone\pgfmathresult |
| 292 |
\endgroup% |
| 293 |
}% |
| 294 |
|
| 295 |
% round |
| 296 |
% |
| 297 |
\def\pgfmathfpround#1{% |
| 298 |
\pgfmathfpparse{#1}% |
| 299 |
\pgfmathfpround@{\pgfmathresult}% |
| 300 |
}% |
| 301 |
\def\pgfmathfpround@#1{% |
| 302 |
\begingroup% |
| 303 |
\FPround\pgfmathresult{#1}{0}% |
| 304 |
\edef\pgfmathresult{\pgfmathresult.0}% |
| 305 |
\pgfmath@smuggleone\pgfmathresult% |
| 306 |
\endgroup% |
| 307 |
}% |
| 308 |
|
| 309 |
% floor |
| 310 |
% |
| 311 |
\def\pgfmathfpfloor#1{% |
| 312 |
\pgfmathfpparse{#1}% |
| 313 |
\pgfmathfpfloor@{\pgfmathresult}% |
| 314 |
}% |
| 315 |
\def\pgfmathfpfloor@#1{% |
| 316 |
\begingroup% |
| 317 |
\FPtrunc\pgfmathresult{#1}{0}% |
| 318 |
\FPifneg{#1}% |
| 319 |
\FPsub\pgfmathresult{\pgfmathresult}{1}% |
| 320 |
\fi% |
| 321 |
\edef\pgfmathresult{\pgfmathresult.0}% |
| 322 |
\pgfmath@smuggleone\pgfmathresult% |
| 323 |
\endgroup% |
| 324 |
}% |
| 325 |
|
| 326 |
% ceil |
| 327 |
% |
| 328 |
\def\pgfmathfpceil#1{% |
| 329 |
\pgfmathfpparse{#1}% |
| 330 |
\pgfmathfpceil@{\pgfmathresult}% |
| 331 |
}% |
| 332 |
\def\pgfmathfpceil@#1{% |
| 333 |
\begingroup% |
| 334 |
\FPtrunc\pgfmathresult{#1}{0}% |
| 335 |
\FPifpos{#1}% |
| 336 |
\FPadd\pgfmathresult{\pgfmathresult}{1}% |
| 337 |
\fi% |
| 338 |
\edef\pgfmathresult{\pgfmathresult.0}% |
| 339 |
\pgfmath@smuggleone\pgfmathresult% |
| 340 |
\endgroup% |
| 341 |
}% |
| 342 |
|
| 343 |
% mod |
| 344 |
% |
| 345 |
\def\pgfmathfpmod#1#2{% |
| 346 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 347 |
\pgfmathfpparse{#1}% |
| 348 |
\pgfmathfpmod@{\pgfmathresult}{\pgfmath@result}% |
| 349 |
}% |
| 350 |
\def\pgfmathfpmod@#1#2{% |
| 351 |
\begingroup% |
| 352 |
\FPdiv\pgfmathresult{#1}{#2}% |
| 353 |
\FPtrunc\pgfmathresult{\pgfmathresult}{0}% |
| 354 |
\FPmul\pgfmathresult{\pgfmathresult}{#2}% |
| 355 |
\FPsub\pgfmathresult{#1}{\pgfmathresult}% |
| 356 |
\pgfmath@smuggleone\pgfmathresult% |
| 357 |
\endgroup% |
| 358 |
}% |
| 359 |
|
| 360 |
% max |
| 361 |
% |
| 362 |
\def\pgfmathfpmax#1#2{% |
| 363 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 364 |
\pgfmathfpparse{#1}% |
| 365 |
\pgfmathfpmax@@{\pgfmathresult}{\pgfmath@result}% |
| 366 |
}% |
| 367 |
\def\pgfmathfpmax@#1{% |
| 368 |
\pgfmathfpmax@@#1% |
| 369 |
}% |
| 370 |
\def\pgfmathfpmax@@#1#2{% |
| 371 |
\begingroup% |
| 372 |
\FPifgt{#1}{#2}% |
| 373 |
\def\pgfmathresult{#1}% |
| 374 |
\else% |
| 375 |
\def\pgfmathresult{#2}% |
| 376 |
\fi% |
| 377 |
\pgfmath@smuggleone\pgfmathresult% |
| 378 |
\endgroup% |
| 379 |
}% |
| 380 |
|
| 381 |
% min |
| 382 |
% |
| 383 |
\def\pgfmathfpmin#1#2{% |
| 384 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 385 |
\pgfmathfpparse{#1}% |
| 386 |
\pgfmathfpmin@@{\pgfmathresult}{\pgfmath@result}% |
| 387 |
}% |
| 388 |
\def\pgfmathfpmin@#1{% |
| 389 |
\pgfmathfpmin@@#1% |
| 390 |
}% |
| 391 |
\def\pgfmathfpmin@@#1#2{% |
| 392 |
\begingroup% |
| 393 |
\FPiflt{#1}{#2}% |
| 394 |
\def\pgfmathresult{#1}% |
| 395 |
\else% |
| 396 |
\def\pgfmathresult{#2}% |
| 397 |
\fi% |
| 398 |
\pgfmath@smuggleone\pgfmathresult% |
| 399 |
\endgroup% |
| 400 |
}% |
| 401 |
|
| 402 |
% Functions... |
| 403 |
|
| 404 |
% pow |
| 405 |
% |
| 406 |
\def\pgfmathfppow#1#2{% |
| 407 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 408 |
\pgfmathfpparse{#1}% |
| 409 |
\pgfmathfppow@{\pgfmathresult}{\pgfmath@result}% |
| 410 |
}% |
| 411 |
\def\pgfmathfppow@#1#2{% |
| 412 |
\begingroup% |
| 413 |
\FPpow\pgfmathresult{#1}{#2}\unskip% |
| 414 |
\pgfmath@smuggleone\pgfmathresult% |
| 415 |
\endgroup% |
| 416 |
}% |
| 417 |
|
| 418 |
% exp |
| 419 |
% |
| 420 |
\def\pgfmathfpexp#1{% |
| 421 |
\pgfmathfpparse{#1}% |
| 422 |
\pgfmathfpexp@{\pgfmathresult}% |
| 423 |
}% |
| 424 |
\def\pgfmathfpexp@#1{% |
| 425 |
\begingroup% |
| 426 |
\FPexp\pgfmathresult{#1}% |
| 427 |
\pgfmath@smuggleone\pgfmathresult% |
| 428 |
\endgroup% |
| 429 |
}% |
| 430 |
|
| 431 |
% ln |
| 432 |
% |
| 433 |
\def\pgfmathfpln#1{% |
| 434 |
\pgfmathfpparse{#1}% |
| 435 |
\pgfmathfpln@{\pgfmathresult}% |
| 436 |
}% |
| 437 |
\def\pgfmathfpln@#1{% |
| 438 |
\begingroup% |
| 439 |
\FPln\pgfmathresult{#1}% |
| 440 |
\pgfmath@smuggleone\pgfmathresult% |
| 441 |
\endgroup% |
| 442 |
}% |
| 443 |
|
| 444 |
% sqrt |
| 445 |
% |
| 446 |
\def\pgfmathfpsqrt#1{% |
| 447 |
\pgfmathfpparse{#1}% |
| 448 |
\pgfmathfpsqrt@{\pgfmathresult}% |
| 449 |
}% |
| 450 |
\def\pgfmathfpsqrt@#1{% |
| 451 |
\begingroup% |
| 452 |
\FProot\pgfmathresult{#1}{2}% |
| 453 |
\pgfmath@smuggleone\pgfmathresult% |
| 454 |
\endgroup% |
| 455 |
}% |
| 456 |
|
| 457 |
% veclen |
| 458 |
% |
| 459 |
\def\pgfmathfpveclen#1#2{% |
| 460 |
\pgfmathfpparse{#2}\let\pgfmath@result=\pgfmathresult% |
| 461 |
\pgfmathfpparse{#1}% |
| 462 |
\pgfmathfpveclen@{\pgfmathresult}{\pgfmath@result}% |
| 463 |
}% |
| 464 |
\def\pgfmathfpveclen@#1#2{% |
| 465 |
\begingroup% |
| 466 |
\FPmul\pgfmath@result{#1}{#1}% |
| 467 |
\FPmul\pgfmath@@result{#2}{#2}% |
| 468 |
\FPadd\pgfmathresult{\pgfmath@result}{\pgfmath@@result}% |
| 469 |
\FProot\pgfmathresult{\pgfmathresult}{2}% |
| 470 |
\pgfmath@smuggleone\pgfmathresult% |
| 471 |
\endgroup% |
| 472 |
}% |
| 473 |
|
| 474 |
% Trigonometric stuff... |
| 475 |
|
| 476 |
% sin |
| 477 |
% |
| 478 |
\def\pgfmathfpsin#1{% |
| 479 |
\pgfmathfpparse{#1}% |
| 480 |
\pgfmathfpsin@{\pgfmathresult}% |
| 481 |
}% |
| 482 |
\def\pgfmathfpsin@#1{% |
| 483 |
\begingroup% |
| 484 |
\FPmul\pgfmathresult{#1}{0.017453292519943295}% |
| 485 |
\FPsin\pgfmathresult{\pgfmathresult}% |
| 486 |
\pgfmath@smuggleone\pgfmathresult% |
| 487 |
\endgroup% |
| 488 |
}% |
| 489 |
|
| 490 |
% cos |
| 491 |
% |
| 492 |
\def\pgfmathfpcos#1{% |
| 493 |
\pgfmathfpparse{#1}% |
| 494 |
\pgfmathfpcos@{\pgfmathresult}% |
| 495 |
}% |
| 496 |
\def\pgfmathfpcos@#1{% |
| 497 |
\begingroup% |
| 498 |
\FPmul\pgfmathresult{#1}{0.017453292519943295}% |
| 499 |
\FPcos\pgfmathresult{\pgfmathresult}% |
| 500 |
\pgfmath@smuggleone\pgfmathresult% |
| 501 |
\endgroup% |
| 502 |
}% |
| 503 |
|
| 504 |
% tan |
| 505 |
% |
| 506 |
\def\pgfmathfptan#1{% |
| 507 |
\pgfmathfpparse{#1}% |
| 508 |
\pgfmathfptan@{\pgfmathresult}% |
| 509 |
}% |
| 510 |
\def\pgfmathfptan@#1{% |
| 511 |
\begingroup% |
| 512 |
\FPmul\pgfmathresult{#1}{0.017453292519943295}% |
| 513 |
\FPtan\pgfmathresult{\pgfmathresult}% |
| 514 |
\pgfmath@smuggleone\pgfmathresult% |
| 515 |
\endgroup% |
| 516 |
}% |
| 517 |
|
| 518 |
% acos |
| 519 |
% |
| 520 |
\def\pgfmathfpacos#1{% |
| 521 |
\pgfmathfpparse{#1}% |
| 522 |
\pgfmathfpacos@{\pgfmathresult}% |
| 523 |
}% |
| 524 |
\def\pgfmathfpacos@#1{% |
| 525 |
\begingroup% |
| 526 |
\FParccos\pgfmathresult{#1}% |
| 527 |
\FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% |
| 528 |
\pgfmath@smuggleone\pgfmathresult% |
| 529 |
\endgroup% |
| 530 |
}% |
| 531 |
|
| 532 |
% asin |
| 533 |
% |
| 534 |
\def\pgfmathfpasin#1{% |
| 535 |
\pgfmathfpparse{#1}% |
| 536 |
\pgfmathfpasin@{\pgfmathresult}% |
| 537 |
}% |
| 538 |
\def\pgfmathfpasin@#1{% |
| 539 |
\begingroup% |
| 540 |
\FParcsin\pgfmathresult{#1}% |
| 541 |
\FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% |
| 542 |
\pgfmath@smuggleone\pgfmathresult% |
| 543 |
\endgroup% |
| 544 |
}% |
| 545 |
|
| 546 |
% atan |
| 547 |
% |
| 548 |
\def\pgfmathfpatan#1{% |
| 549 |
\pgfmathfpparse{#1}% |
| 550 |
\pgfmathfpatan@{\pgfmathresult}% |
| 551 |
}% |
| 552 |
\def\pgfmathfpatan@#1{% |
| 553 |
\begingroup% |
| 554 |
\FParctan\pgfmathresult{#1}% |
| 555 |
\FPmul\pgfmathresult{\pgfmathresult}{57.295779513082320885}% |
| 556 |
\pgfmath@smuggleone\pgfmathresult% |
| 557 |
\endgroup% |
| 558 |
}% |
| 559 |
|
| 560 |
% cot |
| 561 |
% |
| 562 |
\def\pgfmathfpcot#1{% |
| 563 |
\pgfmathfpparse{#1}% |
| 564 |
\pgfmathfpcot@{\pgfmathresult}% |
| 565 |
}% |
| 566 |
\def\pgfmathfpcot@#1{% |
| 567 |
\begingroup% |
| 568 |
\FPmul\pgfmathresult{#1}{0.017453292519943295}% |
| 569 |
\FPcot\pgfmathresult{\pgfmathresult}% |
| 570 |
\pgfmath@smuggleone\pgfmathresult% |
| 571 |
\endgroup% |
| 572 |
}% |
| 573 |
|
| 574 |
% sec |
| 575 |
% |
| 576 |
\def\pgfmathfpsec#1{% |
| 577 |
\pgfmathfpparse{#1}% |
| 578 |
\pgfmathfpsec@{\pgfmathresult}% |
| 579 |
}% |
| 580 |
\def\pgfmathfpsec@#1{% |
| 581 |
\begingroup% |
| 582 |
\FPmul\pgfmathresult{#1}{0.017453292519943295}% |
| 583 |
\FPcos\pgfmathresult{\pgfmathresult}% |
| 584 |
\FPdiv\pgfmathresult{1}{\pgfmathresult}% |
| 585 |
\pgfmath@smuggleone\pgfmathresult% |
| 586 |
\endgroup% |
| 587 |
}% |
| 588 |
|
| 589 |
% cosec |
| 590 |
% |
| 591 |
\def\pgfmathfpcosec#1{% |
| 592 |
\pgfmathfpparse{#1}% |
| 593 |
\pgfmathfpcosec@{\pgfmathresult}% |
| 594 |
}% |
| 595 |
\def\pgfmathfpcosec@#1{% |
| 596 |
\begingroup% |
| 597 |
\FPmul\pgfmathresult{#1}{0.017453292519943295}% |
| 598 |
\FPsin\pgfmathresult{\pgfmathresult}% |
| 599 |
\FPdiv\pgfmathresult{1}{\pgfmathresult}% |
| 600 |
\pgfmath@smuggleone\pgfmathresult% |
| 601 |
\endgroup% |
| 602 |
}% |
| 603 |
|
| 604 |
% deg |
| 605 |
% |
| 606 |
\def\pgfmathfpdeg#1{% |
| 607 |
\pgfmathfpparse{#1}% |
| 608 |
\pgfmathfpdeg@{\pgfmathresult}% |
| 609 |
}% |
| 610 |
\def\pgfmathfpdeg@#1{% |
| 611 |
\begingroup% |
| 612 |
\FPmul\pgfmathresult{#1}{57.295779513082320885}% |
| 613 |
\pgfmath@smuggleone\pgfmathresult% |
| 614 |
\endgroup% |
| 615 |
}% |
| 616 |
|
| 617 |
% rad |
| 618 |
% |
| 619 |
\def\pgfmathfprad#1{% |
| 620 |
\pgfmathfpparse{#1}% |
| 621 |
\pgfmathfprad@{\pgfmathresult}% |
| 622 |
}% |
| 623 |
\def\pgfmathfprad@#1{% |
| 624 |
\begingroup% |
| 625 |
\FPmul\pgfmathresult{#1}{0.01745329251994325}% |
| 626 |
\pgfmath@smuggleone\pgfmathresult% |
| 627 |
\endgroup% |
| 628 |
}% |
| 629 |
|
| 630 |
% Random stuff... |
| 631 |
|
| 632 |
\def\pgfmathfpsetseed#1{% |
| 633 |
\pgfmathfpparse{#1}% |
| 634 |
\afterassignment\pgfmath@gobbletilpgfmath@% |
| 635 |
\FPseed\pgfmathresult\relax\pgfmath@% |
| 636 |
}% |
| 637 |
|
| 638 |
% rnd |
| 639 |
% |
| 640 |
\def\pgfmathfprnd{% |
| 641 |
\begingroup% |
| 642 |
\FPrandom\pgfmathresult% |
| 643 |
\pgfmath@smuggleone\pgfmathresult% |
| 644 |
\endgroup% |
| 645 |
}% |
| 646 |
|
| 647 |
% rand |
| 648 |
% |
| 649 |
\def\pgfmathfprand{% |
| 650 |
\begingroup% |
| 651 |
\FPrandom\pgfmathresult% |
| 652 |
\FPmul\pgfmathresult{2}{\pgfmathresult}% |
| 653 |
\FPsub\pgfmathresult{\pgfmathresult}{1}% |
| 654 |
\pgfmath@smuggleone\pgfmathresult% |
| 655 |
\endgroup% |
| 656 |
}% |