log.cpp
Go to the documentation of this file.
00001 /*
00002  * log.cpp
00003  *
00004  * Code generation for function 'log'
00005  *
00006  * C source code generated on: Wed Jul 24 16:11:35 2013
00007  *
00008  */
00009 
00010 /* Include files */
00011 #include "rt_nonfinite.h"
00012 #include "Optimal_affine_tracking_3d16_fast_realtime.h"
00013 #include "log.h"
00014 #include "expm.h"
00015 #include "Optimal_affine_tracking_3d16_fast_realtime_rtwutil.h"
00016 
00017 /* Type Definitions */
00018 
00019 /* Named Constants */
00020 
00021 /* Variable Declarations */
00022 
00023 /* Variable Definitions */
00024 
00025 /* Function Declarations */
00026 static void eml_scalar_log(creal_T *x);
00027 static real_T rt_atan2d_snf(real_T u0, real_T u1);
00028 
00029 /* Function Definitions */
00030 static void eml_scalar_log(creal_T *x)
00031 {
00032   real_T x_re;
00033   real_T x_im;
00034   real_T b_x_im;
00035   real_T b_x_re;
00036   if ((x->im == 0.0) && rtIsNaN(x->re)) {
00037   } else if ((fabs(x->re) > 8.9884656743115785E+307) || (fabs(x->im) >
00038               8.9884656743115785E+307)) {
00039     x_re = x->re;
00040     x_im = x->im;
00041     b_x_im = x->im;
00042     b_x_re = x->re;
00043     x->re = log(rt_hypotd_snf(fabs(x_re / 2.0), fabs(x_im / 2.0))) +
00044       0.69314718055994529;
00045     x->im = rt_atan2d_snf(b_x_im, b_x_re);
00046   } else {
00047     x_re = x->re;
00048     x_im = x->im;
00049     b_x_im = x->im;
00050     b_x_re = x->re;
00051     x->re = log(rt_hypotd_snf(fabs(x_re), fabs(x_im)));
00052     x->im = rt_atan2d_snf(b_x_im, b_x_re);
00053   }
00054 }
00055 
00056 static real_T rt_atan2d_snf(real_T u0, real_T u1)
00057 {
00058   real_T y;
00059   int32_T i24;
00060   int32_T i25;
00061   if (rtIsNaN(u0) || rtIsNaN(u1)) {
00062     y = rtNaN;
00063   } else if (rtIsInf(u0) && rtIsInf(u1)) {
00064     if (u1 > 0.0) {
00065       i24 = 1;
00066     } else {
00067       i24 = -1;
00068     }
00069 
00070     if (u0 > 0.0) {
00071       i25 = 1;
00072     } else {
00073       i25 = -1;
00074     }
00075 
00076     y = atan2((real_T)i25, (real_T)i24);
00077   } else if (u1 == 0.0) {
00078     if (u0 > 0.0) {
00079       y = RT_PI / 2.0;
00080     } else if (u0 < 0.0) {
00081       y = -(RT_PI / 2.0);
00082     } else {
00083       y = 0.0;
00084     }
00085   } else {
00086     y = atan2(u0, u1);
00087   }
00088 
00089   return y;
00090 }
00091 
00092 void b_log(creal_T x[3])
00093 {
00094   int32_T k;
00095   for (k = 0; k < 3; k++) {
00096     eml_scalar_log(&x[k]);
00097   }
00098 }
00099 
00100 void c_log(creal_T x[2])
00101 {
00102   int32_T k;
00103   for (k = 0; k < 2; k++) {
00104     eml_scalar_log(&x[k]);
00105   }
00106 }
00107 
00108 /* End of code generation (log.cpp) */


depth_tracker_ros_vr8
Author(s): shusain
autogenerated on Fri Dec 6 2013 20:45:46