Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 232824

Forum Post: RE: Coverage deficiency

$
0
0
Hi, Thank you for the response. The below information that is present in _def.h – might be handy for you static __inline __uint32_t __f32_bits_as_u32(float x) { const union { float f; __uint32_t i; } rep = {.f = x}; return rep.i; } static __inline float __u32_bits_as_f32(__uint32_t x) { const union { float f; __uint32_t i; } rep = {.i = x}; return rep.f; } #define GET_FLOAT_WORD(dst,f) (dst=__f32_bits_as_u32(f)) #define SET_FLOAT_WORD(dst,u) (dst=__u32_bits_as_f32(u)) And also the below are the includes and huge value and also the complete code.. #include #include #include "math.h" #include "math_private.h" _DATA_ACCESS static const float huge = 1.0e30; (actually I changed this to a variable and renamed as while debugging I noticed it is not holding the same value as defined. float floorf(float x) { int32_t i0,j0; uint32_t i; GET_FLOAT_WORD(i0,x); j0 = ((i0>>23)&0xff)-0x7f; if(j0 (float)0.0) {/* return 0*sign(x) if |x| =0) {i0=0;} else if((i0&0x7fffffff)!=0) { i0=0xbf800000;} } } else { i = (0x007fffff)>>j0; if((i0&i)==0) return x; /* x is integral */ if(huge+x>(float)0.0) { /* raise inexact flag */ if(i0 >j0; i0 &= (~i); } } } else { if(j0==0x80) return x+x; /* inf or NaN */ else return x; /* x is integral */ } SET_FLOAT_WORD(x,i0); return x; } #if DBL_MANT_DIG == FLT_MANT_DIG double floor(double x) __attribute__((__alias__("floorf"))); #endif #if LDBL_MANT_DIG == FLT_MANT_DIG long double floorl(long double x) __attribute__((__alias__("floorf"))); #endif Thanks and Best Regards, Mohan

Viewing all articles
Browse latest Browse all 232824

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>