-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimath.html
1601 lines (1375 loc) · 108 KB
/
timath.html
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
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>timath.h</TITLE>
<STYLE TYPE="TEXT/CSS">
<!--
.IE3-DUMMY { CONT-SIZE: 100%; }
BODY { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; BACKGROUND-COLOR: #E0E0E0; }
P { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; }
H1 { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; }
H2 { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; }
H3 { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; }
H4 { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; }
H5 { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; }
H6 { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; }
UL { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; }
TD { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; BACKGROUND-COLOR: #FFFFFF; }
.NOBORDER { BACKGROUND-COLOR: #E0E0E0; PADDING: 0pt; }
.NOBORDER TD { FONT-FAMILY: Verdana,Arial,Helvetica,Sans-Serif; BACKGROUND-COLOR: #E0E0E0; PADDING: 0pt; }
.CODE { FONT-FAMILY: Courier New; }
-->
</STYLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#E0E0E0">
<FONT SIZE="5"><B>The <timath.h> Header File</B></FONT>
<HR>
<P><B>Routines for floating point arithmetic</B></P>
<H3><U>Functions</U></H3>
<DL INDENT="20"><DT><B><A HREF="stdlib.html#abs">abs</A></B><DD>Absolute value of a number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#acos">acos</A></B><DD>Floating point arc cosine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#acosh">acosh</A></B><DD>Floating point hyperbolic area cosine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#asin">asin</A></B><DD>Floating point arc sine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#asinh">asinh</A></B><DD>Floating point hyperbolic area sine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#atan2">atan2</A></B><DD>Four-quadrant arc tangent of y/x (or argument of the complex number).<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#atan">atan</A></B><DD>Floating point arc tangent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#atanh">atanh</A></B><DD>Floating point hyperbolic area tangent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#atof">atof</A></B><DD>Converts a string to a floating point.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcd_to_float">bcd_to_float</A></B><DD>Converts BCD to float.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcd_var">bcd_var</A></B><DD>Converts reference to float object to reference to BCD object.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcdadd">bcdadd</A></B><DD>BCD addition.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcdbcd">bcdbcd</A></B><DD>Converts integer to BCD.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcdcmp">bcdcmp</A></B><DD>BCD comparation.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcddiv">bcddiv</A></B><DD>BCD division.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcdlong">bcdlong</A></B><DD>Converts BCD to integer.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcdmul">bcdmul</A></B><DD>BCD multiplication.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcdneg">bcdneg</A></B><DD>BCD negation.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#bcdsub">bcdsub</A></B><DD>BCD substraction.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#cacos">cacos</A></B><DD>Complex arc cosine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#cacosh">cacosh</A></B><DD>Complex hyperbolic area cosine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#casin">casin</A></B><DD>Complex arc sine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#casinh">casinh</A></B><DD>Complex hyperbolic area sine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#catan">catan</A></B><DD>Complex arc tangent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#catanh">catanh</A></B><DD>Complex hyperbolic area tangent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ccos">ccos</A></B><DD>Complex cosine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ccosh">ccosh</A></B><DD>Complex hyperbolic cosine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ceil">ceil</A></B><DD>Rounds up the floating point number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#cexp">cexp</A></B><DD>Complex exponential function.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ck_valid_float">ck_valid_float</A></B><DD>Checks if the float pointed to by <I>ptr</I> is valid.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#cln">cln</A></B><DD>Complex natural logarithm (base <B>e</B>).<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#clog10">clog10</A></B><DD>Complex logarithm, base 10.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#cos">cos</A></B><DD>Floating point cosine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#cosh">cosh</A></B><DD>Floating point hyperbolic cosine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#csin">csin</A></B><DD>Complex sine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#csinh">csinh</A></B><DD>Complex hyperbolic sine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#csqrt">csqrt</A></B><DD>Complex square root.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ctan">ctan</A></B><DD>Complex tangent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ctanh">ctanh</A></B><DD>Complex hyperbolic tangent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#exp">exp</A></B><DD>Floating point exponential function.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fabs">fabs</A></B><DD>Absolute value of a floating point number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fadd">fadd</A></B><DD>Floating point addition.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fcmp">fcmp</A></B><DD>Floating point comparation.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fdiv">fdiv</A></B><DD>Floating point division.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#M_FEXP_NEG">FEXP_NEG</A></B><DD>A deprecated macro used to define floating point numbers.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#M_FEXP">FEXP</A></B><DD>A deprecated macro used to define floating point numbers.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#float_class">float_class</A></B><DD>Determines the class of the floating point number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#float_to_bcd">float_to_bcd</A></B><DD>Converts float to BCD.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#floor">floor</A></B><DD>Rounds down the floating point number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#M_FLT_NEG">FLT_NEG</A></B><DD>A deprecated macro used to define floating point numbers.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#flt">flt</A></B><DD>Converts integer to floating point.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#M_FLT">FLT</A></B><DD>A deprecated macro used to define floating point numbers.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fmod">fmod</A></B><DD>Calculates x modulo y, i.e. the remainder of x/y.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fmul">fmul</A></B><DD>Floating point multiplication.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fneg">fneg</A></B><DD>Floating point negation.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fpisanint">fpisanint</A></B><DD>Checks whether the floating point number is reducable to an integer.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fpisodd">fpisodd</A></B><DD>Checks whether the integer part of a floating point number is an odd number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#frexp10">frexp10</A></B><DD>Splits floating point number into mantissa and exponent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#fsub">fsub</A></B><DD>Floating point substraction.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#hypot">hypot</A></B><DD>Calculates hypotenuse of right triangle.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#init_float">init_float</A></B><DD>Initializes the floating point emulator.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_float_infinity">is_float_infinity</A></B><DD>Checks whether the argument is an infinite number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_float_negative_zero">is_float_negative_zero</A></B><DD>Checks whether the argument is negative zero.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_float_positive_zero">is_float_positive_zero</A></B><DD>Checks whether the argument is positive zero.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_float_signed_infinity">is_float_signed_infinity</A></B><DD>Checks whether the argument is signed infinity.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_float_transfinite">is_float_transfinite</A></B><DD>Checks whether the argument is a transfinite number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_float_unsigned_inf_or_nan">is_float_unsigned_inf_or_nan</A></B><DD>Checks whether the argument is unsigned infinity or Not_a_Number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_float_unsigned_zero">is_float_unsigned_zero</A></B><DD>Checks whether the argument is unsigned zero.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_inf">is_inf</A></B><DD>Checks whether the argument is an infinite number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_nan">is_nan</A></B><DD>Checks whether the argument is Not_a_Number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_nzero">is_nzero</A></B><DD>Checks whether the argument is negative zero.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_pzero">is_pzero</A></B><DD>Checks whether the argument is positive zero.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_sinf">is_sinf</A></B><DD>Checks whether the argument is signed infinity.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_transfinite">is_transfinite</A></B><DD>Checks whether the argument is a transfinite number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_uinf_or_nan">is_uinf_or_nan</A></B><DD>Checks whether the argument is unsigned infinity or Not_a_Number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#is_uzero">is_uzero</A></B><DD>Checks whether the argument is unsigned zero.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#itrig">itrig</A></B><DD>Generic subroutine for calculating inverse trigonometric functions.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="stdlib.html#labs">labs</A></B><DD>Absolute value of a long integer number.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ldexp10">ldexp10</A></B><DD>Calculates x times 10 raised to exponent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#log">log</A></B><DD>Floating point natural logarithm (base <B>e</B>).<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#log10">log10</A></B><DD>Floating point logarithm, base 10.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#modf">modf</A></B><DD>Splits floating point value into integer and fraction part.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#pow">pow</A></B><DD>Floating point power function.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#round12_err">round12_err</A></B><DD>Rounds the floating point number to 12 significant digits, throwing an error if unsuccessful.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#round12">round12</A></B><DD>Rounds the floating point number to 12 significant digits.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#round14">round14</A></B><DD>Rounds the floating point number to 14 significant digits.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#sin">sin</A></B><DD>Floating point sine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#sincos">sincos</A></B><DD>Calculates both sine and cosine in one turn.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#sinh">sinh</A></B><DD>Floating point hyperbolic sine.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#sqrt">sqrt</A></B><DD>Floating point square root.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#tan">tan</A></B><DD>Floating point tangent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#tanh">tanh</A></B><DD>Floating point hyperbolic tangent.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#trig">trig</A></B><DD>Generic subroutine for calculating trigonometric functions.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#trunc">trunc</A></B><DD>Converts floating point to integer.</DL>
<H3><U>Constants</U></H3>
<DL INDENT="20"><DT><B><A HREF="#FIVE">FIVE</A></B><DD>A deprecated constant.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#FOUR">FOUR</A></B><DD>A deprecated constant.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#HALF_PI">HALF_PI</A></B><DD>A constant with value <A HREF="#PI">PI</A>/2.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#HALF">HALF</A></B><DD>A deprecated constant.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#MINUS_ONE">MINUS_ONE</A></B><DD>A deprecated constant.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#NAN">NAN</A></B><DD>A constant defining an undefined value.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#NEGATIVE_INF">NEGATIVE_INF</A></B><DD>Represents an infinitely large negative quantity.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#NEGATIVE_ZERO">NEGATIVE_ZERO</A></B><DD>Represents an infinitely small quantity which is known to be always non-positive.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ONE">ONE</A></B><DD>A deprecated constant.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#PI">PI</A></B><DD>An approximated value of pi.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#POSITIVE_INF">POSITIVE_INF</A></B><DD>Represents an infinitely large positive quantity.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#POSITIVE_ZERO">POSITIVE_ZERO</A></B><DD>Represents an infinitely small quantity which is known to be always non-negative.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#TEN">TEN</A></B><DD>A deprecated constant.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#THREE">THREE</A></B><DD>A deprecated constant.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#TWO">TWO</A></B><DD>A deprecated constant.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#UNSIGNED_INF">UNSIGNED_INF</A></B><DD>Represents an infinite quantity.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#UNSIGNED_ZERO">UNSIGNED_ZERO</A></B><DD>Represents an infinitely small quantity with indeterminate sign.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ZERO">ZERO</A></B><DD>A deprecated constant.</DL>
<H3><U>Predefined Types</U></H3>
<DL INDENT="20"><DT><B><A HREF="#bcd">bcd</A></B><DD>Represents the internal organization of floating point numbers
in the format recognized by the TIOS.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="alloc.html#Bool">Bool</A></B><DD>An enumeration to describe true or false values.<IMG WIDTH="1" HEIGHT="20" ALIGN="TOP"><DT><B><A HREF="#ti_float">ti_float</A></B><DD>An alias for the standard ANSI float type.</DL>
<P><B>Note:</B> All functions which return a result of type float are
implemented as macros, although many of them exist as TIOS entries. This is done
because the GCC convention for returning floating point values as function results
differs from the convention expected by the TIOS. This note is mainly unimportant from
the user's point of view.</P>
<P>See also: <A HREF="math.html">math.h</A></P>
<HR>
<H3><A NAME="acos"><U>acos</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> acos (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point arc cosine.</B></P>
<P>acos returns the arc cosine of floating point argument <I>x</I>. The result is
always in radians.
<BR><BR>
<B>Note:</B> If the argument is not in range from -1 to 1, acos will return
<A HREF="#NAN">NAN</A>.</P>
<HR>
<H3><A NAME="acosh"><U>acosh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> acosh (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point hyperbolic area cosine.</B></P>
<P>asinh returns the hyperbolic area cosine of floating point argument <I>x</I>,
Hyperbolic area cosine is defined as log(x+sqrt(x*x-1)).
<BR><BR>
<B>Note:</B> acosh will return <A HREF="#NAN">NAN</A> if <I>x</I> is smaller than 1.</P>
<HR>
<H3><A NAME="asin"><U>asin</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> asin (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point arc sine.</B></P>
<P>asin returns the arc sine of floating point argument <I>x</I>. The result is
always in radians.
<BR><BR>
<B>Note:</B> If the argument is not in range from -1 to 1, asin will return
<A HREF="#NAN">NAN</A>.</P>
<HR>
<H3><A NAME="asinh"><U>asinh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> asinh (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point hyperbolic area sine.</B></P>
<P>asinh returns the hyperbolic area sine of floating point argument <I>x</I>.
Hyperbolic area sine is defined as log(x+sqrt(x*x+1)).</P>
<HR>
<H3><A NAME="atan2"><U>atan2</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> atan2 (<B><A HREF="keywords.html#float">float</A></B> y, <B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Four-quadrant arc tangent of y/x (or argument of the complex number).</B></P>
<P>atan2 returns the four-quadrant arc tangent of <I>y</I>/<I>x</I>. More precise,
it returns the argument of the complex number <I>x</I> + <I>y</I> <I>i</I>.
So, the result is in the range -<I>pi</I> to <I>pi</I>.
<BR><BR>
<B>Note:</B> atan2 produces correct results even when the
resulting angle is near <I>pi</I>/2 or -<I>pi</I>/2 (<I>x</I> near
zero). If both <I>x</I> and <I>y</I> are zeros, atan2 returns <A HREF="#NAN">NAN</A>.</P>
<HR>
<H3><A NAME="atan"><U>atan</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> atan (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point arc tangent.</B></P>
<P>asin returns the arc tangent of floating point argument <I>x</I>. The result is
always in radians.</P>
<HR>
<H3><A NAME="atanh"><U>atanh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> atanh (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point hyperbolic area tangent.</B></P>
<P>atanh returns the hyperbolic area tangent of floating point argument <I>x</I>.
The hyperbolic area tangent is defined as log((1+x)/(1-x))/2.
<BR><BR>
<B>Note:</B> atanh will return <A HREF="#NAN">NAN</A> if <I>x</I> is smaller than -1
or greater than 1. Also, it will return <A HREF="#POSITIVE_INF">POSITIVE_INF</A>
if <I>x</I> is 1, and <A HREF="#NEGATIVE_INF">NEGATIVE_INF</A> if <I>x</I> is -1.</P>
<HR>
<H3><A NAME="atof"><U>atof</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> atof (<B><A HREF="keywords.html#const">const</A></B> <B><A HREF="keywords.html#int">char</A></B> *s);</TD></TR></TABLE></P>
<P><B>Converts a string to a floating point.</B></P>
<P>atof converts a string pointed to by <I>s</I> to floating point value. It recognizes
the character representation of a floating point number, made up of the following:</P>
<UL>
<LI><P>an optional string of spaces;</P></LI>
<LI><P>an optional minus sign;</P></LI>
<LI><P>a string of digits and an optional decimal point (the digits can be on both
sides of the decimal point);</P></LI>
<LI><P>an optional exponent followed by a (optionally signed) integer.</P></LI>
</UL>
<P>It is important to say that this implementation of atof requires that an optional
minus sign and an optional exponent must be TI Basic characters for minus sign and exponent,
(characters with codes 0xAD and 0x95 instead of ordinary
'-' and 'e' or 'E' characters).
This limitation is caused by using some TIOS calls which needs such number format. Anyway,
it is very easy to "preprocess" any string to satisfy this convention before calling to
atof by routine like the following (assuming that <I>c</I> is a char variable, and <I>i</I>
is an integer variable):</P>
<PRE>for (i = 0; (c = s[i]); i++)
// <I>Yes, the second '=' is really '=', not '=='</I>...
{
if (c == '-') s[i] = 0xAD;
if ((c|32) == 'e') s[i] = 0x95;
}
</PRE>
<P>atof returns the converted value of the input string. It returns <A HREF="#NAN">NAN</A> if the
input string cannot be converted (i.e. if it is not in a correct format). This is not the same
as in ANSI C: atof in ANSI C returns 0 if the conversion was not successful. I decided to
return <A HREF="#NAN">NAN</A> instead, so the user can check whether the conversion was
successful (which is not possible with ANSI atof). See <A HREF="#is_nan">is_nan</A> for a good
method to check whether the result is <A HREF="#NAN">NAN</A>.
<BR><BR>
<B>Note:</B> This function is not part of TIOS, and it is implemented
using the TIOS function <A HREF="estack.html#push_parse_text">push_parse_text</A>.<BR>
<B>Note:</B> You should use <A HREF="stdlib.html#strtod">strtod</A> instead of atof, since it will take up less space in
your program, and provide a more direct and finer error-checking.</P>
<P>See also: <A HREF="stdlib.html#strtod">strtod</A></P>
<HR>
<H3><A NAME="bcd_to_float"><U>bcd_to_float</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> bcd_to_float (<A HREF="#bcd">bcd</A> x);</TD></TR></TABLE></P>
<P><B>Converts BCD to float.</B></P>
<P>bcd_to_float converts BCD structure <I>x</I> into an ordinary floating point value.
In fact, this function returns the same value as the argument, but with different interpretation.
This function, in a way, performs typecasting from a <A HREF="#bcd">bcd</A> type to an ordinary
<CODE>float</CODE> type.</P>
<HR>
<H3><A NAME="bcd_var"><U>bcd_var</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="cpp.html#SEC10">#define</A></B> bcd_var(a) (*(<A HREF="#bcd">bcd</A>*)&(a))</TD></TR></TABLE></P>
<P><B>Converts reference to float object to reference to BCD object.</B></P>
<P>bcd_var converts the reference to a floating point object <I>x</I> (which must be an lvalue,
for example a floating point variable) to the reference to the same object, but interpreted
as a <A HREF="#bcd">bcd</A> structure. bcd_var is similar as <A HREF="#float_to_bcd">float_to_bcd</A>,
but returned object is an lvalue, so it may be used in assignments like</P>
<PRE>float a;
...
bcd_var(a).exponent = 0x4002;
</PRE>
<P>The drawback of bcd_var (compared with <A HREF="#float_to_bcd">float_to_bcd</A>) is the fact
that its argument must be an lvalue, so it cannot be a floating point constant or any
non-lvalue expression (for example, a result of a function).
<BR><BR>
<B>Note:</B> I used notation "&bcd_var" and "&x" in the prototype description, although passing
by reference and returning results by reference does not exist in ordinary C (only in C++).
However, this bcd_var is macro which is implemented on such way that it simulates
"passing and returning by reference".</P>
<HR>
<H3><A NAME="bcdadd"><U>bcdadd</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><A HREF="#bcd">bcd</A> bcdadd (<A HREF="#bcd">bcd</A> x, <A HREF="#bcd">bcd</A> y);</TD></TR></TABLE></P>
<P><B>BCD addition.</B></P>
<P>bcdadd is principally the same as <A HREF="#fadd">fadd</A>, but instead of
ordinary floats, its arguments and return value are <A HREF="#bcd">bcd</A>
structures (which represent internal organization of floating point values in
TIOS). At the fundamental level, bcdadd and <A HREF="#fadd">fadd</A> are the
same routine.</P>
<HR>
<H3><A NAME="bcdbcd"><U>bcdbcd</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><A HREF="#bcd">bcd</A> bcdbcd (<B><A HREF="keywords.html#short">long</A></B> x);</TD></TR></TABLE></P>
<P><B>Converts integer to BCD.</B></P>
<P>bcdbcd is principally the same as <A HREF="#flt">flt</A>, but instead of
ordinary float, its return value is a <A HREF="#bcd">bcd</A> structure (which
represent internal organization of floating point values in TIOS).
At the fundamental level, bcdbcd and <A HREF="#flt">flt</A> are the
same routine.</P>
<HR>
<H3><A NAME="bcdcmp"><U>bcdcmp</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">long</A></B> bcdcmp (<A HREF="#bcd">bcd</A> x, <A HREF="#bcd">bcd</A> y);</TD></TR></TABLE></P>
<P><B>BCD comparation.</B></P>
<P>bcdcmp is principally the same as <A HREF="#fcmp">fcmp</A>, but instead of
ordinary floats, its arguments are <A HREF="#bcd">bcd</A> structures (which
represent internal organization of floating point values in TIOS).
At the fundamental level, bcdcmp and <A HREF="#fcmp">fcmp</A> are the
same routine.</P>
<HR>
<H3><A NAME="bcddiv"><U>bcddiv</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><A HREF="#bcd">bcd</A> bcddiv (<A HREF="#bcd">bcd</A> x, <A HREF="#bcd">bcd</A> y);</TD></TR></TABLE></P>
<P><B>BCD division.</B></P>
<P>bcddiv is principally the same as <A HREF="#fdiv">fdiv</A>, but instead of
ordinary floats, its arguments and return value are <A HREF="#bcd">bcd</A>
structures (which represent internal organization of floating point values in
TIOS). At the fundamental level, bcddiv and <A HREF="#fdiv">fdiv</A> are the
same routine.</P>
<HR>
<H3><A NAME="bcdlong"><U>bcdlong</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">long</A></B> bcdlong (<A HREF="#bcd">bcd</A> x);</TD></TR></TABLE></P>
<P><B>Converts BCD to integer.</B></P>
<P>bcdlong is principally the same as <A HREF="#trunc">trunc</A>, but instead of
ordinary float, its argument is a <A HREF="#bcd">bcd</A> structure (which
represent internal organization of floating point values in TIOS).
At the fundamental level, bcdlong and <A HREF="#trunc">trunc</A> are the
same routine.</P>
<HR>
<H3><A NAME="bcdmul"><U>bcdmul</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><A HREF="#bcd">bcd</A> bcdmul (<A HREF="#bcd">bcd</A> x, <A HREF="#bcd">bcd</A> y);</TD></TR></TABLE></P>
<P><B>BCD multiplication.</B></P>
<P>bcdmul is principally the same as <A HREF="#fmul">fmul</A>, but instead of
ordinary floats, its arguments and return value are <A HREF="#bcd">bcd</A>
structures (which represent internal organization of floating point values in
TIOS). At the fundamental level, bcdmul and <A HREF="#fmul">fmul</A> are the
same routine.</P>
<HR>
<H3><A NAME="bcdneg"><U>bcdneg</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><A HREF="#bcd">bcd</A> bcdneg (<A HREF="#bcd">bcd</A> x);</TD></TR></TABLE></P>
<P><B>BCD negation.</B></P>
<P>bcdneg is principally the same as <A HREF="#fneg">fneg</A>, but instead of
ordinary floats, its argument and return value are <A HREF="#bcd">bcd</A>
structures (which represent internal organization of floating point values in
TIOS). At the fundamental level, bcdneg and <A HREF="#fneg">fneg</A> are the
same routine.</P>
<HR>
<H3><A NAME="bcdsub"><U>bcdsub</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><A HREF="#bcd">bcd</A> bcdsub (<A HREF="#bcd">bcd</A> x, <A HREF="#bcd">bcd</A> y);</TD></TR></TABLE></P>
<P><B>BCD substraction.</B></P>
<P>bcdsub is principally the same as <A HREF="#fsub">fsub</A>, but instead of
ordinary floats, its arguments and return value are <A HREF="#bcd">bcd</A>
structures (which represent internal organization of floating point values in
TIOS). At the fundamental level, bcdsub and <A HREF="#fsub">fsub</A> are the
same routine.</P>
<HR>
<H3><A NAME="cacos"><U>cacos</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> cacos (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex arc cosine.</B></P>
<P>cacos calculates the arc cosine w = acos(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex arc cosine is defined by
<BR><BR>
acos(z) = -<I>i</I> ln (z + <I>i</I> sqrt (1 - z^2))
<BR><BR>
where <B>ln</B> and <B>sqrt</B> are complex natural
logarithm and complex square root (see <A HREF="#cln">cln</A> and
<A HREF="#csqrt">csqrt</A>).</P>
<HR>
<H3><A NAME="cacosh"><U>cacosh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> cacosh (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex hyperbolic area cosine.</B></P>
<P>cacosh calculates the hyperbolic area cosine w = acosh(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex hyperbolic area cosine is defined by
<BR><BR>
acosh(z) = ln (z + sqrt (z^2 - 1))
<BR><BR>
where <B>ln</B> and <B>sqrt</B> are complex natural
logarithm and complex square root (see <A HREF="#cln">cln</A> and
<A HREF="#csqrt">csqrt</A>).</P>
<HR>
<H3><A NAME="casin"><U>casin</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> casin (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex arc sine.</B></P>
<P>casin calculates the arc sine w = asin(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex arc sine is defined by
<BR><BR>
asin(z) = -<I>i</I> ln (<I>i</I> z + sqrt (1 - z^2))
<BR><BR>
where <B>ln</B> and <B>sqrt</B> are complex natural
logarithm and complex square root (see <A HREF="#cln">cln</A> and
<A HREF="#csqrt">csqrt</A>).</P>
<HR>
<H3><A NAME="casinh"><U>casinh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> casinh (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex hyperbolic area sine.</B></P>
<P>casinh calculates the hyperbolic area sine w = asinh(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex hyperbolic area sine is defined by
<BR><BR>
asinh(z) = ln (z + sqrt (z^2 + 1))
<BR><BR>
where <B>ln</B> and <B>sqrt</B> are complex natural
logarithm and complex square root (see <A HREF="#cln">cln</A> and
<A HREF="#csqrt">csqrt</A>).</P>
<HR>
<H3><A NAME="catan"><U>catan</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> catan (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex arc tangent.</B></P>
<P>catan calculates the arc tangent w = atan(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex arc tangent is defined by
<BR><BR>
atan(z) = -<I>i</I> ln ((1 + <I>i</I> z) / (1 - <I>i</I> z)) / 2
<BR><BR>
where <B>ln</B> is complex natural
logarithm (see <A HREF="#cln">cln</A>).</P>
<HR>
<H3><A NAME="catanh"><U>catanh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> catanh (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex hyperbolic area tangent.</B></P>
<P>catanh calculates the hyperbolic area tangent w = atanh(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex hyperbolic area tangent is defined by
<BR><BR>
atanh(z) = ln ((1 + z) / (1 - z)) / 2
<BR><BR>
where <B>ln</B> is complex natural logarithm
(see <A HREF="#cln">cln</A>).</P>
<HR>
<H3><A NAME="ccos"><U>ccos</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> ccos (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex cosine.</B></P>
<P>ccos calculates the cosine w = cos(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex cosine is defined by
<BR><BR>
cos(z) = (exp(<I>i</I> z) + exp(-<I>i</I> z)) / 2
<BR><BR>
where <B>exp</B> is complex exponential function
(see <A HREF="#cexp">cexp</A>).</P>
<HR>
<H3><A NAME="ccosh"><U>ccosh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> ccosh (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex hyperbolic cosine.</B></P>
<P>ccosh calculates the hyperbolic cosine w = cosh(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex hyperbolic cosine is defined by
<BR><BR>
cosh(z) = (exp(z) + exp(-z)) / 2
<BR><BR>
where <B>exp</B> is complex exponential function
(see <A HREF="#cexp">cexp</A>).</P>
<HR>
<H3><A NAME="ceil"><U>ceil</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> ceil (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Rounds up the floating point number.</B></P>
<P>ceil finds the smallest integer not less than floating point argument <I>x</I>,
and returns the integer found as a floating point value.</P>
<HR>
<H3><A NAME="cexp"><U>cexp</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> cexp (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex exponential function.</B></P>
<P>cexp calculates the complex exponential function w = exp(z) of the complex
number which real and imaginary parts are <I>z_re</I> and
<I>z_im</I>, and stores real and imaginary part of the result
in floating point destinations pointed to by <I>w_re</I> and
<I>w_im</I>. The complex exponential function is defined by
<BR><BR>
exp(z) = exp(z_re) (cos(z_im) + <I>i</I> sin(z_im))
<BR><BR>
See <A HREF="#exp">exp</A>, <A HREF="#sin">sin</A> and <A HREF="#cos">cos</A>.</P>
<HR>
<H3><A NAME="ck_valid_float"><U>ck_valid_float</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> ck_valid_float (<B><A HREF="keywords.html#float">float</A></B> *ptr);</TD></TR></TABLE></P>
<P><B>Checks if the float pointed to by <I>ptr</I> is valid.</B></P>
<P>This function first rounds *ptr to 14 significant digits and underflows it to 0 if the exponent is less than -999 (it
returns TRUE in that case). If the float pointed to by ptr is transfinite (see is_float_transfinite) or its exponent is
greater than +999, *ptr is set to NAN and FALSE is returned. Else, TRUE is returned.</P>
<HR>
<H3><A NAME="cln"><U>cln</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> cln (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex natural logarithm (base <B>e</B>).</B></P>
<P>cln calculates the natural logarithm w = ln(z) of the complex
number which real and imaginary parts are <I>z_re</I> and
<I>z_im</I>, and stores real and imaginary part of the result
in floating point destinations pointed to by <I>w_re</I> and
<I>w_im</I>. The complex logarithm is defined by
<BR><BR>
ln(z) = log(abs(z)) + <I>i</I> arg(z)
<BR><BR>
where abs(z) = sqrt(z_re^2+z_im^2), arg(z) = atan2(z_im, z_re)
and <A HREF="#log">log</A> is the real natural logarithm. See
also <A HREF="#sqrt">sqrt</A> and <A HREF="#atan2">atan2</A>.</P>
<HR>
<H3><A NAME="clog10"><U>clog10</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> clog10 (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex logarithm, base 10.</B></P>
<P>clog10 calculates the base 10 logarithm w = log10(z) of the complex
number which real and imaginary parts are <I>z_re</I> and
<I>z_im</I>, and stores real and imaginary part of the result
in floating point destinations pointed to by <I>w_re</I> and
<I>w_im</I>. The base 10 complex logarithm is defined by
<BR><BR>
log10(z) = ln(z) / ln(10)
<BR><BR>
where <B>ln</B> is complex natural logarithm
(see <A HREF="#cln">cln</A>).</P>
<HR>
<H3><A NAME="cos"><U>cos</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> cos (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point cosine.</B></P>
<P>cos returns the cosine of floating point argument <I>x</I>, which is assumed
to be specified in radians.
<BR><BR>
<B>Note:</B> cos will return <A HREF="#NAN">NAN</A> if the argument is so big that
reducing to the main period can't be performed without complete losing of
significant digits (i.e. when the magnitude of <I>x</I> is greater than 1e13).</P>
<HR>
<H3><A NAME="cosh"><U>cosh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> cosh (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point hyperbolic cosine.</B></P>
<P>sinh returns the hyperbolic cosine of floating point argument <I>x</I>.
Hyperbolic cosine is defined as (exp(x)+exp(-x))/2.
<BR><BR>
<B>Note:</B> cosh will return <A HREF="#POSITIVE_INF">POSITIVE_INF</A>
in a case of overflow.</P>
<HR>
<H3><A NAME="csin"><U>csin</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> csin (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex sine.</B></P>
<P>csin calculates the sine w = sin(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex sine is defined by
<BR><BR>
sin(z) = (exp(<I>i</I> z) - exp(-<I>i</I> z)) / (2 <I>i</I>)
<BR><BR>
where <B>exp</B> is complex exponential function
(see <A HREF="#cexp">cexp</A>).</P>
<HR>
<H3><A NAME="csinh"><U>csinh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> csinh (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex hyperbolic sine.</B></P>
<P>csinh calculates the hyperbolic sine w = sinh(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex hyperbolic sine is defined by
<BR><BR>
sinh(z) = (exp(z) - exp(-z)) / 2
<BR><BR>
where <B>exp</B> is complex exponential function
(see <A HREF="#cexp">cexp</A>).</P>
<HR>
<H3><A NAME="csqrt"><U>csqrt</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> csqrt (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex square root.</B></P>
<P>csqrt calculates the square root w = sqrt(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex square root is defined by
<BR><BR>
sqrt(z) = sqrt(abs(z)) (cos(arg(z)/2) + <I>i</I> sin(arg(z)/2))
<BR><BR>
where abs(z) = sqrt(z_re^2+z_im^2) and arg(z) = atan2(z_im, z_re).
See <A HREF="#sqrt">sqrt</A>, <A HREF="#atan2">atan2</A>,
<A HREF="#sin">sin</A> and <A HREF="#cos">cos</A>.</P>
<HR>
<H3><A NAME="ctan"><U>ctan</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> ctan (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex tangent.</B></P>
<P>ctan calculates the tangent w = tan(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex tangent is defined by
<BR><BR>
tan(z) = sin(z) / cos(z)
<BR><BR>
where <B>sin</B> and <B>cos</B> are complex sine and
complex cosine (see <A HREF="#csin">csin</A> and <A HREF="#ccos">ccos</A>).</P>
<HR>
<H3><A NAME="ctanh"><U>ctanh</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> ctanh (<B><A HREF="keywords.html#float">float</A></B> z_re, <B><A HREF="keywords.html#float">float</A></B> z_im, <B><A HREF="keywords.html#float">float</A></B> *w_re, <B><A HREF="keywords.html#float">float</A></B> *w_im);</TD></TR></TABLE></P>
<P><B>Complex hyperbolic tangent.</B></P>
<P>ctanh calculates the hyperbolic tangent w = tanh(z) of the complex number which real and
imaginary parts are <I>z_re</I> and <I>z_im</I>, and stores real and
imaginary part of the result in floating point destinations pointed to by
<I>w_re</I> and <I>w_im</I>. The complex hyperbolic tangent is defined by
<BR><BR>
tanh(z) = sinh(z) / cosh(z)
<BR><BR>
where <B>sinh</B> and <B>cosh</B> are complex hyperbolic
sine and complex hyperbolic cosine (see <A HREF="#csinh">csinh</A> and
<A HREF="#ccosh">ccosh</A>).</P>
<HR>
<H3><A NAME="exp"><U>exp</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> exp (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point exponential function.</B></P>
<P>exp returns the exponential function of floating point argument <I>x</I>
(i.e. calculates <B>e</B> to the <I>x</I>-th power).
<BR><BR>
<B>Note:</B> exp will return <A HREF="#POSITIVE_INF">POSITIVE_INF</A> in a case of overflow, and
zero (unsigned, see <A HREF="#ZERO">ZERO</A>; strange, I expected
<A HREF="#POSITIVE_ZERO">POSITIVE_ZERO</A>) in a case of underflow.</P>
<HR>
<H3><A NAME="fabs"><U>fabs</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> fabs (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Absolute value of a floating point number.</B></P>
<P>fabs returns the absolute value of floating point argument <I>x</I>.</P>
<P>See also: <A HREF="stdlib.html#abs">abs</A>, <A HREF="stdlib.html#labs">labs</A></P>
<HR>
<H3><A NAME="fadd"><U>fadd</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> fadd (<B><A HREF="keywords.html#float">float</A></B> x, <B><A HREF="keywords.html#float">float</A></B> y);</TD></TR></TABLE></P>
<P><B>Floating point addition.</B></P>
<P>fadd returns the sum of floating point arguments <I>x</I> and <I>y</I>.
This routine performs the same operation as the C <CODE>'+'</CODE> operator applied to floating
point operands, but it is kept here for backwards compatibility.
At the fundamental level, fadd is exactly the same routine as
<A HREF="#bcdadd">bcdadd</A>.</P>
<HR>
<H3><A NAME="fcmp"><U>fcmp</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">long</A></B> fcmp (<B><A HREF="keywords.html#float">float</A></B> x, <B><A HREF="keywords.html#float">float</A></B> y);</TD></TR></TABLE></P>
<P><B>Floating point comparation.</B></P>
<P>fcmp compares floating point arguments <I>x</I> and <I>y</I>, and returns a
value which is</P>
<UL>
<LI><P>< 0 if <I>x</I> is less than <I>y</I></P></LI>
<LI><P>== 0 if <I>x</I> is the same as <I>y</I></P></LI>
<LI><P>> 0 if <I>x</I> is greater than <I>y</I></P></LI>
</UL>
<P>This function may be useful as a comparison function for <A HREF="stdlib.html#qsort">qsort</A>
function from <A HREF="stdlib.html">stdlib.html</A>. All relation operators applied to
floating point types are implemented through implicite calls of this function.
At the fundamental level, fcmp is exactly the same routine as
<A HREF="#bcdcmp">bcdcmp</A>.
<BR><BR>
<B>Note:</B> All kind of zeros are equal from the aspect of comparation. Transfinite values
are incomparable, and the result of fcmp is unpredictable (usually 1, but this is not
guarantee) if any argument is transfinite. See <A HREF="#ZERO">ZERO</A>,
<A HREF="#UNSIGNED_ZERO">UNSIGNED_ZERO</A>, <A HREF="#POSITIVE_ZERO">POSITIVE_ZERO</A>,
<A HREF="#NEGATIVE_ZERO">NEGATIVE_ZERO</A>, <A HREF="#UNSIGNED_INF">UNSIGNED_INF</A>,
<A HREF="#POSITIVE_INF">POSITIVE_INF</A>, <A HREF="#NEGATIVE_INF">NEGATIVE_INF</A>
and <A HREF="#NAN">NAN</A> for more details.</P>
<HR>
<H3><A NAME="fdiv"><U>fdiv</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> fdiv (<B><A HREF="keywords.html#float">float</A></B> x, <B><A HREF="keywords.html#float">float</A></B> y);</TD></TR></TABLE></P>
<P><B>Floating point division.</B></P>
<P>fdiv returns the quotient of floating point arguments <I>x</I> and <I>y</I>.
This routine performs the same operation as the C <CODE>'/'</CODE> operator applied to floating
point operands, but it is kept here for backwards compatibility.
At the fundamental level, fdiv is exactly the same routine as
<A HREF="#bcddiv">bcddiv</A>.
<BR><BR>
<B>Note:</B> fdiv returns infinite result
if the argument is zero (signed or unsigned), or in a case of overflow.
Also, it returns <A HREF="#NAN">NAN</A> if both arguments are zeros
or infinities.
See <A HREF="#ZERO">ZERO</A>, <A HREF="#UNSIGNED_ZERO">UNSIGNED_ZERO</A>,
<A HREF="#POSITIVE_ZERO">POSITIVE_ZERO</A>, <A HREF="#NEGATIVE_ZERO">NEGATIVE_ZERO</A>,
<A HREF="#UNSIGNED_INF">UNSIGNED_INF</A>, <A HREF="#POSITIVE_INF">POSITIVE_INF</A> and
<A HREF="#NEGATIVE_INF">NEGATIVE_INF</A> for more details.</P>
<HR>
<H3><A NAME="M_FEXP_NEG"><U>FEXP_NEG</U></A></H3>
<P><B>A deprecated macro used to define floating point numbers.</B></P>
<P>FEXP_NEG (also deprecated) works exactly like
<A HREF="#M_FEXP">FEXP</A>, except it constructs negative values
instead of positive ones.</P>
<HR>
<H3><A NAME="M_FEXP"><U>FEXP</U></A></H3>
<P><B>A deprecated macro used to define floating point numbers.</B></P>
<P>Yet one deprecated macro. <CODE>FEXP(<I>m</I>,<I>e</I>)</CODE> constructs
a number <CODE><I>m</I>*10^<I>e</I></CODE> where <I>m</I> is a sequence
of digits (without decimal point) which is assumed to represent decimal number
<I>m.mmmm...</I>, e.g. <CODE>FEXP(2514,5)</CODE> represents number
<CODE>2.514*10^5</CODE> (<CODE>251400</CODE> or <CODE>2.514e5</CODE> using
conventional exponential notation), and <CODE>FEXP(42,-3)</CODE> represents
number <CODE>4.2*10^-3</CODE> (<CODE>0.0042</CODE> or <CODE>4.2e-3</CODE>).
<CODE>FEXP(1,3)</CODE> is <CODE>1*10^3</CODE> (<CODE>1000</CODE> or <CODE>1e3</CODE>).
<I>mantissa</I> must be the constant sequence of digits, without leading zeros,
but the way on which <CODE>FEXP</CODE> is implemented allows that
<I>exponent</I> may be a variable or an expression, like
<CODE>FEXP(314,a)</CODE>, when even <I>mantissa</I> is not a constant, you
can use function <A HREF="#ldexp10">ldexp10</A>. Anyway, you don't need to
use <CODE>FEXP</CODE> any more: simply use conventional exponential notation.
E.g. simply use <CODE>4.2e3</CODE> instead of <CODE>FEXP(42,3)</CODE> etc.
<BR><BR>
Note that <CODE>a = FEXP(<I>m</I>,<I>e</I>)</CODE> is not the same as
<CODE>bcd_var(a).exponent = <I>e</I>+0x4000</CODE>
and <CODE>bcd_var(a).mantissa = <I>m</I></CODE>. The first part is
true; the second is not. More precise, <CODE>FEXP</CODE> shifts <I>m</I> to
the left enough number of times to produce correct normalized mantissa (see
<A HREF="#bcd">bcd</A> for more info).
So, when you type <CODE>a = FEXP(352,3)</CODE> it works like
<CODE>bcd_var(a).exponent = 0x4003</CODE>
and <CODE>bcd_var(a).mantissa = 0x3520000000000000</CODE>.
For more description about internal format of
floating point numbers, see <A HREF="#bcd">bcd</A>.</P>
<P>See also: <A HREF="#float_to_bcd">float_to_bcd</A>, <A HREF="#bcd_to_float">bcd_to_float</A>, <A HREF="#bcd_var">bcd_var</A></P>
<HR>
<H3><A NAME="float_class"><U>float_class</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> float_class (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Determines the class of the floating point number.</B></P>
<P>float_class checks the floating point argument <I>x</I> and returns an integer
result which determines the subtype of the argument, in according to the
following table:
<BR><BR>
<TABLE BORDER CELLPADDING="3">
<TR><TD>1</TD><TD>Not_a_Number (<A HREF="#NAN">NAN</A>)</TD></TR>
<TR><TD>2</TD><TD>Negative infinity (<A HREF="#NEGATIVE_INF">NEGATIVE_INF</A>)</TD></TR>
<TR><TD>3</TD><TD>Negative real number</TD></TR>
<TR><TD>5</TD><TD>Negative zero (<A HREF="#NEGATIVE_ZERO">NEGATIVE_ZERO</A>)</TD></TR>
<TR><TD>6</TD><TD>Unsigned zero (<A HREF="#ZERO">ZERO</A>)</TD></TR>
<TR><TD>7</TD><TD>Positive zero (<A HREF="#POSITIVE_ZERO">POSITIVE_ZERO</A>)</TD></TR>
<TR><TD>9</TD><TD>Positive real number</TD></TR>
<TR><TD>10</TD><TD>Positive infinity (<A HREF="#POSITIVE_INF">POSITIVE_INF</A>)</TD></TR>
<TR><TD>11</TD><TD>Unsigned infinity (<A HREF="#UNSIGNED_INF">UNSIGNED_INF</A>)</TD></TR>
</TABLE>
<BR>
<B>Note:</B> This table was wrong in the documentation of TIGCCLIB release 1.5: negative and
unsigned infinity was swapped due a to typing error.</P>
<HR>
<H3><A NAME="float_to_bcd"><U>float_to_bcd</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><A HREF="#bcd">bcd</A> float_to_bcd (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Converts float to BCD.</B></P>
<P>bcd_to_float converts BCD structure <I>x</I> into an ordinary floating point value.
In fact, this function returns the same value as the argument, but with different interpretation.
This function, in a way, performs typecasting from an ordinary <CODE>float</CODE> type to a
<A HREF="#bcd">bcd</A> type. Beware that returned value is not an lvalue (ordinary C functions
never return lvalues, by the way), so you cannot do something like</P>
<PRE>float a;
...
float_to_bcd(a).exponent = 0x4002;
</PRE>
<P>To perform such assignments, use <A HREF="#bcd_var">bcd_var</A> macro.</P>
<HR>
<H3><A NAME="floor"><U>floor</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> floor (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Rounds down the floating point number.</B></P>
<P>floor finds the largest integer not greater than floating point argument <I>x</I>,
and returns the integer found as a floating point value.</P>
<HR>
<H3><A NAME="M_FLT_NEG"><U>FLT_NEG</U></A></H3>
<P><B>A deprecated macro used to define floating point numbers.</B></P>
<P>FLT_NEG is another deprecated macro which works exactly as
<A HREF="#M_FLT">FLT</A>, except it construct negative values
instead of positive ones. More precise, <CODE>FLT_NEG(x,y)</CODE> will simply be
translated to <CODE>-x.y</CODE> and <CODE>FLT_NEG(x)</CODE> will be translated to
<CODE>-x.0</CODE>. Anyway, you don't need to use the <CODE>FLT_NEG</CODE> macro any
more.</P>
<HR>
<H3><A NAME="flt"><U>flt</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> flt (<B><A HREF="keywords.html#short">long</A></B> x);</TD></TR></TABLE></P>
<P><B>Converts integer to floating point.</B></P>
<P>flt converts the (long) integer argument <I>x</I> to the floating point representation
of the same value. This routine performs the same operation as casting a long integer
value to float type using the <CODE>'(float)'</CODE> typecast operator,
but it is kept here for backwards compatibility.
This function is automatically called when any floating point function is called with
a long integer argument, to force a promotion of an integer to a floating
point type. In other words, integer values will be automatically promoted to the floating
point type when necessary. So, you can do assignment like <I>b</I> = <I>a</I>;
when <I>a</I> is an integer variable (or expression) and <I>b</I> is a standard floating
point variable (<B>float</B> or <B>double</B>). Also, you can calculate
sin(<I>a</I>) where <I>a</I> is an integer. In both cases, flt will be called automatically
to perform the promotion. At the fundamental level, flt is exactly the same routine as
<A HREF="#bcdbcd">bcdbcd</A>.</P>
<HR>
<H3><A NAME="M_FLT"><U>FLT</U></A></H3>
<P><B>A deprecated macro used to define floating point numbers.</B></P>
<P>FLT is a now deprecated macro which is kept here only to retain compatibility
with programs which are written with older releases of TIGCC (before 0.9),
which didn't support standard floating point numbers. Now,
<CODE>FLT(x,y)</CODE> will simply be translated to <CODE>x.y</CODE> and
<CODE>FLT(x)</CODE> will be translated to <CODE>x.0</CODE>, e.g.
<CODE>FLT(342,15)</CODE> will be translated to <CODE>342.15</CODE>,
<CODE>FLT(0,0001)</CODE> will be translated to <CODE>0.0001</CODE>, and
<CODE>FLT(4)</CODE> will be translated to <CODE>4.0</CODE>. Anyway, you don't
need to use the <CODE>FLT</CODE> macro any more.</P>
<HR>
<H3><A NAME="fmod"><U>fmod</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> fmod (<B><A HREF="keywords.html#float">float</A></B> x, <B><A HREF="keywords.html#float">float</A></B> y);</TD></TR></TABLE></P>
<P><B>Calculates x modulo y, i.e. the remainder of x/y.</B></P>
<P>fmod returns <I>x</I> modulo <I>y</I>, i.e. it returns the remainder f, where
<I>x</I> = a * <I>y</I> + f for some integer a
and 0 <= f < <I>y</I>. Where <I>y</I> = 0, fmod returns 0.</P>
<HR>
<H3><A NAME="fmul"><U>fmul</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> fmul (<B><A HREF="keywords.html#float">float</A></B> x, <B><A HREF="keywords.html#float">float</A></B> y);</TD></TR></TABLE></P>
<P><B>Floating point multiplication.</B></P>
<P>fmul returns the product of floating point arguments <I>x</I> and <I>y</I>.
This routine performs the same operation as the C <CODE>'*'</CODE> operator applied to floating
point operands, but it is kept here for backwards compatibility.
At the fundamental level, fmul is exactly the same routine as
<A HREF="#bcdmul">bcdmul</A>.
<BR><BR>
<B>Note:</B> fmul returns infinite result
in a case of overflow. See <A HREF="#UNSIGNED_INF">UNSIGNED_INF</A>,
<A HREF="#POSITIVE_INF">POSITIVE_INF</A> and <A HREF="#NEGATIVE_INF">NEGATIVE_INF</A> for
more details.</P>
<HR>
<H3><A NAME="fneg"><U>fneg</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> fneg (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Floating point negation.</B></P>
<P>fneg returns negated value of floating point argument <I>x</I>.
This routine performs the same operation as the C <CODE>'-'</CODE> unary minus operator applied
to a floating point operand, but it is kept here for backwards compatibility.
At the fundamental level, fneg is exactly the same routine as
<A HREF="#bcdneg">bcdneg</A>.</P>
<HR>
<H3><A NAME="fpisanint"><U>fpisanint</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> fpisanint (<B><A HREF="keywords.html#short">unsigned</A></B> <B><A HREF="keywords.html#short">long</A></B> <B><A HREF="keywords.html#short">long</A></B> *mantissa, <B><A HREF="keywords.html#short">unsigned</A></B> <B><A HREF="keywords.html#short">short</A></B> exponent);</TD></TR></TABLE></P>
<P><B>Checks whether the floating point number is reducable to an integer.</B></P>
<P>fpisanint is an internal TIOS subroutine used in <A HREF="#pow">pow</A>.
It checks whether the floating point with the exponent <I>exponent</I>
and the mantissa pointed to by <I>mantissa</I> is reducable to an integer.
Returns <A HREF="alloc.html#Bool">TRUE</A> or <A HREF="alloc.html#Bool">FALSE</A>, depending
on the test.
<BR><BR>
<B>Note:</B> <B>long long</B> is not a typing error: it is a
<A HREF="gnuexts.html">GNU C extension</A> for representing very long integers (8-byte integers in this implementation).</P>
<HR>
<H3><A NAME="fpisodd"><U>fpisodd</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> fpisodd (<B><A HREF="keywords.html#const">const</A></B> <B><A HREF="keywords.html#short">unsigned</A></B> <B><A HREF="keywords.html#short">long</A></B> <B><A HREF="keywords.html#short">long</A></B> *mantissa, <B><A HREF="keywords.html#short">unsigned</A></B> <B><A HREF="keywords.html#short">short</A></B> exponent);</TD></TR></TABLE></P>
<P><B>Checks whether the integer part of a floating point number is an odd number.</B></P>
<P>fpisodd is an internal TIOS subroutine used in <A HREF="#pow">pow</A>.
It checks whether the integer part of the floating point with the
exponent <I>exponent</I> and the mantissa pointed to by <I>mantissa</I> is
an odd number. Returns <A HREF="alloc.html#Bool">TRUE</A> or <A HREF="alloc.html#Bool">FALSE</A>,
depending on the test. Also returns <A HREF="alloc.html#Bool">TRUE</A> if the integer
part is zero, although zero is not an odd number.
<BR><BR>
<B>Note:</B> <B>long long</B> is not a typing error: it is a
<A HREF="gnuexts.html">GNU C extension</A> for representing very long integers (8-byte integers in this implementation).</P>
<HR>
<H3><A NAME="frexp10"><U>frexp10</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> frexp10 (<B><A HREF="keywords.html#float">float</A></B> x, <B><A HREF="keywords.html#short">short</A></B> *exponent);</TD></TR></TABLE></P>
<P><B>Splits floating point number into mantissa and exponent.</B></P>
<P>frexp10 calculates the mantissa m (a floating point greater than or
equal to 0.1 and less than 1) and the integer value n, such that <I>x</I>
equals m*10^n. frexp stores n in the integer that <I>exponent</I>
points to, and returns the mantissa m.
<BR><BR>
<B>Note:</B> This routine is analogous to <CODE>frexp</CODE> in ANSI C math library, except
using base ten rather than base two.</P>
<HR>
<H3><A NAME="fsub"><U>fsub</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> fsub (<B><A HREF="keywords.html#float">float</A></B> x, <B><A HREF="keywords.html#float">float</A></B> y);</TD></TR></TABLE></P>
<P><B>Floating point substraction.</B></P>
<P>fsub returns the difference of floating point arguments <I>x</I> and <I>y</I>.
This routine performs the same operation as the C <CODE>'-'</CODE> operator applied to floating
point operands, but it is kept here for backwards compatibility.
At the fundamental level, fsub is exactly the same routine as
<A HREF="#bcdsub">bcdsub</A>.</P>
<HR>
<H3><A NAME="hypot"><U>hypot</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#float">float</A></B> hypot (<B><A HREF="keywords.html#float">float</A></B> x, <B><A HREF="keywords.html#float">float</A></B> y);</TD></TR></TABLE></P>
<P><B>Calculates hypotenuse of right triangle.</B></P>
<P>hypot returns the value z where z^2 = <I>x</I>^2 + <I>y</I>^2 and
z >= 0. This is equivalent to the length of the hypotenuse of a right
triangle, if the lengths of the two sides are <I>x</I> and <I>y</I>. Or, this
is also equivalent to the absolute value of the complex number
<I>x</I> + <I>y</I> <I>i</I>.
<BR><BR>
<B>Note:</B> hypot is implemented as macro which calls <A HREF="#fmul">fmul</A> (for squaring
<I>x</I> and <I>y</I>), <A HREF="#fadd">fadd</A> and <A HREF="#sqrt">sqrt</A>.</P>
<HR>
<H3><A NAME="init_float"><U>init_float</U></A></H3>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#void">void</A></B> init_float (<B><A HREF="keywords.html#void">void</A></B>);</TD></TR></TABLE></P>
<P><B>Initializes the floating point emulator.</B></P>
<P>init_float initializes the TIOS floating point emulator. However, as far as I know,
you need not to call this function explicitely anywhere in your program, because TIOS
does it in the boot code. As this function is removed from AMS 2.xx, it is redefined
in this release of TIGCCLIB to do nothing (it is kept in this header file only for
compatibility with previous releases).
<BR><BR>
<B>Note:</B> TIOS fp emulator is, in fact, located in TIOS routine called <B>_bcd_math</B>.
This routine performs a set of arithmetic operations on binary coded decimal floating
point values. A two-byte emulator opcode word is needed after the call to <B>_bcd_math</B>
to instruct the emulator which operation will be performed, where are its operands, etc.
Operands may be in MC68000 registers, in the memory, or in "floating point registers"
(they are, in fact, memory locations on the stack frame from the aspect of the emulator).
If the "instruction" has immediate operand, there will be more than one extra inline word
after the call to <B>_bcd_math</B>.
Anyway, function <B>_bcd_math</B> is unusable in C programs (except
in <B>asm</B> statements), due to non-C calling convention. Fortunately, nearly
all operations supported by <B>_bcd_math</B> have also a built-in interface
in TIOS which is adapted to C calling convention.
That's why I completely bypassed <B>_bcd_math</B> function in this header
file. It may give additional flexibility for ASM programmers (sometimes the argument may be in
the register, sometimes in the memory, etc.). But in C, the arguments are always on the stack,
so this flexibility is not necessary.</P>
<HR>
<H3><A NAME="is_float_infinity"><U>is_float_infinity</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_float_infinity (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is an infinite number.</B></P>
<P>is_float_infinity is original TIOS name for the function which is aliased here as
<A HREF="#is_inf">is_inf</A>.</P>
<HR>
<H3><A NAME="is_float_negative_zero"><U>is_float_negative_zero</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_float_negative_zero (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is negative zero.</B></P>
<P>is_float_negative_zero is original TIOS name for the function which is aliased here as
<A HREF="#is_nzero">is_nzero</A>.</P>
<HR>
<H3><A NAME="is_float_positive_zero"><U>is_float_positive_zero</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_float_positive_zero (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is positive zero.</B></P>
<P>is_float_positive_zero is original TIOS name for the function which is aliased here as
<A HREF="#is_pzero">is_pzero</A>.</P>
<HR>
<H3><A NAME="is_float_signed_infinity"><U>is_float_signed_infinity</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_float_signed_infinity (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is signed infinity.</B></P>
<P>is_float_signed_infinity is original TIOS name for the function which is aliased here as
<A HREF="#is_sinf">is_sinf</A>.</P>
<HR>
<H3><A NAME="is_float_transfinite"><U>is_float_transfinite</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_float_transfinite (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is a transfinite number.</B></P>
<P>is_float_transfinite is original TIOS name for the function which is aliased here as
<A HREF="#is_transfinite">is_transfinite</A>.</P>
<HR>
<H3><A NAME="is_float_unsigned_inf_or_nan"><U>is_float_unsigned_inf_or_nan</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_float_unsigned_inf_or_nan (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is unsigned infinity or Not_a_Number.</B></P>
<P>is_float_unsigned_inf_or_nan is original TIOS name for the function which is aliased here as
<A HREF="#is_uinf_or_nan">is_uinf_or_nan</A>.</P>
<HR>
<H3><A NAME="is_float_unsigned_zero"><U>is_float_unsigned_zero</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_float_unsigned_zero (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is unsigned zero.</B></P>
<P>is_float_unsigned_zero is original TIOS name for the function which is aliased here as
<A HREF="#is_uzero">is_uzero</A>.</P>
<HR>
<H3><A NAME="is_inf"><U>is_inf</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_inf (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is an infinite number.</B></P>
<P>is_inf returns <A HREF="alloc.html#Bool">TRUE</A> if <I>x</I> is an infinite number
(i.e. <A HREF="#UNSIGNED_INF">UNSIGNED_INF</A>, <A HREF="#POSITIVE_INF">POSITIVE_INF</A>
or <A HREF="#NEGATIVE_INF">NEGATIVE_INF</A>), else returns <A HREF="alloc.html#Bool">FALSE</A>.
Infinite values are produced when the result is unbounded (for example dividing by
zero), or in case of overflow. This function is an alias for TIOS function
originally called <A HREF="#is_float_infinity">is_float_infinity</A>.</P>
<HR>
<H3><A NAME="is_nan"><U>is_nan</U></A></H3>
<P><A HREF="httigcc.html#minams">AMS 1.01 or higher</A></P>
<P><TABLE BORDER="1" CELLPADDING="2"><TR><TD CLASS="CODE"><B><A HREF="keywords.html#short">short</A></B> is_nan (<B><A HREF="keywords.html#float">float</A></B> x);</TD></TR></TABLE></P>
<P><B>Checks whether the argument is Not_a_Number.</B></P>
<P>is_nan returns <A HREF="alloc.html#Bool">TRUE</A> if <I>x</I> is <A HREF="#NAN">NAN</A>
(Not_a_Number), else returns <A HREF="alloc.html#Bool">FALSE</A>. Not_a_Number is a special
value which is produced as a result of all operations when the result is undefined
or non-real, for example dividing zero with zero, calculating the logarithm of
a negative number, etc.</P>
<HR>
<H3><A NAME="is_nzero"><U>is_nzero</U></A></H3>