Skip to content

Commit fcac25d

Browse files
Merge pull request #755 from ourairquality/rinex-pstd-enc-log0
rinex: guard against log of zero in P std encoding
2 parents 5afca71 + aa8d3d2 commit fcac25d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/rinex.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,8 +2488,9 @@ extern int outrnxobsb(FILE *fp, const rnxopt_t *opt, const obsd_t *obs, int n,
24882488
case 'C':
24892489
case 'P': {
24902490
// To RTKLib RINEX encoding
2491-
int pstdi = log2(obs[ind[i]].Pstd[k] * 100) - 5 + 0.5;
2492-
outrnxobsf(fp,obs[ind[i]].P[k],-1,pstdi);
2491+
float std = obs[ind[i]].Pstd[k];
2492+
int stdi = std > 0.0003125 ? log2(std * 100) - 5 + 0.5 : 0;
2493+
outrnxobsf(fp,obs[ind[i]].P[k],-1,stdi);
24932494
break;
24942495
}
24952496
case 'L': {

0 commit comments

Comments
 (0)