rt_pow32_snf.c
Go to the documentation of this file.
00001 /*
00002  * rt_pow32_snf.c
00003  *
00004  * Embedded MATLAB Coder code generation for function 'autogen_ekf_propagation'
00005  *
00006  * C source code generated on: Wed Aug 24 18:34:48 2011
00007  *
00008  */
00009 
00010 #include "rt_pow32_snf.h"
00011 #include <math.h>
00012 #include "rt_nonfinite.h"
00013 
00014 #ifndef RT_PI
00015   #define RT_PI      ((real32_T)3.14159265358979323846)
00016 #endif
00017 
00018 /* Function: rt_pow32 =====================================================
00019  * Abstract:
00020  *   Calls single-precision version of POW, with guard against domain error
00021  *   and guards against non-finites
00022  */
00023 real32_T rt_pow32_snf(const real32_T xr, const real32_T yr) 
00024 {
00025   real32_T axr, ayr;
00026   if (rtIsNaNF(xr) || rtIsNaNF(yr) ) {
00027     return( rtNaNF );
00028   }
00029 
00030   axr = (real32_T)fabs(xr);
00031   if (rtIsInfF(yr)) {
00032     if (axr == 1.0F) {
00033       return( rtNaNF );
00034     } else if (axr > 1.0F) {
00035       return( ( yr > 0.0F ) ? rtInfF : 0.0F);
00036     } else {
00037       return( ( yr > 0.0F ) ? 0.0F : rtInfF );
00038     }
00039   }
00040 
00041   ayr = (real32_T)fabs(yr);
00042   if (ayr == 0.0F) {
00043     return( 1.0F );
00044   } else if (ayr == 1.0F) {
00045     return( ( yr > 0.0F ) ? xr : 1.0F/xr );
00046   } else if (yr == 2.0F) {
00047     return( xr * xr);
00048   } else if (yr == 0.5F && xr >= 0.0F) {
00049     return( (real32_T)sqrt(xr) );
00050   } else if ((xr < 0.0F) && (yr > (real32_T)floor(yr)) ) {
00051     return( rtNaNF );
00052   }
00053 
00054   return( (real32_T)pow(xr,yr) );
00055 
00056 } /* end rt_pow32_snf */
00057 /* End of Embedded MATLAB Coder code generation (rt_pow32_snf.c) */


asctec_hl_firmware
Author(s): Markus Achtelik, Michael Achtelik, Stephan Weiss, Laurent Kneip
autogenerated on Tue Dec 17 2013 11:39:27