using matlab coder, the following is produced. real_T is a double precision floating point.
What is the significance of 3.3121686421112381E-170 ? Why was this specific number chosen, and not some other number?
/* Function for MATLAB Function: '<S1>/MATLAB Function' */static real_T MyThing_norm(const real_T x[3]){ real_T y; real_T scale; real_T absxk; real_T t; scale = 3.3121686421112381E-170; absxk = fabs(x[0]); if (absxk > 3.3121686421112381E-170) { y = 1.0; scale = absxk; } else { t = absxk / 3.3121686421112381E-170; y = t * t; } absxk = fabs(x[1]); if (absxk > scale) { t = scale / absxk; y = y * t * t + 1.0; scale = absxk; } else { t = absxk / scale; y += t * t; } absxk = fabs(x[2]); if (absxk > scale) { t = scale / absxk; y = y * t * t + 1.0; scale = absxk; } else { t = absxk / scale; y += t * t; } return scale * sqrt(y);}
Best Answer