forked from adtools/clib2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_math_functions.c
3016 lines (2729 loc) · 114 KB
/
test_math_functions.c
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
// Checks the mathlib support functions
// Most of the nan/inf conditions are taken from https://pubs.opengroup.org/onlinepubs/9699919799/
// Others from https://gcc.gnu.org/onlinedocs/gccint/Soft-float-library-routines.html
#include <stdio.h>
#include <stdio_headers.h>
#include <exec/types.h>
#include <proto/exec.h>
#include "math_headers.h"
#include "complex_headers.h"
#include "complex.h"
#define TEST_STRING_1 "In the beginning "
#define TEST_STRING_2 "God created the heaven and the Earth."
#define TEST_STRING_1_2 "In the beginning God created the heaven and the Earth."
#define LOVE_STRING "JOB loves Amiga"
#define RAM_TEST_FILE "RAM:test_file"
#define BUFFER_SIZE 256
#define NBR1 12
#define NBR2 24
#define OPTION_TRACE_MATH 0
extern struct ExecBase *SysBase;
extern struct DosLibrary *DOSBase;
extern struct Library *MathIeeeDoubBasBase;
extern double __adddf3(double a,double b);
extern float __addsf3(float a,float b);
extern double __divdf3(double a,double b);
extern float __divsf3(float a,float b);
extern LONG __eqdf2(double a,double b);
extern LONG __eqsf2(float a,float b);
extern double __extendsfdf2(float a);
extern LONG __fixdfsi(double a);
extern signed long __fixsfsi(float a);
extern unsigned long __fixunsdfsi(double a);
extern unsigned long __fixunssfsi(float a);
extern double __floatsidf(LONG a);
extern float __floatsisf(signed long x);
extern LONG __gedf2(double a,double b);
extern LONG __gesf2(float a,float b);
extern LONG __gtdf2(double a,double b);
extern LONG __gtsf2(float a,float b);
extern LONG __ledf2(double a,double b);
extern LONG __lesf2(float a,float b);
extern LONG __ltdf2(double a,double b);
extern LONG __ltsf2(float a,float b);
extern double __muldf3(double a,double b);
extern float __mulsf3(float a,float b);
extern LONG __nedf2(double a,double b);
extern LONG __nesf2(float a,float b);
extern double __negdf2(double a);
extern float __negsf2(float a);
extern double __subdf3(double a,double b);
extern float __subsf3(float a,float b);
extern float __truncdfsf2(double a);
extern ULONG __udivsi3(ULONG dividend,ULONG divisor);
extern LONG __divsi3(LONG dividend,LONG divisor);
extern LONG __mulsi3(LONG Arg1,LONG Arg2);
extern float __floatunsisf(ULONG a);
extern double __floatunsidf(ULONG a);
extern LONG __ashldi3(LONG a,ULONG b);
extern ULONG __lshrdi3(ULONG a,ULONG b);
extern LONG __divdi3(LONG dividend,LONG divisor);
extern LONG __moddi3(LONG dividend,LONG divisor);
extern LONG __muldi3(LONG Arg1,LONG Arg2);
extern LONG __clzsi2(ULONG x);
extern LONG __ctzsi2(ULONG x);
static const char *hexStrTable[256] = {
"00","01","02","03","04","05","06","07","08","09","0A","0B","0C","0D","0E","0F",
"10","11","12","13","14","15","16","17","18","19","1A","1B","1C","1D","1E","1F",
"20","21","22","23","24","25","26","27","28","29","2A","2B","2C","2D","2E","2F",
"30","31","32","33","34","35","36","37","38","39","3A","3B","3C","3D","3E","3F",
"40","41","42","43","44","45","46","47","48","49","4A","4B","4C","4D","4E","4F",
"50","51","52","53","54","55","56","57","58","59","5A","5B","5C","5D","5E","5F",
"60","61","62","63","64","65","66","67","68","69","6A","6B","6C","6D","6E","6F",
"70","71","72","73","74","75","76","77","78","79","7A","7B","7C","7D","7E","7F",
"80","81","82","83","84","85","86","87","88","89","8A","8B","8C","8D","8E","8F",
"90","91","92","93","94","95","96","97","98","99","9A","9B","9C","9D","9E","9F",
"A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","AA","AB","AC","AD","AE","AF",
"B0","B1","B2","B3","B4","B5","B6","B7","B8","B9","BA","BB","BC","BD","BE","BF",
"C0","C1","C2","C3","C4","C5","C6","C7","C8","C9","CA","CB","CC","CD","CE","CF",
"D0","D1","D2","D3","D4","D5","D6","D7","D8","D9","DA","DB","DC","DD","DE","DF",
"E0","E1","E2","E3","E4","E5","E6","E7","E8","E9","EA","EB","EC","ED","EE","EF",
"F0","F1","F2","F3","F4","F5","F6","F7","F8","F9","FA","FB","FC","FD","FE","FF",
};
static char buffer1[BUFFER_SIZE],buffer2[BUFFER_SIZE],test_strings[BUFFER_SIZE];
static FILE *file_ptr;
// To test vasprintf
__attribute__((noinline)) int math_vasprintf_test(char **ret, const char *format, ...)
{
int result = EOF;
va_list arg;
va_start(arg,format);
result = vasprintf(ret,format,arg);
va_end(arg);
return(result);
}
// To test vfprintf
__attribute__((noinline)) int math_vfprintf_test(FILE *file_ptr,const char *format, ...)
{
int result = EOF;
va_list arg;
va_start(arg,format);
result = vfprintf(file_ptr,format,arg);
va_end(arg);
return(result);
}
// To test vscanf
__attribute__((noinline)) int math_vscanf_test(char *format, ...)
{
int result = EOF;
va_list arg;
va_start(arg,format);
result = vscanf(format,arg);
va_end(arg);
return(result);
}
// To test vfscanf
__attribute__((noinline)) int math_vfscanf_test(FILE *file_ptr,const char *format, ...)
{
int result = EOF;
va_list arg;
va_start(arg,format);
result = vfscanf(file_ptr,format,arg);
va_end(arg);
return(result);
}
// To test vprintf
__attribute__((noinline)) int math_vprintf_test(const char *format, ...)
{
int result = EOF;
va_list arg;
va_start(arg,format);
result = vprintf(format,arg);
va_end(arg);
return(result);
}
// To test vsnprintf
__attribute__((noinline)) int math_vsnprintf_test(char *s,size_t n,char *format, ...)
{
int result = EOF;
va_list arg;
va_start(arg,format);
result = vsnprintf(s,n,format,arg);
va_end(arg);
return(result);
}
// To test vsprintf
__attribute__((noinline)) int math_vsprintf_test(char *s,char *format, ...)
{
int result = EOF;
va_list arg;
va_start(arg,format);
result = vsprintf(s,format,arg);
va_end(arg);
return(result);
}
// To test vsscanf
__attribute__((noinline)) int math_vsscanf_test(char *s,char *format, ...)
{
int result = EOF;
va_list arg;
va_start(arg,format);
result = vsscanf(s,format,arg);
va_end(arg);
return(result);
}
static BOOL fcntDoubleInRange(double x,double y)
{
const double delta = 0.001;
if(fabs(x - y) < delta)
return(TRUE);
return(FALSE);
}
static BOOL fcntFloatInRange(float x,float y)
{
const float delta = 0.001f;
if(fabsf(x - y) < delta)
return(TRUE);
return(FALSE);
}
#if USE_LONG_DOUBLE
static BOOL fcntLongDoubleInRange(long double x,long double y)
{
const long double delta = 0.001;
if(fabsl(x - y) < delta)
return(TRUE);
return(FALSE);
}
#endif
WORD testMathFunctions(void)
{
WORD errCnt = 0;
double vald;
float valf;
// Test creal, cimag, carg, conj
double complex z1 = -3.14+9.69*I;
if(!fcntDoubleInRange(creal(z1),-3.14))
errCnt++;
if(!fcntDoubleInRange(cimag(z1),9.69))
errCnt++;
if(!fcntDoubleInRange(carg(z1),1.8841))
errCnt++;
if(!fcntDoubleInRange(creal(conj(z1)),-3.14))
errCnt++;
if(!fcntDoubleInRange(cimag(conj(z1)),-9.69))
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE1 errCnt = %u\n",errCnt);
#endif
// Test crealf, cimagf, cargf, conjf
float complex z2 = -3.14+9.69*I;
if(!fcntFloatInRange(crealf(z2),-3.14))
errCnt++;
if(!fcntFloatInRange(cimagf(z2),9.69))
errCnt++;
if(!fcntFloatInRange(cargf(z2),1.8841))
errCnt++;
if(!fcntFloatInRange(crealf(conjf(z2)),-3.14))
errCnt++;
if(!fcntFloatInRange(cimagf(conjf(z2)),-9.69))
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE2 errCnt = %u\n",errCnt);
#endif
#if USE_LONG_DOUBLE // long double is not supported
// Test creall, cimagl, cargl, conjl
long double complex z3 = -3.14+9.69*I;
if(!fcntLongDoubleInRange(creall(z3),-3.14))
errCnt++;
if(!fcntLongDoubleInRange(cimagl(z3),9.69))
errCnt++;
if(!fcntLongDoubleInRange(cargl(z3),1.8841))
errCnt++;
if(!fcntLongDoubleInRange(creall(conjl(z3)),-3.14))
errCnt++;
if(!fcntLongDoubleInRange(cimagl(conjl(z3)),-9.69))
errCnt++;
#endif
// Test feclearexcept
if(feclearexcept(FE_ALL_EXCEPT) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE3 errCnt = %u\n",errCnt);
#endif
// Test fegetenv
fenv_t envp;
if(fegetenv(&envp) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE4 errCnt = %u\n",errCnt);
#endif
// Test fegetenv
fexcept_t flagp;
if(fegetexceptflag(&envp,FE_DIVBYZERO) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE5 errCnt = %u\n",errCnt);
#endif
// Test fegetround
if(fegetround() != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE6 errCnt = %u\n",errCnt);
#endif
// Test feholdexcept
if(feholdexcept(&envp) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE7 errCnt = %u\n",errCnt);
#endif
// Test feraiseexcept
if(feraiseexcept(FE_DIVBYZERO) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE8 errCnt = %u\n",errCnt);
#endif
// Test fesetenv
if(fesetenv(&envp) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE9 errCnt = %u\n",errCnt);
#endif
// Test fesetexceptflag
if(fesetexceptflag(&flagp,FE_DIVBYZERO) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE10 errCnt = %u\n",errCnt);
#endif
// Test fetestexcept
if(fetestexcept(FE_DIVBYZERO) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE11 errCnt = %u\n",errCnt);
#endif
// Test fetestround
if(fetestround(FE_DOWNWARD) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE12 errCnt = %u\n",errCnt);
#endif
// Test fetestround
if(feupdateenv(&envp) != 0) // not implemented
errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE13 errCnt = %u\n",errCnt);
#endif
// Test acos, acosf, acosh, acoshf
// For finite values of x not in the range [-1,1], a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
if(!fcntDoubleInRange(acos(0.5),1.04719)) errCnt++;
if(!isnan(acos(nan(NULL)))) errCnt++;
if(!isnan(acos(__inf()))) errCnt++;
if(!isnan(acos(-__inf()))) errCnt++;
if(!isnan(acos(1.5))) errCnt++;
if(!isnan(acos(-1.5))) errCnt++;
// For finite values of x not in the range [-1,1], a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
if(!fcntFloatInRange(acosf(0.5f),1.04719f)) errCnt++;
if(!isnan(acosf(nanf(NULL)))) errCnt++;
if(!isnan(acosf(__inff()))) errCnt++;
if(!isnan(acosf(-__inff()))) errCnt++;
if(!isnan(acosf(1.5))) errCnt++;
if(!isnan(acosf(-1.5))) errCnt++;
// For finite values of x < 1, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If x is NaN, a NaN shall be returned.
// If x is +Inf, +Inf shall be returned
// If x is -Inf, a domain error shall occur, and a NaN shall be returned.
if(!fcntDoubleInRange(acosh(1.256),0.70109)) errCnt++;
if(!isnan(acosh(nan(NULL)))) errCnt++;
vald = acosh(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
if(!isnan(acosh(-__inf()))) errCnt++;
if(!isnan(acosh(0.99))) errCnt++;
if(!isnan(acosh(-0.01))) errCnt++;
// For finite values of x < 1, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If x is NaN, a NaN shall be returned.
// If x is +Inf, +Inf shall be returned
// If x is -Inf, a domain error shall occur, and a NaN shall be returned.
if(!fcntFloatInRange(acoshf(1.256f),0.70109f)) errCnt++;
if(!isnan(acoshf(nanf(NULL)))) errCnt++;
valf = acoshf(__inff());
if(!isinf(valf) || signbit(vald) != 0) errCnt++;
if(!isnan(acoshf(-__inff()))) errCnt++;
if(!isnan(acoshf(0.99f))) errCnt++;
if(!isnan(acoshf(-0.01f))) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE14 errCnt = %u\n",errCnt);
#endif
// Test asin, asin, asinh, asinhf
// For finite values of x not in the range [-1,1], a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
// For finite values of x not in the range [-1,1], a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
if(!fcntDoubleInRange(asin(0.5),0.5235)) errCnt++;
if(!isnan(asin(nan(NULL)))) errCnt++;
if(!isnan(asin(__inf()))) errCnt++;
if(!isnan(asin(-__inf()))) errCnt++;
if(!isnan(asin(1.1))) errCnt++;
if(!isnan(asin(-1.1))) errCnt++;
// For finite values of x not in the range [-1,1], a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
// For finite values of x not in the range [-1,1], a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
if(!fcntFloatInRange(asinf(0.5f),0.5235f)) errCnt++;
if(!isnan(asinf(nanf(NULL)))) errCnt++;
if(!isnan(asinf(__inff()))) errCnt++;
if(!isnan(asinf(-__inff()))) errCnt++;
if(!isnan(asinf(1.1))) errCnt++;
if(!isnan(asinf(-1.1))) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0, or ±Inf, x shall be returned.
if(!fcntDoubleInRange(asinh(1.256),1.0513)) errCnt++;
if(!isnan(asinh(nan(NULL)))) errCnt++;
vald = asinh(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = asinh(-__inf());
if(!isinf(vald) || signbit(vald) == 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0, or ±Inf, x shall be returned.
if(!fcntFloatInRange(asinhf(1.256f),1.0513f)) errCnt++;
if(!isnan(asinhf(nanf(NULL)))) errCnt++;
valf = asinhf(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = asinhf(-__inff());
if(!isinf(valf) || signbit(valf) == 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE15 errCnt = %u\n",errCnt);
#endif
// Test atan, atan, atanh, atanhf
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, ±pi/2 shall be returned.
if(!fcntDoubleInRange(atan(0.5),0.4636)) errCnt++;
if(!isnan(atan(nan(NULL)))) errCnt++;
if(!fcntDoubleInRange(atan(__inf()),M_PI_2)) errCnt++;
if(!fcntDoubleInRange(atan(-__inf()),-M_PI_2)) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, ±pi/2 shall be returned.
if(!fcntFloatInRange(atanf(0.5f),0.4636f)) errCnt++;
if(!isnan(atanf(nanf(NULL)))) errCnt++;
if(!fcntFloatInRange(atanf(__inff()),(float)M_PI_2)) errCnt++;
if(!fcntFloatInRange(atanf(-__inff()),(float)(-M_PI_2))) errCnt++;
// If x is ±1, a pole error shall occur, and atanh(), atanhf(), and atanhl() shall return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively, with the same sign as the correct value of the function.
// For finite |x|>1, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
if(!fcntDoubleInRange(atanh(0.256),0.2618)) errCnt++;
if(!isnan(atanh(nan(NULL)))) errCnt++;
if(!isnan(atanh(__inf()))) errCnt++;
if(!isnan(atanh(-__inf()))) errCnt++;
vald = atanh(1.0f);
if(!isinf(vald) && signbit(vald) != 0) errCnt++;
vald = atanh(-1.0f);
if(!isinf(vald) && signbit(vald) == 0) errCnt++;
// If x is ±1, a pole error shall occur, and atanh(), atanhf(), and atanhl() shall return the value of the macro HUGE_VAL, HUGE_VALF, and HUGE_VALL, respectively, with the same sign as the correct value of the function.
// For finite |x|>1, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
if(!fcntFloatInRange(atanhf(0.256f),0.2618f)) errCnt++;
if(!isnan(atanhf(nanf(NULL)))) errCnt++;
if(!isnan(atanhf(__inff()))) errCnt++;
if(!isnan(atanhf(-__inff()))) errCnt++;
valf = atanhf(1.0f);
if(!isinf(valf) && signbit(valf) != 0) errCnt++;
valf = atanhf(-1.0f);
if(!isinf(valf) && signbit(valf) == 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE16 errCnt = %u\n",errCnt);
#endif
// Test atan2, atan2f
// If either x or y is NaN, a NaN shall be returned.
// If y is ±0 and x is +0, ±0 shall be returned.
// For finite values of ± y > 0, if x is -Inf, ± shall be returned.
// For finite values of ± y > 0, if x is +Inf, ±0 shall be returned.
// For finite values of x, if y is ±Inf, ±/2 shall be returned.
// If y is ±Inf and x is -Inf, ±3/4 shall be returned.
// If y is ±Inf and x is +Inf, ±/4 shall be returned.
if(!fcntDoubleInRange(atan2(1.0,1.0),0.7853)) errCnt++;
if(!fcntDoubleInRange(atan2(-1.0,-1.0),-2.3561)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0,-1.0),3.141593)) errCnt++;
if(!fcntDoubleInRange(atan2(5.0000,6.0000),0.694738)) errCnt++;
if(!fcntDoubleInRange(atan2(6.0000,5.0000),0.876058)) errCnt++;
if(!fcntDoubleInRange(atan2(-5.0000,6.0000),-0.694738)) errCnt++;
if(!fcntDoubleInRange(atan2(6.0000,-5.0000),2.265535)) errCnt++;
if(!fcntDoubleInRange(atan2(-6.0000,5.0000),-0.876058)) errCnt++;
if(!fcntDoubleInRange(atan2(5.0000,-6.0000),2.446854)) errCnt++;
if(!fcntDoubleInRange(atan2(-5.0000,-6.0000),-2.446854)) errCnt++;
if(!fcntDoubleInRange(atan2(-6.0000,-5.0000),-2.265535)) errCnt++;
if(!fcntDoubleInRange(atan2(6.0000,6.0000),0.785398)) errCnt++;
if(!fcntDoubleInRange(atan2(-6.0000,6.0000),-0.785398)) errCnt++;
if(!fcntDoubleInRange(atan2(6.0000,-6.0000),2.356194)) errCnt++;
if(!fcntDoubleInRange(atan2(-6.0000,-6.0000),-2.356194)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0000,0.0000),0.0)) errCnt++;
if(!fcntDoubleInRange(atan2(1.0000,0.0000),1.570796)) errCnt++;
if(!fcntDoubleInRange(atan2(2.0000,0.0000),1.570796)) errCnt++;
if(!fcntDoubleInRange(atan2(3.0000,0.0000),1.570796)) errCnt++;
if(!fcntDoubleInRange(atan2(-1.0000,0.0000),-1.570796)) errCnt++;
if(!fcntDoubleInRange(atan2(-2.0000,0.0000),-1.570796)) errCnt++;
if(!fcntDoubleInRange(atan2(-3.0000,0.0000),-1.570796)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0000,1.0000),0.0)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0000,2.0000),0.0)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0000,3.0000),0.0)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0000,-1.0000),3.141593)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0000,-2.0000),3.141593)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0000,-3.0000),3.141593)) errCnt++;
if(!isnan(atan2(nan(NULL),nan(NULL)))) errCnt++;
if(!isnan(atan2(nan(NULL),3.14159))) errCnt++;
if(!isnan(atan2(3.14159,nan(NULL)))) errCnt++;
if(!fcntDoubleInRange(atan2(__inf(),__inf()),M_PI_4)) errCnt++;
if(!fcntDoubleInRange(atan2(-__inf(),__inf()),-M_PI_4)) errCnt++;
if(!fcntDoubleInRange(atan2(__inf(),-__inf()),3.0*M_PI_4)) errCnt++;
if(!fcntDoubleInRange(atan2(-__inf(),-__inf()),-3.0*M_PI_4)) errCnt++;
if(!fcntDoubleInRange(atan2(1.0,__inf()),0.0)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0,__inf()),0.0)) errCnt++;
if(!fcntDoubleInRange(atan2(-1.0,__inf()),-0.0)) errCnt++;
if(!fcntDoubleInRange(atan2(1.0,-__inf()),M_PI)) errCnt++;
if(!fcntDoubleInRange(atan2(0.0,-__inf()),M_PI)) errCnt++;
if(!fcntDoubleInRange(atan2(-1.0,-__inf()),-M_PI)) errCnt++;
if(!fcntDoubleInRange(atan2(__inf(),1.0),M_PI_2)) errCnt++;
if(!fcntDoubleInRange(atan2(-__inf(),1.0),-M_PI_2)) errCnt++;
// If either x or y is NaN, a NaN shall be returned.
// If y is ±0 and x is +0, ±0 shall be returned.
// For finite values of ± y > 0, if x is -Inf, ± shall be returned.
// For finite values of ± y > 0, if x is +Inf, ±0 shall be returned.
// For finite values of x, if y is ±Inf, ±/2 shall be returned.
// If y is ±Inf and x is -Inf, ±3/4 shall be returned.
// If y is ±Inf and x is +Inf, ±/4 shall be returned.
if(!fcntFloatInRange(atan2f(1.0f,1.0f),0.7853f)) errCnt++;
if(!fcntFloatInRange(atan2f(-1.0f,-1.0f),-2.3561f)) errCnt++;
if(!fcntFloatInRange(atan2f(0.0f,-1.0f),3.141593f)) errCnt++;
if(!fcntFloatInRange(atan2f(5.0000f,6.0000f),0.694738f)) errCnt++;
if(!fcntFloatInRange(atan2f(6.0000f,5.0000f),0.876058f)) errCnt++;
if(!fcntFloatInRange(atan2f(-5.0000f,6.0000f),-0.694738f)) errCnt++;
if(!fcntFloatInRange(atan2f(6.0000f,-5.0000f),2.265535f)) errCnt++;
if(!fcntFloatInRange(atan2f(-6.0000f,5.0000f),-0.876058f)) errCnt++;
if(!fcntFloatInRange(atan2f(5.0000f,-6.0000f),2.446854f)) errCnt++;
if(!fcntFloatInRange(atan2f(-5.0000f,-6.0000f),-2.446854f)) errCnt++;
if(!fcntFloatInRange(atan2f(-6.0000f,-5.0000f),-2.265535f)) errCnt++;
if(!fcntFloatInRange(atan2f(6.0000f,6.0000f),0.785398f)) errCnt++;
if(!fcntFloatInRange(atan2f(-6.0000f,6.0000f),-0.785398f)) errCnt++;
if(!fcntFloatInRange(atan2f(6.0000f,-6.0000f),2.356194f)) errCnt++;
if(!fcntFloatInRange(atan2f(-6.0000f,-6.0000f),-2.356194f)) errCnt++;
if(!fcntFloatInRange(atan2f(0.0000f,0.0000f),0.0f)) errCnt++;
if(!fcntFloatInRange(atan2f(1.0000f,0.0000f),1.570796f)) errCnt++;
if(!fcntFloatInRange(atan2f(2.0000f,0.0000f),1.570796f)) errCnt++;
if(!fcntFloatInRange(atan2f(3.0000f,0.0000f),1.570796f)) errCnt++;
if(!fcntFloatInRange(atan2f(-1.0000f,0.0000f),-1.570796f)) errCnt++;
if(!fcntFloatInRange(atan2f(-2.0000f,0.0000f),-1.570796f)) errCnt++;
if(!fcntFloatInRange(atan2f(-3.0000f,0.0000f),-1.570796f)) errCnt++;
if(!fcntFloatInRange(atan2f(0.0000f,1.0000f),0.0f)) errCnt++;
if(!fcntFloatInRange(atan2f(0.0000f,2.0000f),0.0f)) errCnt++;
if(!fcntFloatInRange(atan2f(0.0000f,3.0000f),0.0f)) errCnt++;
if(!fcntFloatInRange(atan2f(0.0000f,-1.0000f),3.141593f)) errCnt++;
if(!fcntFloatInRange(atan2f(0.0000f,-2.0000f),3.141593f)) errCnt++;
if(!fcntFloatInRange(atan2f(0.0000f,-3.0000f),3.141593f)) errCnt++;
if(!isnan(atan2f(nanf(NULL),nanf(NULL)))) errCnt++;
if(!isnan(atan2f(nanf(NULL),3.14159f))) errCnt++;
if(!isnan(atan2f(3.14159f,nanf(NULL)))) errCnt++;
if(!fcntDoubleInRange(atan2f(__inff(),__inff()),(float)M_PI_4)) errCnt++;
if(!fcntDoubleInRange(atan2f(-__inff(),__inff()),(float)(-M_PI_4))) errCnt++;
if(!fcntDoubleInRange(atan2f(__inff(),-__inff()),(float)(3.0*M_PI_4))) errCnt++;
if(!fcntDoubleInRange(atan2f(-__inff(),-__inff()),(float)(-3.0*M_PI_4))) errCnt++;
if(!fcntDoubleInRange(atan2f(1.0f,__inff()),0.0f)) errCnt++;
if(!fcntDoubleInRange(atan2f(0.0f,__inff()),0.0f)) errCnt++;
if(!fcntDoubleInRange(atan2f(-1.0f,__inff()),-0.0f)) errCnt++;
if(!fcntDoubleInRange(atan2f(1.0f,-__inff()),(float)M_PI)) errCnt++;
if(!fcntDoubleInRange(atan2f(0.0f,-__inff()),(float)M_PI)) errCnt++;
if(!fcntDoubleInRange(atan2f(-1.0f,-__inff()),(float)(-M_PI))) errCnt++;
if(!fcntDoubleInRange(atan2f(__inff(),1.0f),(float)M_PI_2)) errCnt++;
if(!fcntDoubleInRange(atan2f(-__inff(),1.0f),(float)(-M_PI_2))) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE17 errCnt = %u\n",errCnt);
#endif
// Test cbrt, cbrtf
// If x is NaN, a NaN shall be returned.
// If x is ±0 or ±Inf, x shall be returned.
if(!fcntDoubleInRange(cbrt(1969.1969),12.5341)) errCnt++;
if(!isnan(cbrt(nan(NULL)))) errCnt++;
vald = cbrt(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = cbrt(-__inf());
if(!isinf(vald) || signbit(vald) == 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0 or ±Inf, x shall be returned.
if(!fcntFloatInRange(cbrtf(1969.1969f),12.5341f)) errCnt++;
if(!isnan(cbrtf(nanf(NULL)))) errCnt++;
valf = cbrtf(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = cbrtf(-__inff());
if(!isinf(valf) || signbit(valf) == 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE18 errCnt = %u\n",errCnt);
#endif
// Test ceil, ceilf
// If x is NaN, a NaN shall be returned.
// If x is ±0 or ±Inf, x shall be returned.
if(!fcntDoubleInRange(ceil(1971.1971),1972.0)) errCnt++;
if(!isnan(ceil(nan(NULL)))) errCnt++;
vald = ceil(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = ceil(-__inf());
if(!isinf(vald) || signbit(vald) == 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0 or ±Inf, x shall be returned.
if(!fcntFloatInRange(ceilf(1971.1971f),1972.0f)) errCnt++;
if(!isnan(ceilf(nanf(NULL)))) errCnt++;
valf = ceilf(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = ceilf(-__inff());
if(!isinf(valf) || signbit(valf) == 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE19 errCnt = %u\n",errCnt);
#endif
// Test copysign, copysignf
if(!fcntDoubleInRange(copysign(1971.1971,-1969.0),-1971.1971)) errCnt++;
if(!fcntDoubleInRange(copysign(1971.1971,1969.0),1971.1971)) errCnt++;
if(!fcntFloatInRange(copysignf(1971.1971f,-1969.0f),-1971.1971f)) errCnt++;
if(!fcntFloatInRange(copysignf(1971.1971f,1969.0f),1971.1971f)) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE20 errCnt = %u\n",errCnt);
#endif
// Test cos, cosf, cosh, coshf
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
if(!fcntDoubleInRange(cos(0.5),0.8775)) errCnt++;
if(!isnan(cos(nan(NULL)))) errCnt++;
if(!isnan(cos(__inf()))) errCnt++;
if(!isnan(cos(-__inf()))) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, a domain error shall occur, and a NaN shall be returned.
if(!fcntFloatInRange(cosf(0.5f),0.8775f)) errCnt++;
if(!isnan(cosf(nanf(NULL)))) errCnt++;
if(!isnan(cosf(__inff()))) errCnt++;
if(!isnan(cosf(-__inff()))) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, +Inf shall be returned.
if(!fcntDoubleInRange(cosh(1.256),1.8980)) errCnt++;
if(!isnan(cosh(nan(NULL)))) errCnt++;
vald = cosh(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = cosh(-__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, +Inf shall be returned.
if(!fcntFloatInRange(coshf(1.256f),1.8980f)) errCnt++;
if(!isnan(coshf(nanf(NULL)))) errCnt++;
valf = coshf(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = coshf(-__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE21 errCnt = %u\n",errCnt);
#endif
// Test erf, erff, erf, erfcf
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, ±1 shall be returned.
if(!fcntDoubleInRange(erf(0.5),0.5205)) errCnt++;
if(!isnan(erf(nan(NULL)))) errCnt++;
if(erf(__inf()) != 1.0) errCnt++;
if(erf(-__inf()) != -1.0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±Inf, ±1 shall be returned.
if(!fcntFloatInRange(erff(0.5f),0.5205f)) errCnt++;
if(!isnan(erff(nanf(NULL)))) errCnt++;
if(erff(__inff()) != 1.0f) errCnt++;
if(erff(-__inff()) != -1.0f) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0, +1 shall be returned.
// If x is -Inf, +2 shall be returned.
// If x is +Inf, +0 shall be returned.
if(!fcntDoubleInRange(erfc(0.5),0.4795)) errCnt++;
if(!isnan(erfc(nan(NULL)))) errCnt++;
if(erfc(0.0) != 1.0) errCnt++;
if(erfc(-0.0) != 1.0) errCnt++;
vald = erfc(__inf());
if(fpclassify(vald) != FP_ZERO || signbit(vald) != 0) errCnt++;
if(erfc(-__inf()) != 2.0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0, +1 shall be returned.
// If x is -Inf, +2 shall be returned.
// If x is +Inf, +0 shall be returned.
if(!fcntFloatInRange(erfcf(0.5f),0.4795f)) errCnt++;
if(!isnan(erfcf(nanf(NULL)))) errCnt++;
if(erfcf(0.0f) != 1.0f) errCnt++;
if(erfcf(-0.0f) != 1.0f) errCnt++;
valf = erfcf(__inff());
if(fpclassify(valf) != FP_ZERO || signbit(valf) != 0) errCnt++;
if(erfcf(-__inff()) != 2.0f) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE22 errCnt = %u\n",errCnt);
#endif
// Test exp, expf, exp2, exp2f
// If x is NaN, a NaN shall be returned.
// If x is -Inf, +0 shall be returned.
// If x is +Inf, x shall be returned.
if(!fcntDoubleInRange(exp(3.14159),23.1406)) errCnt++;
if(!isnan(exp(nan(NULL)))) errCnt++;
vald = exp(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = exp(-__inf());
if(fpclassify(0.0) != FP_ZERO || signbit(vald) != 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is -Inf, +0 shall be returned.
// If x is +Inf, x shall be returned.
if(!fcntFloatInRange(expf(3.14159f),23.1406f)) errCnt++;
if(!isnan(expf(nanf(NULL)))) errCnt++;
valf = expf(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = expf(-__inff());
if(fpclassify(valf) != FP_ZERO || signbit(valf) != 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0, 1 shall be returned.
// If x is -Inf, +0 shall be returned.
// If x is +Inf, x shall be returned.
if(!fcntDoubleInRange(exp2(3.14159),8.8249)) errCnt++;
if(!isnan(exp2(nan(NULL)))) errCnt++;
vald = exp2(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = exp2(-__inf());
if(fpclassify(vald) != FP_ZERO || signbit(vald) != 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0, 1 shall be returned.
// If x is -Inf, +0 shall be returned.
// If x is +Inf, x shall be returned.
if(!fcntFloatInRange(exp2f(3.14159f),8.8249f)) errCnt++;
if(!isnan(exp2f(nanf(NULL)))) errCnt++;
valf = exp2f(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = exp2f(-__inff());
if(fpclassify(valf) != FP_ZERO || signbit(valf) != 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE23 errCnt = %u\n",errCnt);
#endif
// Test expm1, expm1f
// If x is NaN, a NaN shall be returned.
// If x is ±0, ±0 shall be returned.
// If x is -Inf, -1 shall be returned.
// If x is +Inf, x shall be returned.
if(!fcntDoubleInRange(expm1(3.14159),22.1406)) errCnt++;
if(!isnan(expm1(nan(NULL)))) errCnt++;
vald = expm1(0.0);
if(fpclassify(vald) != FP_ZERO || signbit(vald) != 0) errCnt++;
vald = expm1(-0.0);
if(fpclassify(vald) != FP_ZERO || signbit(vald) == 0) errCnt++;
vald = expm1(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
if(expm1(-__inf()) != -1.0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0, ±0 shall be returned.
// If x is -Inf, -1 shall be returned.
// If x is +Inf, x shall be returned.
if(!fcntFloatInRange(expm1f(3.14159f),22.1406f)) errCnt++;
if(!isnan(expm1f(nanf(NULL)))) errCnt++;
valf = expm1f(0.0f);
if(fpclassify(valf) != FP_ZERO || signbit(valf) != 0) errCnt++;
valf = expm1f(-0.0f);
if(fpclassify(valf) != FP_ZERO || signbit(valf) == 0) errCnt++;
valf = expm1f(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
if(expm1f(-__inff()) != -1.0f) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE24 errCnt = %u\n",errCnt);
#endif
// Test fabs, fabsf
// If x is NaN, a NaN shall be returned.
// If x is ±0, +0 shall be returned.
// If x is ±Inf, +Inf shall be returned.
if(!fcntDoubleInRange(fabs(-3.14159),3.14159)) errCnt++;
if(!fcntDoubleInRange(fabs(3.14159),3.14159)) errCnt++;
if(!isnan(fabs(nan(NULL)))) errCnt++;
vald = fabs(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = fabs(-__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0, +0 shall be returned.
// If x is ±Inf, +Inf shall be returned.
if(!fcntFloatInRange(fabsf(-3.14159f),3.14159f)) errCnt++;
if(!fcntFloatInRange(fabsf(3.14159f),3.14159f)) errCnt++;
if(!isnan(fabsf(nanf(NULL)))) errCnt++;
valf = fabsf(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = fabsf(-__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE25 errCnt = %u\n",errCnt);
#endif
// Test fdim, fdimf
// If x or y is NaN, a NaN shall be returned.
if(!fcntDoubleInRange(fdim(3.6,3.5),0.1)) errCnt++;
if(!fcntDoubleInRange(fdim(3.5,3.6),0.0)) errCnt++;
if(!isnan(fdim(nan(NULL),3.14159))) errCnt++;
if(!isnan(fdim(3.14159,nan(NULL)))) errCnt++;
if(!isnan(fdim(nan(NULL),nan(NULL)))) errCnt++;
// If x or y is NaN, a NaN shall be returned.
if(!fcntFloatInRange(fdimf(3.6f,3.5f),0.1f)) errCnt++;
if(!fcntFloatInRange(fdimf(3.5f,3.6f),0.0f)) errCnt++;
if(!isnan(fdimf(nanf(NULL),3.14159f))) errCnt++;
if(!isnan(fdimf(3.14159f,nanf(NULL)))) errCnt++;
if(!isnan(fdimf(nanf(NULL),nanf(NULL)))) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE26 errCnt = %u\n",errCnt);
#endif
// Test floor, floorf
// If x is NaN, a NaN shall be returned.
// If x is ±0 or ±Inf, x shall be returned.
if(!fcntDoubleInRange(floor(0.5),0.0)) errCnt++;
if(!fcntDoubleInRange(floor(-0.5),-1.0)) errCnt++;
if(!isnan(floor(nan(NULL)))) errCnt++;
vald = floor(__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = floor(-__inf());
if(!isinf(vald) || signbit(vald) == 0) errCnt++;
// If x is NaN, a NaN shall be returned.
// If x is ±0 or ±Inf, x shall be returned.
if(!fcntFloatInRange(floorf(0.5f),0.0f)) errCnt++;
if(!fcntFloatInRange(floorf(-0.5f),-1.0f)) errCnt++;
if(!isnan(floorf(nanf(NULL)))) errCnt++;
valf = floorf(__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = floorf(-__inff());
if(!isinf(valf) || signbit(valf) == 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE27 errCnt = %u\n",errCnt);
#endif
// Test fma, fmaf
// If x or y are NaN, a NaN shall be returned.
// If x multiplied by y is an exact infinity and z is also an infinity but with the opposite sign, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If one of x and y is infinite, the other is zero, and z is not a NaN, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If one of x and y is infinite, the other is zero, and z is a NaN, a NaN shall be returned and a domain error may occur.
// If x* y is not 0*Inf nor Inf*0 and z is a NaN, a NaN shall be returned.
if(!fcntDoubleInRange(fma(-1.1,-2.2,3.3),5.72)) errCnt++;
if(!isnan(fma(nan(NULL),4.2,4.2))) errCnt++;
if(!isnan(fma(1.0,nan(NULL),4.2))) errCnt++;
if(!isnan(fma(1.0,3.14159,nan(NULL)))) errCnt++;
if(!isnan(fma(__inf(),0.0,nan(NULL)))) errCnt++;
if(!isnan(fma(__inf(),__inf(),-__inf()))) errCnt++;
if(!isnan(fma(-__inf(),__inf(),__inf()))) errCnt++;
if(!isnan(fma(__inf(),-__inf(),__inf()))) errCnt++;
if(!isnan(fma(-__inf(),-__inf(),-__inf()))) errCnt++;
if(!isnan(fma(__inf(),0.0,3.14159))) errCnt++;
if(!isnan(fma(-__inf(),0.0,3.14159))) errCnt++;
if(!isnan(fma(0.0,__inf(),3.14159))) errCnt++;
if(!isnan(fma(0.0,-__inf(),3.14159))) errCnt++;
if(!isnan(fma(__inf(),0.0,nan(NULL)))) errCnt++;
if(!isnan(fma(-__inf(),0.0,nan(NULL)))) errCnt++;
if(!isnan(fma(0.0,__inf(),nan(NULL)))) errCnt++;
if(!isnan(fma(0.0,-__inf(),nan(NULL)))) errCnt++;
if(!isnan(fma(__inf(),0.0,nan(NULL)))) errCnt++;
if(!isnan(fma(__inf(),3.14159,nan(NULL)))) errCnt++;
if(!isnan(fma(-__inf(),3.14159,nan(NULL)))) errCnt++;
if(!isnan(fma(3.14159,__inf(),nan(NULL)))) errCnt++;
if(!isnan(fma(3.14159,-__inf(),nan(NULL)))) errCnt++;
vald = fma(3.14159,__inf(),3.14159);
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = fma(-3.14159,__inf(),3.14159);
if(!isinf(vald) || signbit(vald) == 0) errCnt++;
vald = fma(__inf(),3.14159,3.14159);
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = fma(__inf(),-3.14159,3.14159);
if(!isinf(vald) || signbit(vald) == 0) errCnt++;
vald = fma(3.14159,3.14159,__inf());
if(!isinf(vald) || signbit(vald) != 0) errCnt++;
vald = fma(3.14159,3.14159,-__inf());
if(!isinf(vald) || signbit(vald) == 0) errCnt++;
// If x or y are NaN, a NaN shall be returned.
// If x multiplied by y is an exact infinity and z is also an infinity but with the opposite sign, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If one of x and y is infinite, the other is zero, and z is not a NaN, a domain error shall occur, and either a NaN (if supported), or an implementation-defined value shall be returned.
// If one of x and y is infinite, the other is zero, and z is a NaN, a NaN shall be returned and a domain error may occur.
// If x* y is not 0*Inf nor Inf*0 and z is a NaN, a NaN shall be returned.
if(!fcntFloatInRange(fmaf(-1.1f,-2.2f,3.3f),5.72f)) errCnt++;
if(!isnan(fmaf(nanf(NULL),4.2f,4.2f))) errCnt++;
if(!isnan(fmaf(1.0f,nanf(NULL),4.2f))) errCnt++;
if(!isnan(fmaf(1.0f,3.14159f,nanf(NULL)))) errCnt++;
if(!isnan(fmaf(__inff(),0.0f,nanf(NULL)))) errCnt++;
if(!isnan(fmaf(__inff(),__inff(),-__inff()))) errCnt++;
if(!isnan(fmaf(-__inff(),__inff(),__inff()))) errCnt++;
if(!isnan(fmaf(__inff(),-__inff(),__inff()))) errCnt++;
if(!isnan(fmaf(-__inff(),-__inff(),-__inff()))) errCnt++;
if(!isnan(fmaf(__inff(),0.0f,3.14159f))) errCnt++;
if(!isnan(fmaf(-__inff(),0.0f,3.14159f))) errCnt++;
if(!isnan(fmaf(0.0f,__inff(),3.14159f))) errCnt++;
if(!isnan(fmaf(0.0f,-__inff(),3.14159f))) errCnt++;
if(!isnan(fmaf(__inff(),0.0f,nanf(NULL)))) errCnt++;
if(!isnan(fmaf(-__inff(),0.0f,nanf(NULL)))) errCnt++;
if(!isnan(fmaf(0.0f,__inff(),nanf(NULL)))) errCnt++;
if(!isnan(fmaf(0.0f,-__inff(),nanf(NULL)))) errCnt++;
if(!isnan(fmaf(__inff(),0.0f,nanf(NULL)))) errCnt++;
if(!isnan(fmaf(__inff(),3.14159f,nanf(NULL)))) errCnt++;
if(!isnan(fmaf(-__inff(),3.14159f,nanf(NULL)))) errCnt++;
if(!isnan(fmaf(3.14159f,__inff(),nanf(NULL)))) errCnt++;
if(!isnan(fmaf(3.14159f,-__inff(),nanf(NULL)))) errCnt++;
valf = fma(3.14159f,__inff(),3.14159f);
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = fma(-3.14159f,__inff(),3.14159f);
if(!isinf(valf) || signbit(valf) == 0) errCnt++;
valf = fma(__inff(),3.14159f,3.14159f);
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = fma(__inff(),-3.14159f,3.14159f);
if(!isinf(valf) || signbit(valf) == 0) errCnt++;
valf = fma(3.14159f,3.14159f,__inff());
if(!isinf(valf) || signbit(valf) != 0) errCnt++;
valf = fma(3.14159f,3.14159f,-__inff());
if(!isinf(valf) || signbit(valf) == 0) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE28 errCnt = %u\n",errCnt);
#endif
// Test fmax, fmaxf
// If just one argument is a NaN, the other argument shall be returned.
// If x and y are NaN, a NaN shall be returned.
if(!fcntDoubleInRange(fmax(-1.1,-2.2),-1.1)) errCnt++;
if(!isnan(fmax(nan(NULL),nan(NULL)))) errCnt++;
if(fmax(nan(NULL),3.14159) != 3.14159) errCnt++;
if(fmax(3.14159,nan(NULL)) != 3.14159) errCnt++;
// If just one argument is a NaN, the other argument shall be returned.
// If x and y are NaN, a NaN shall be returned.
if(!fcntFloatInRange(fmaxf(-1.1f,-2.2f),-1.1f)) errCnt++;
if(!isnan(fmaxf(nanf(NULL),nanf(NULL)))) errCnt++;
if(fmaxf(nanf(NULL),3.14159f) != 3.14159f) errCnt++;
if(fmaxf(3.14159f,nanf(NULL)) != 3.14159f) errCnt++;
#if OPTION_TRACE_MATH
printf("TRACE29 errCnt = %u\n",errCnt);
#endif
// Test fmin, fminf
// If just one argument is a NaN, the other argument shall be returned.
// If x and y are NaN, a NaN shall be returned.