## what is the significance of 3.3121686421112381E-170 ?

on 19 Mar 2019
Latest activity Edited by Mike Hosea

on 20 Mar 2019

### Mike Hosea (view profile)

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)
{
real_T y;
real_T scale;
real_T absxk;
real_T t;
scale = 3.3121686421112381E-170;
absxk = fabs(x);
if (absxk > 3.3121686421112381E-170) {
y = 1.0;
scale = absxk;
} else {
t = absxk / 3.3121686421112381E-170;
y = t * t;
}
absxk = fabs(x);
if (absxk > scale) {
t = scale / absxk;
y = y * t * t + 1.0;
scale = absxk;
} else {
t = absxk / scale;
y += t * t;
}
absxk = fabs(x);
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);
}

Walter Roberson

### Walter Roberson (view profile)

on 19 Mar 2019
I notice that particular value has a representation of 0x1cc0000000000000 so it is 2^-563 rather than being "random". However I do not have enough context to figure out why it was used; I do not know what the routine is intended to do.

on 19 Mar 2019
I believe it is just finding the magnitude (or norm) of the vector.
return sqrt(x*x+x*x+x*x);
Walter Roberson

### Walter Roberson (view profile)

on 19 Mar 2019
It looks like it is doing some kind of internal rescaling to prevent underflow. It just isn't obvious to me why 1E-170 is the boundary point, rather than sqrt(realmin) .

### Mike Hosea (view profile)

on 20 Mar 2019
Edited by Mike Hosea

on 20 Mar 2019