Skip to content

rinex: allow for numerical error in version comparison - #909

Open
ourairquality wants to merge 1 commit into
rtklibexplorer:mainfrom
ourairquality:rinex-ver-cmp
Open

rinex: allow for numerical error in version comparison#909
ourairquality wants to merge 1 commit into
rtklibexplorer:mainfrom
ourairquality:rinex-ver-cmp

Conversation

@ourairquality

Copy link
Copy Markdown

Related to #896 , allow for some floating point error when comparing the versions, and use a 4 decimal place number consistently.

@rtklibexplorer

Copy link
Copy Markdown
Owner

The AI review suggests a simpler/cleaner solution would be adding a single line to readrnxh() to fix the problem upstream

        *ver=str2num(buff,0,9);
  •       *ver=round(*ver*100.0)/100.0;   // snap to nearest valid 2-decimal RINEX version
          char sc;
    

@ourairquality

Copy link
Copy Markdown
Author

Don't think that's a good solution. It's not intuitive to the reader that a float version is rounded down to the lest significant digit. Do all compilers emit code that rounds an integer multiplied by 100 to the same rounded value, and emit code that compares them to that same accuracy??

A 'snap to' integer solution would be good - the reader can understand that easily. Tried to set it up for this by using 4 decimal places in all the comparisons - so that a follow up might use an integer version scaled by 1000.

@rtklibexplorer

Copy link
Copy Markdown
Owner

OK, here's a compromise proposal, functionally equivalent to the original, but avoids comparison to imaginary versions.
pr909_named_epsilon.patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants