Mercurial > hg > CbC > old > device
annotate test/float_gcc.c @ 775:a2a7b2835fa3
ia32 regression test
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 18 Nov 2010 21:25:30 +0900 |
parents | c2c709727221 |
children |
rev | line source |
---|---|
617 | 1 #include <math.h> |
2 | |
3 extern int printf(const char *,...); | |
4 | |
5 | |
6 #if 0 | |
7 static __inline__ int __inline_signbitf( float __x ) { | |
8 union{ float __f; unsigned int __u; | |
9 } | |
10 __u = {__x}; | |
11 return (int)(__u.__u >> 31); | |
12 } | |
13 | |
14 static __inline__ int __inline_isnormalf( float __x ) { | |
15 float fabsf = __builtin_fabsf(__x); | |
16 if( __x != __x ) return 0; | |
17 return fabsf < __builtin_inff() && fabsf >= __FLT_MIN__; | |
18 } | |
19 | |
20 extern double scalb ( double, double ) __asm("_scalb$UNIX2003" ); | |
21 #endif | |
22 | |
23 | |
24 double fabs0(double a) | |
25 { | |
26 return __builtin_fabs(a); | |
27 } | |
28 | |
29 float fabsf0(float a) | |
30 { | |
31 return __builtin_fabsf(a); | |
32 } | |
33 | |
34 | |
35 | |
36 int main() | |
37 { | |
38 float a = 0.3; | |
39 double d = 0.3; | |
40 float f ; | |
41 double dd ; | |
42 int i,j; | |
43 i = __inline_signbitf(a); | |
44 j = __inline_isnormalf(a); | |
45 d = scalb( d, d ); | |
46 | |
47 dd = __builtin_inf(); | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
617
diff
changeset
|
48 printf("#0047:inf %g\n",dd); |
617 | 49 f = __builtin_inff(); |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
617
diff
changeset
|
50 printf("#0049:inff %g\n",f); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
617
diff
changeset
|
51 // printf("#0050:scalb %g\n",d); |
617 | 52 |
53 d = -0.3; | |
54 | |
748
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
617
diff
changeset
|
55 printf("#0054:%d %d %g\n",i,j,d); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
617
diff
changeset
|
56 printf("#0055:%g %g\n",fabs0(d),fabsf0(d)); |
c2c709727221
i64 continue... basic.s assembled.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
617
diff
changeset
|
57 printf("#0056:%g %g\n",fabs0(-d),fabsf0(-d)); |
617 | 58 } |