mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-16 04:05:46 +00:00
Fix pow usage
This commit is contained in:
parent
417dc1daf1
commit
03d5015390
@ -90,7 +90,7 @@ double var_uraeph(int ura)
|
||||
2.4, 3.4, 4.85, 6.85, 9.65, 13.65, 24.0, 48.0, 96.0, 192.0, 384.0, 768.0, 1536.0,
|
||||
3072.0, 6144.0
|
||||
};
|
||||
return ura < 0 || 15 < ura ? std::pow(2.0, 6144.0) : std::pow(2.0, ura_value[ura]);
|
||||
return ura < 0 || 15 < ura ? std::pow(6144.0, 2.0) : std::pow(ura_value[ura], 2.0);
|
||||
}
|
||||
|
||||
|
||||
@ -98,10 +98,10 @@ double var_uraeph(int ura)
|
||||
double var_urassr(int ura)
|
||||
{
|
||||
double std_;
|
||||
if (ura <= 0) return std::pow(2.0, DEFURASSR);
|
||||
if (ura >= 63) return std::pow(2.0, 5.4665);
|
||||
std_ = (std::pow(3.0, (ura >> 3) & 7) * (1.0 + (ura & 7) / 4.0) - 1.0) * 1e-3;
|
||||
return std::pow(2.0, std_);
|
||||
if (ura <= 0) return std::pow(DEFURASSR, 2.0);
|
||||
if (ura >= 63) return std::pow(5.4665, 2.0);
|
||||
std_ = (std::pow((ura >> 3) & 7, 2.0) * (1.0 + (ura & 7) / 4.0) - 1.0) * 1e-3;
|
||||
return std::pow(std_, 2.0);
|
||||
}
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ void eph2pos(gtime_t time, const eph_t *eph, double *rs, double *dts,
|
||||
*dts = eph->f0 + eph->f1 * tk + eph->f2 * tk * tk;
|
||||
|
||||
/* relativity correction */
|
||||
*dts -= 2.0 * sqrt(mu * eph->A) * eph-> e* sinE / std::pow(2.0, SPEED_OF_LIGHT);
|
||||
*dts -= 2.0 * sqrt(mu * eph->A) * eph-> e* sinE / std::pow(SPEED_OF_LIGHT, 2.0);
|
||||
|
||||
/* position and clock error variance */
|
||||
*var = var_uraeph(eph->sva);
|
||||
@ -285,7 +285,7 @@ void eph2pos(gtime_t time, const eph_t *eph, double *rs, double *dts,
|
||||
/* glonass orbit differential equations --------------------------------------*/
|
||||
void deq(const double *x, double *xdot, const double *acc)
|
||||
{
|
||||
double a, b, c, r2 = dot(x, x, 3), r3 = r2 * sqrt(r2), omg2 = std::pow(2.0, OMGE_GLO);
|
||||
double a, b, c, r2 = dot(x, x, 3), r3 = r2 * sqrt(r2), omg2 = std::pow(OMGE_GLO, 2.0);
|
||||
|
||||
if (r2 <= 0.0)
|
||||
{
|
||||
@ -293,7 +293,7 @@ void deq(const double *x, double *xdot, const double *acc)
|
||||
return;
|
||||
}
|
||||
/* ref [2] A.3.1.2 with bug fix for xdot[4],xdot[5] */
|
||||
a = 1.5 * J2_GLO * MU_GLO * std::pow(2.0, RE_GLO) / r2 / r3; /* 3/2*J2*mu*Ae^2/r^5 */
|
||||
a = 1.5 * J2_GLO * MU_GLO * std::pow(RE_GLO, 2.0) / r2 / r3; /* 3/2*J2*mu*Ae^2/r^5 */
|
||||
b = 5.0 * x[2] * x[2] / r2; /* 5*z^2/r^2 */
|
||||
c = -MU_GLO / r3 - a * (1.0 - b); /* -mu/r^3-a(1-b) */
|
||||
xdot[0] = x[3];
|
||||
@ -376,7 +376,7 @@ void geph2pos(gtime_t time, const geph_t *geph, double *rs, double *dts,
|
||||
}
|
||||
for (i = 0; i < 3; i++) rs[i] = x[i];
|
||||
|
||||
*var = std::pow(2.0, ERREPH_GLO);
|
||||
*var = std::pow(ERREPH_GLO, 2.0);
|
||||
}
|
||||
|
||||
|
||||
@ -858,7 +858,7 @@ void satposs(gtime_t teph, const obsd_t *obs, int n, const nav_t *nav,
|
||||
{
|
||||
if (!ephclk(time[i], teph, obs[i].sat, nav, dts + i * 2)) continue;
|
||||
dts[1 + i * 2] = 0.0;
|
||||
*var = std::pow(2.0, STD_BRDCCLK);
|
||||
*var = std::pow(STD_BRDCCLK, 2.0);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < n && i < MAXOBS; i++)
|
||||
|
@ -303,8 +303,8 @@ int readionexb(FILE *fp, const double *lats, const double *lons,
|
||||
|
||||
if ((x = str2num(buff, m % 16 * 5, 5)) == 9999.0) continue;
|
||||
|
||||
if (type == 1) p->data[index] = x * pow(10.0, nexp);
|
||||
else p->rms[index] = (float)(x * pow(10.0, nexp));
|
||||
if (type == 1) p->data[index] = x * std::pow(10.0, nexp);
|
||||
else p->rms[index] = (float)(x * std::pow(10.0, nexp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ double varerr(const prcopt_t *opt, double el, int sys)
|
||||
{
|
||||
double fact, varr;
|
||||
fact = sys == SYS_GLO ? EFACT_GLO : (sys == SYS_SBS ? EFACT_SBS : EFACT_GPS);
|
||||
varr = std::pow(2.0, opt->err[0]) * (std::pow(2.0, opt->err[1]) + std::pow(2.0, opt->err[2]) / sin(el));
|
||||
if (opt->ionoopt == IONOOPT_IFLC) varr *= std::pow(2.0, 3.0); /* iono-free */
|
||||
return std::pow(2.0, fact) * varr;
|
||||
varr = std::pow(opt->err[0], 2.0) * (std::pow(opt->err[1], 2.0) + std::pow(opt->err[2], 2.0) / sin(el));
|
||||
if (opt->ionoopt == IONOOPT_IFLC) varr *= std::pow(2, 3.0); /* iono-free */
|
||||
return std::pow(fact, 2.0) * varr;
|
||||
}
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
|
||||
}
|
||||
}
|
||||
}
|
||||
gamma = std::pow(2.0, lam[j]) / std::pow(2.0, lam[i]); /* f1^2/f2^2 */
|
||||
gamma = std::pow(lam[j], 2.0) / std::pow(lam[i], 2.0); /* f1^2/f2^2 */
|
||||
P1 = obs->P[i];
|
||||
P2 = obs->P[j];
|
||||
P1_P2 = nav->cbias[obs->sat-1][0];
|
||||
@ -153,7 +153,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
|
||||
}
|
||||
if (opt->sateph == EPHOPT_SBAS) PC -= P1_C1; /* sbas clock based C1 */
|
||||
|
||||
*var = std::pow(2.0, ERR_CBIAS);
|
||||
*var = std::pow(ERR_CBIAS, 2.0);
|
||||
|
||||
return PC;
|
||||
}
|
||||
@ -182,7 +182,7 @@ int ionocorr(gtime_t time, const nav_t *nav, int sat, const double *pos,
|
||||
if (ionoopt == IONOOPT_BRDC)
|
||||
{
|
||||
*ion = ionmodel(time, nav->ion_gps, pos, azel);
|
||||
*var = std::pow(2.0, *ion*ERR_BRDCI);
|
||||
*var = SQR(*ion*ERR_BRDCI);
|
||||
return 1;
|
||||
}
|
||||
/* sbas ionosphere model */
|
||||
@ -199,7 +199,7 @@ int ionocorr(gtime_t time, const nav_t *nav, int sat, const double *pos,
|
||||
if (ionoopt == IONOOPT_QZS && norm(nav->ion_qzs, 8)>0.0)
|
||||
{
|
||||
*ion = ionmodel(time, nav->ion_qzs, pos, azel);
|
||||
*var = std::pow(2.0, *ion * ERR_BRDCI);
|
||||
*var = std::pow(*ion * ERR_BRDCI, 2.0);
|
||||
return 1;
|
||||
}
|
||||
/* lex ionosphere model */
|
||||
@ -207,7 +207,7 @@ int ionocorr(gtime_t time, const nav_t *nav, int sat, const double *pos,
|
||||
// return lexioncorr(time, nav, pos, azel, ion, var);
|
||||
//}
|
||||
*ion = 0.0;
|
||||
*var = ionoopt == IONOOPT_OFF ? std::pow(2.0, ERR_ION) : 0.0;
|
||||
*var = ionoopt == IONOOPT_OFF ? std::pow(ERR_ION, 2.0) : 0.0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ int tropcorr(gtime_t time, const nav_t *nav, const double *pos,
|
||||
if (tropopt == TROPOPT_SAAS || tropopt == TROPOPT_EST || tropopt == TROPOPT_ESTG)
|
||||
{
|
||||
*trp = tropmodel(time, pos, azel, REL_HUMI);
|
||||
*var = std::pow(2.0, ERR_SAAS / (sin(azel[1]) + 0.1));
|
||||
*var = SQR(ERR_SAAS / (sin(azel[1]) + 0.1));
|
||||
return 1;
|
||||
}
|
||||
/* sbas troposphere model */
|
||||
@ -245,7 +245,7 @@ int tropcorr(gtime_t time, const nav_t *nav, const double *pos,
|
||||
}
|
||||
/* no correction */
|
||||
*trp = 0.0;
|
||||
*var = tropopt == TROPOPT_OFF ? std::pow(2.0, ERR_TROP) : 0.0;
|
||||
*var = tropopt == TROPOPT_OFF ? std::pow(ERR_TROP, 2.0) : 0.0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ int rescode(int iter, const obsd_t *obs, int n, const double *rs,
|
||||
/* GPS-L1 -> L1/B1 */
|
||||
if ((lam_L1 = nav->lam[obs[i].sat - 1][0]) > 0.0)
|
||||
{
|
||||
dion *= pow(2.0, lam_L1 / lam_carr[0]);
|
||||
dion *= std::pow(lam_L1 / lam_carr[0], 2.0);
|
||||
}
|
||||
/* tropospheric corrections */
|
||||
if (!tropcorr(obs[i].time, nav, pos, azel + i*2,
|
||||
@ -517,7 +517,7 @@ int raim_fde(const obsd_t *obs, int n, const double *rs,
|
||||
for (j = nvsat = 0, rms_e = 0.0; j < n - 1; j++)
|
||||
{
|
||||
if (!vsat_e[j]) continue;
|
||||
rms_e += std::pow(2.0, resp_e[j]);
|
||||
rms_e += std::pow(resp_e[j], 2.0);
|
||||
nvsat++;
|
||||
}
|
||||
if (nvsat < 5)
|
||||
|
@ -218,7 +218,7 @@ void readsp3b(FILE *fp, char type, int *sats, int ns, double *bfact,
|
||||
}
|
||||
if ((base = bfact[j < 3 ? 0 : 1]) > 0.0 && std > 0.0)
|
||||
{
|
||||
peph.std[sat-1][j] = (float)(pow(base, std)*(j < 3 ? 1e-3 : 1e-12));
|
||||
peph.std[sat-1][j] = (float)(std::pow(base, std)*(j < 3 ? 1e-3 : 1e-12));
|
||||
}
|
||||
}
|
||||
else if (v) { /* velocity */
|
||||
@ -228,7 +228,7 @@ void readsp3b(FILE *fp, char type, int *sats, int ns, double *bfact,
|
||||
}
|
||||
if ((base = bfact[j < 3 ? 0 : 1]) > 0.0 && std > 0.0)
|
||||
{
|
||||
peph.vst[sat-1][j] = (float)(pow(base, std)*(j < 3 ? 1e-7 : 1e-16));
|
||||
peph.vst[sat-1][j] = (float)(std::pow(base, std)*(j < 3 ? 1e-7 : 1e-16));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -662,9 +662,9 @@ int pephpos(gtime_t time, int sat, const nav_t *nav, double *rs,
|
||||
std = norm(s, 3);
|
||||
|
||||
/* extrapolation error for orbit */
|
||||
if (t[0 ] > 0.0) std += EXTERR_EPH * pow(2, t[0 ]) / 2.0;
|
||||
else if (t[NMAX] < 0.0) std += EXTERR_EPH * pow(2, t[NMAX]) / 2.0;
|
||||
*vare = pow(2, std);
|
||||
if (t[0 ] > 0.0) std += EXTERR_EPH * std::pow(t[0 ], 2.0) / 2.0;
|
||||
else if (t[NMAX] < 0.0) std += EXTERR_EPH * std::pow(t[NMAX], 2.0) / 2.0;
|
||||
*vare = std::pow(std, 2.0);
|
||||
}
|
||||
/* linear interpolation for clock */
|
||||
t[0] = timediff(time, nav->peph[index ].time);
|
||||
@ -696,7 +696,7 @@ int pephpos(gtime_t time, int sat, const nav_t *nav, double *rs,
|
||||
{
|
||||
dts[0] = 0.0;
|
||||
}
|
||||
if (varc) *varc = std::pow(2, std);
|
||||
if (varc) *varc = std::pow(std, 2.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -752,7 +752,7 @@ int pephclk(gtime_t time, int sat, const nav_t *nav, double *dts,
|
||||
trace(3, "prec clock outage %s sat=%2d\n", time_str(time, 0), sat);
|
||||
return 0;
|
||||
}
|
||||
if (varc) *varc = std::pow(2, std);
|
||||
if (varc) *varc = std::pow(std, 2.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -795,7 +795,7 @@ void satantoff(gtime_t time, const double *rs, int sat, const nav_t *nav,
|
||||
|
||||
if (NFREQ < 2 || lam[j] == 0.0 || lam[k] == 0.0) return;
|
||||
|
||||
gamma = std::pow(2, lam[k]) / std::pow(2, lam[j]);
|
||||
gamma = std::pow(lam[k], 2.0) / std::pow(lam[j], 2.0);
|
||||
C1 = gamma / (gamma - 1.0);
|
||||
C2 = -1.0 / (gamma - 1.0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user