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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
|
%%
%% This is file `xinttrig.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xint.dtx (with options: `xinttrig')
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the source file.
%%
%% Any modified versions of this file must be renamed
%% with new filenames distinct from xinttrig.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.4d 2021/03/29
%% Copyright (C) 2013-2021 by Jean-Francois Burnol
%% xinttrig: Trigonometry for the xintexpr package
%% ---------------------------------------------------------------
\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
\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{xinttrig}{\numexpr not available, aborting input}%
\aftergroup\endinput
\else
\ifx\w\relax % xintexpr.sty not yet loaded.
\y{xinttrig}%
{Loading should be via \ifx\x\empty\string\usepackage{xintexpr.sty}
\else\string\input\space xintexpr.sty \fi
rather, aborting}%
\aftergroup\endinput
\fi
\fi
\z%
\catcode`_ 11 \XINT_setcatcodes \catcode`? 12
\ifcsname xintlibver@trig\endcsname
\expandafter\xint_firstoftwo
\else
\expandafter\xint_secondoftwo
\fi
{\immediate\write-1{Reloading xinttrig library using Digits=\xinttheDigits.}}%
{\expandafter\gdef\csname xintlibver@trig\endcsname{2021/03/29 v1.4d}%
\XINT_providespackage
\ProvidesPackage{xinttrig}%
[2021/03/29 v1.4d Trigonometrical functions for xintexpr (JFB)]%
}%
\xintFor* #1 in {iDTVtuwxyzX}\do{\xintensuredummy{#1}}%
\def\xintreloadxinttrig
{\edef\XINT_restorecatcodes_now{\XINT_restorecatcodes}%
\XINT_setcatcodes\catcode`? 12
\input xinttrig.sty
\XINT_restorecatcodes_now}%
\xintdeffloatvar twoPi := 0 +
6.28318530717958647692528676655900576839433879875021164194989;%
\xintdeffloatvar threePiover2 := 0 +
4.71238898038468985769396507491925432629575409906265873146242;%
\xintdeffloatvar Pi := 0 +
3.14159265358979323846264338327950288419716939937510582097494;%
\xintdeffloatvar Piover2 := 0 +
1.57079632679489661923132169163975144209858469968755291048747;%
\xintdeffloatvar oneDegree := 0 +
0.0174532925199432957692369076848861271344287188854172545609719;% Pi/180
\xintdeffloatvar oneRadian := 0 +
57.2957795130823208767981548141051703324054724665643215491602;% 180/Pi
\xintdeffloatvar invfact\xintListWithSep{, invfact}{\xintSeq{2}{44}}%
:= \xintfloatexpr [\XINTdigits] % force float rounding after exact evaluations
\xintexpr rseq(1/2; @/i, i=3..44)\relax % no need to hide this inner ;
\relax;%
\xintdeffloatfunc sin_aux(X) := 1 - X(invfact3 - X(invfact5
\ifnum\XINTdigits>4
- X(invfact7
\ifnum\XINTdigits>6
- X(invfact9
\ifnum\XINTdigits>8
- X(invfact11
\ifnum\XINTdigits>10
- X(invfact13
\ifnum\XINTdigits>13
- X(invfact15
\ifnum\XINTdigits>15
- X(invfact17
\ifnum\XINTdigits>18
- X(invfact19
\ifnum\XINTdigits>21
- X(invfact21
\ifnum\XINTdigits>24
- X(invfact23
\ifnum\XINTdigits>27
- X(invfact25
\ifnum\XINTdigits>30
- X(invfact27
\ifnum\XINTdigits>33
- X(invfact29
\ifnum\XINTdigits>36
- X(invfact31
\ifnum\XINTdigits>39
- X(invfact33
\ifnum\XINTdigits>43
- X(invfact35
\ifnum\XINTdigits>46
- X(invfact37
\ifnum\XINTdigits>49
- X(invfact39
\ifnum\XINTdigits>53
- X(invfact41
\ifnum\XINTdigits>59
- X(invfact43
)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi));%
\xintdeffloatfunc cos_aux(X) := 1 - X(invfact2 - X(invfact4
\ifnum\XINTdigits>3
- X(invfact6
\ifnum\XINTdigits>5
- X(invfact8
\ifnum\XINTdigits>7
- X(invfact10
\ifnum\XINTdigits>9
- X(invfact12
\ifnum\XINTdigits>12
- X(invfact14
\ifnum\XINTdigits>14
- X(invfact16
\ifnum\XINTdigits>17
- X(invfact18
\ifnum\XINTdigits>20
- X(invfact20
\ifnum\XINTdigits>23
- X(invfact22
\ifnum\XINTdigits>25
- X(invfact24
\ifnum\XINTdigits>28
- X(invfact26
\ifnum\XINTdigits>32
- X(invfact28
\ifnum\XINTdigits>35
- X(invfact30
\ifnum\XINTdigits>38
- X(invfact32
\ifnum\XINTdigits>41
- X(invfact34
\ifnum\XINTdigits>44
- X(invfact36
\ifnum\XINTdigits>48
- X(invfact38
\ifnum\XINTdigits>51
- X(invfact40
\ifnum\XINTdigits>55
- X(invfact42
\ifnum\XINTdigits>58
- X(invfact44
)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi)\fi));%
\expandafter\let\csname XINT_expr_func_sin_aux\expandafter\endcsname
\csname XINT_flexpr_func_sin_aux\endcsname
\expandafter\let\csname XINT_expr_func_cos_aux\expandafter\endcsname
\csname XINT_flexpr_func_cos_aux\endcsname
\xintdeffloatfunc sin_(x) := x * sin_aux(sqr(x));%
\xintdeffloatfunc cos_(x) := cos_aux(sqr(x));%
\def\XINT_mod_ccclx_i #1.% input <k>.<N>. k is a non-negative exponent
{%
\expandafter\XINT_mod_ccclx_e\the\numexpr
\expandafter\XINT_mod_ccclx_j\the\numexpr1\ifcase#1 \or0\or00\else000\fi.%
}%
\def\XINT_mod_ccclx_j 1#1.#2.% #2=N is a non-negative mantissa
{%
(\XINT_mod_ccclx_ja {++}#2#1\XINT_mod_ccclx_jb 0000000\relax
}% 1 2345678
\def\XINT_mod_ccclx_ja #1#2#3#4#5#6#7#8#9%
{%
#9+#8+#7+#6+#5+#4+#3+#2\xint_firstoftwo{+\XINT_mod_ccclx_ja{+#9+#8+#7}}{#1}%
}%
\def\XINT_mod_ccclx_jb #1\xint_firstoftwo#2#3{#1+0)*280\XINT_mod_ccclx_jc #1#3}%
\def\XINT_mod_ccclx_jc +#1+#2+#3#4\relax{+80*(#3+#2+#1)+#3#2#1.}%
\def\XINT_mod_ccclx_e#1.{\expandafter\XINT_mod_ccclx_z\the\numexpr(#1+180)/360-1.#1.}%
\def\XINT_mod_ccclx_z#1.#2.{#2-360*#1.}%
\def\XINT_flexpr_func_sind_ #1#2#3%
{%
\expandafter #1\expandafter #2\expandafter{%
\romannumeral`&&@\XINT:NEhook:f:one:from:one{\romannumeral`&&@\xintSind#3}}%
}%
\def\XINT_expr_unlock{\expandafter\xint_firstofone\romannumeral`&&@}%
\def\xintSind#1{\romannumeral`&&@\expandafter\xintsind
\romannumeral0\XINTinfloatS[\XINTdigits]{#1}}%
\def\xintsind #1[#2#3]%
{%
\xint_UDsignfork
#2\XINT_sind
-\XINT_sind_int
\krof#2#3.#1..%<< attention extra dot
}%
\def\XINT_sind #1.#2.% NOT TO BE USED WITH VANISHING (OR NEGATIVE) #2.
{%
\expandafter\XINT_sind_a
\romannumeral0\xinttrunc{\XINTdigits}{#2[#1]}%
}%
\def\XINT_sind_a{\expandafter\XINT_sind_i\the\numexpr\XINT_mod_ccclx_i0.}%
\def\XINT_sind_int
{%
\expandafter\XINT_sind_i\the\numexpr\expandafter\XINT_mod_ccclx_i
}%
\def\XINT_sind_i #1.% range reduction inside [0, 360[
{%
\ifcase\numexpr#1/90\relax
\expandafter\XINT_sind_A
\or\expandafter\XINT_sind_B\the\numexpr-90+%
\or\expandafter\XINT_sind_C\the\numexpr-180+%
\or\expandafter\XINT_sind_D\the\numexpr-270+%
\else\expandafter\XINT_sind_E\the\numexpr-360+%
\fi#1.%
}%
\def\XINT_sind_A#1{%
\def\XINT_sind_A##1.##2.%
{%
\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_sin_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}#1}}%
}%
}\expandafter
\XINT_sind_A\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_sind_B#1{\xint_UDsignfork#1\XINT_sind_B_n-\XINT_sind_B_p\krof #1}%
\def\XINT_tmpa#1{%
\def\XINT_sind_B_n-##1.##2.%
{%
\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_cos_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}#1}}%
}%
\def\XINT_sind_B_p##1.##2.%
{%
\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_cos_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}#1}}%
}%
}\expandafter
\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_sind_C#1{\xint_UDsignfork#1\XINT_sind_C_n-\XINT_sind_C_p\krof #1}%
\def\XINT_tmpa#1{%
\def\XINT_sind_C_n-##1.##2.%
{%
\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_sin_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}#1}}%
}%
\def\XINT_sind_C_p##1.##2.%
{%
\xintiiopp\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_sin_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}#1}}%
}%
}\expandafter
\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_sind_D#1{\xint_UDsignfork#1\XINT_sind_D_n-\XINT_sind_D_p\krof #1}%
\def\XINT_tmpa#1{%
\def\XINT_sind_D_n-##1.##2.%
{%
\xintiiopp\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_cos_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}#1}}%
}%
\def\XINT_sind_D_p##1.##2.%
{%
\xintiiopp\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_cos_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}#1}}%
}%
}\expandafter
\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_sind_E#1{%
\def\XINT_sind_E-##1.##2.%
{%
\xintiiopp\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_sin_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}#1}}%
}%
}\expandafter
\XINT_sind_E\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_flexpr_func_cosd_ #1#2#3%
{%
\expandafter #1\expandafter #2\expandafter{%
\romannumeral`&&@\XINT:NEhook:f:one:from:one{\romannumeral`&&@\xintCosd#3}}%
}%
\def\xintCosd#1{\romannumeral`&&@\expandafter\xintcosd
\romannumeral0\XINTinfloatS[\XINTdigits]{#1}}%
\def\xintcosd #1[#2#3]%
{%
\xint_UDsignfork
#2\XINT_cosd
-\XINT_cosd_int
\krof#2#3.#1..%<< attention extra dot
}%
\def\XINT_cosd #1.#2.% NOT TO BE USED WITH VANISHING (OR NEGATIVE) #2.
{%
\expandafter\XINT_cosd_a
\romannumeral0\xinttrunc{\XINTdigits}{#2[#1]}%
}%
\def\XINT_cosd_a{\expandafter\XINT_cosd_i\the\numexpr\XINT_mod_ccclx_i0.}%
\def\XINT_cosd_int
{%
\expandafter\XINT_cosd_i\the\numexpr\expandafter\XINT_mod_ccclx_i
}%
\def\XINT_cosd_i #1.%
{%
\ifcase\numexpr#1/90\relax
\expandafter\XINT_cosd_A
\or\expandafter\XINT_cosd_B\the\numexpr-90+%
\or\expandafter\XINT_cosd_C\the\numexpr-180+%
\or\expandafter\XINT_cosd_D\the\numexpr-270+%
\else\expandafter\XINT_cosd_E\the\numexpr-360+%
\fi#1.%
}%
\def\XINT_cosd_A#1{%
\def\XINT_cosd_A##1.##2.%
{%
\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_cos_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}#1}}%
}%
}\expandafter
\XINT_cosd_A\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_cosd_B#1{\xint_UDsignfork#1\XINT_cosd_B_n-\XINT_cosd_B_p\krof #1}%
\def\XINT_tmpa#1{%
\def\XINT_cosd_B_n-##1.##2.%
{%
\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_sin_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}#1}}%
}%
\def\XINT_cosd_B_p##1.##2.%
{%
\xintiiopp\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_sin_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}#1}}%
}%
}\expandafter
\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_cosd_C#1{\xint_UDsignfork#1\XINT_cosd_C_n-\XINT_cosd_C_p\krof #1}%
\def\XINT_tmpa#1{%
\def\XINT_cosd_C_n-##1.##2.%
{%
\xintiiopp\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_cos_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}#1}}%
}%
\def\XINT_cosd_C_p##1.##2.%
{%
\xintiiopp\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_cos_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}#1}}%
}%
}\expandafter
\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_cosd_D#1{\xint_UDsignfork#1\XINT_cosd_D_n-\XINT_cosd_D_p\krof #1}%
\def\XINT_tmpa#1{%
\def\XINT_cosd_D_n-##1.##2.%
{%
\xintiiopp\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_sin_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}#1}}%
}%
\def\XINT_cosd_D_p##1.##2.%
{%
\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_sin_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{##1.##2}#1}}%
}%
}\expandafter
\XINT_tmpa\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\def\XINT_cosd_E#1{%
\def\XINT_cosd_E-##1.##2.%
{%
\XINT_expr_unlock\expandafter\XINT_flexpr_userfunc_cos_\expandafter
{\romannumeral0\XINTinfloat[\XINTdigits]{\xintMul{\xintSub{##1[0]}{.##2}}#1}}%
}%
}\expandafter
\XINT_cosd_E\expandafter{\romannumeral`&&@\xintthebarefloateval oneDegree\relax}%
\xintdeffloatfunc sind(x) := (x)??
{(x>=-45)?
{sin_(x*oneDegree)}
{-sind_(-x)}
}
{0}
{(x<=45)?
{sin_(x*oneDegree)}
{sind_(x)}
}
;%
\xintdeffloatfunc cosd(x) := (x)??
{(x>=-45)?
{cos_(x*oneDegree)}
{cosd_(-x)}
}
{1}
{(x<=45)?
{cos_(x*oneDegree)}
{cosd_(x)}
}
;%
\xintdeffloatfunc sin(x):= (abs(x)<0.79)?
{sin_(x)}
{(x)??
{-sind_(-x*oneRadian)}
{0}
{sind_(x*oneRadian)}
}
;%
\xintdeffloatfunc cos(x):= (abs(x)<0.79)?
{cos_(x)}
{cosd_(abs(x*oneRadian))}
;%
\xintdeffloatfunc sinc(x):= (abs(x)<0.79) ?
{sin_aux(sqr(x))}
{sind_(abs(x)*oneRadian)/abs(x)}
;%
\xintdeffloatfunc tand(x):= sind(x)/cosd(x);%
\xintdeffloatfunc cotd(x):= cosd(x)/sind(x);%
\xintdeffloatfunc tan(x) := (x)??
{(x>-0.79)?
{sin(x)/cos(x)}
{-cotd(90+x*oneRadian)
}
}
{0}
{(x<0.79)?
{sin(x)/cos(x)}
{cotd(90-x*oneRadian)}
}
;%
\xintdeffloatfunc cot(x) := (abs(x)<0.79)?
{cos(x)/sin(x)}
{(x)??
{-tand(90+x*oneRadian)}
{0}
{tand(90-x*oneRadian)}
};%
\xintdeffloatfunc sec(x) := inv(cos(x));%
\xintdeffloatfunc csc(x) := inv(sin(x));%
\xintdeffloatfunc secd(x):= inv(cosd(x));%
\xintdeffloatfunc cscd(x):= inv(sind(x));%
\xintdeffloatfunc asin_aux(X) := 1
\ifnum\XINTdigits>3 % actually 4 would achieve 1ulp in place of <0.5ulp
+ X(1/6
\ifnum\XINTdigits>9
+ X(3/40
\ifnum\XINTdigits>16
+ X(5/112
\ifnum\XINTdigits>25
+ X(35/1152
\ifnum\XINTdigits>35
+ X(63/2816
\ifnum\XINTdigits>46
+ X(231/13312
)\fi)\fi)\fi)\fi)\fi)\fi;%
\xintdeffloatfunc asin_o(D, T) := T + D*asin_aux(sqr(D));%
\xintdeffloatfunc asin_n(V, T, t, u) :=% V is square of T
asin_o (\xintexpr t*cos_aux(V) - u*T*sin_aux(V)\relax, T);%
\xintdeffloatfunc asin_m(T, t, u) := asin_n(sqr(T), T, t, u);%
\xintdeffloatfunc asin_l(t, u) := asin_m(t*asin_aux(sqr(t)), t, u);%
\xintdeffloatfunc asin_a(t, u) := (t<u)?
{asin_l(t, u)}
{Piover2 - asin_l(u, t)}
;%
\xintdeffloatfunc asind_a(t, u):= (t<u)?
{asin_l(t, u) * oneRadian}
{90 - asin_l(u, t) * oneRadian}
;%
\xintdeffloatfunc asin(t) := (t)??
{-asin_a(-t, sqrt_(1-sqr(t)))}
{0}
{asin_a(t, sqrt_(1-sqr(t)))}
;%
\xintdeffloatfunc asind(t) := (t)??
{-asind_a(-t, sqrt_(1-sqr(t)))}
{0}
{asind_a(t, sqrt_(1-sqr(t)))}
;%
\xintdeffloatfunc acos(t) := Piover2 - asin(t);%
\xintdeffloatfunc acosd(t):= 90 - asind(t);%
\xintdeffloatfunc atan_b(t, w, z):= 0.5 * (w< 0)?
{Pi - asin_a(2z * t, -w*z)}
{asin_a(2z * t, w*z)}
;%
\xintdeffloatfunc atan_a(t, T) := atan_b(t, 1-T, inv(1+T));%
\xintdeffloatfunc atan(t):= (t)??
{-atan_a(-t, sqr(t))}
{0}
{atan_a(t, sqr(t))}
;%
\xintdeffloatfunc atand_b(t, w, z) := 0.5 * (w< 0)?
{180 - asind_a(2z * t, -w*z)}
{asind_a(2z * t, w*z)}
;%
\xintdeffloatfunc atand_a(t, T) := atand_b(t, 1-T, inv(1+T));%
\xintdeffloatfunc atand(t) := (t)??
{-atand_a(-t, sqr(t))}
{0}
{atand_a(t, sqr(t))}
;%
\xintdeffloatfunc Arg(x, y):= (y>x)?
{(y>-x)?
{Piover2 - atan(x/y)}
{(y<0)?
{-Pi + atan(y/x)}
{Pi + atan(y/x)}
}
}
{(y>-x)?
{atan(y/x)}
{-Piover2 + atan(x/-y)}
}
;%
\xintdeffloatfunc atan2(y,x) := Arg(x, y);%
\xintdeffloatfunc Argd(x, y):= (y>x)?
{(y>-x)?
{90 - atand(x/y)}
{(y<0)?
{-180 + atand(y/x)}
{180 + atand(y/x)}
}
}
{(y>-x)?
{atand(y/x)}
{-90 + atand(x/-y)}
}
;%
\xintdeffloatfunc atan2d(y,x) := Argd(x, y);%
\xintdeffloatfunc pArg(x, y):= (y>x)?
{(y>-x)?
{Piover2 - atan(x/y)}
{Pi + atan(y/x)}
}
{(y>-x)?
{(y<0)?
{twoPi + atan(y/x)}
{atan(y/x)}
}
{threePiover2 + atan(x/-y)}
}
;%
\xintdeffloatfunc pArgd(x, y):=(y>x)?
{(y>-x)?
{90 - atan(x/y)*oneRadian}
{180 + atan(y/x)*oneRadian}
}
{(y>-x)?
{(y<0)?
{360 + atan(y/x)*oneRadian}
{atan(y/x)*oneRadian}
}
{270 + atan(x/-y)*oneRadian}
}
;%
\expandafter\let\csname XINT_flexpr_func_tg\expandafter\endcsname
\csname XINT_flexpr_func_tan\endcsname
\expandafter\let\csname XINT_flexpr_func_cotg\expandafter\endcsname
\csname XINT_flexpr_func_cot\endcsname
\xintFor #1 in {sin, cos, tan, sec, csc, cot,
asin, acos, atan}\do
{%
\xintdeffunc #1(x) := \xintfloatexpr #1(sfloat(x))\relax;%
\xintdeffunc #1d(x):= \xintfloatexpr #1d(sfloat(x))\relax;%
}%
\xintFor #1 in {Arg, pArg, atan2}\do
{%
\xintdeffunc #1(x, y) := \xintfloatexpr #1(sfloat(x), sfloat(y))\relax;%
\xintdeffunc #1d(x, y):= \xintfloatexpr #1d(sfloat(x), sfloat(y))\relax;%
}%
\xintdeffunc tg(x) := \xintfloatexpr tg(sfloat(x))\relax;%
\xintdeffunc cotg(x):= \xintfloatexpr cotg(sfloat(x))\relax;%
\xintdeffunc sinc(x):= \xintfloatexpr sinc(sfloat(x))\relax;%
\xintFor* #1 in {iDTVtuwxyzX}\do{\xintrestorevariable{#1}}%
\endinput
%%
%% End of file `xinttrig.sty'.
|