Mercurial > hg > CbC > old > device
view test/float_gcc.c @ 748:c2c709727221
i64 continue... basic.s assembled.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 13 Nov 2010 22:39:40 +0900 |
parents | efc99e397413 |
children |
line wrap: on
line source
#include <math.h> extern int printf(const char *,...); #if 0 static __inline__ int __inline_signbitf( float __x ) { union{ float __f; unsigned int __u; } __u = {__x}; return (int)(__u.__u >> 31); } static __inline__ int __inline_isnormalf( float __x ) { float fabsf = __builtin_fabsf(__x); if( __x != __x ) return 0; return fabsf < __builtin_inff() && fabsf >= __FLT_MIN__; } extern double scalb ( double, double ) __asm("_scalb$UNIX2003" ); #endif double fabs0(double a) { return __builtin_fabs(a); } float fabsf0(float a) { return __builtin_fabsf(a); } int main() { float a = 0.3; double d = 0.3; float f ; double dd ; int i,j; i = __inline_signbitf(a); j = __inline_isnormalf(a); d = scalb( d, d ); dd = __builtin_inf(); printf("#0047:inf %g\n",dd); f = __builtin_inff(); printf("#0049:inff %g\n",f); // printf("#0050:scalb %g\n",d); d = -0.3; printf("#0054:%d %d %g\n",i,j,d); printf("#0055:%g %g\n",fabs0(d),fabsf0(d)); printf("#0056:%g %g\n",fabs0(-d),fabsf0(-d)); }