Announcement

Collapse
No announcement yet.

Allow little differences in float values

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Allow little differences in float values

    I want to compare files containing timestamps in the format
    hour:minute:second.TenthSecond <Tab> SomeValue
    where differences in the timestamp up to 0.3 seconds are not important.

    e.g.
    ...
    22:35:52.6 2
    22:35:53.3 2
    22:35:54.1 2
    22:35:55.0 2
    ...

    Any chance to do that with BC?
    (as it's not sooo very likely it would be OK for me (better than nothing) if only the seconds-part is evaluated)

    Thanks,
    Ralf
    Last edited by ralfiii; 23-Mar-2009, 07:34 AM.

  • #2
    Hello,

    You could use the BC Data Compare session, and mark the column (if it does not auto detect) as a Date column. But the lowest the Date column can have as a set tolerance is 1 second. You could make the milliseconds a 2nd column that is Numeric, and set the .3 tolerance there. Tolerance cannot be set on Key columns, so you will probably want to introduce a Key column for your data.

    Or you can create a Text Compare rule where only the seconds part is evaluated, but it would not detect differences with:
    12:35:52.6 2
    and
    22:35:52.6 2

    Go to Tools -> File Formats. Create a new Format. On the Grammar tab, create a new grammar that defines the beginning of your timestamp
    ^\d\d:\d\d:
    mark Regular Expression and give the Grammar Element a name (Timestamp)

    Then, open a Text Compare, use this File Format, go to the Session Settings, and the Importance tab, and mark that grammar element Timestamp as Unimportant by unchecking its checkbox. The toggle on Ignore Unimportant Differences to hide Blue text as black text.
    Aaron P Scooter Software

    Comment


    • #3
      I don't want to ignore the timestamp fully, I just want to ignore small differences (up to 0.3 seconds) there.

      So if I compare

      22:35:52.6 2
      22:35:53.3 2
      22:35:54.1 2
      22:35:55.0 2

      with

      22:35:52.5 2
      22:35:53.8 2
      22:35:54.0 2
      22:35:54.9 2

      only the 2nd line should be marked as important difference.

      But I guess this is not possible with regular expressions.

      Comment


      • #4
        Hello,

        It is not possible with regular expressions, but is possible if you use the Data Compare and 'cut' the data into smaller chunks. The issue is that as a single timestamp column, the lowest difference defined is 1 second. If the seconds were their own numeric column, then you could define the difference as .3

        To see an example, paste your timestamps into a text file, and change the Data Compare File Format to use : as the delimiter. Then take the 3rd numeric column (54.0) and in the Session Settings define the numeric tolerance to be .3

        22:35:52.5
        22:35:53.8
        22:35:54.0
        22:35:54.9
        Aaron P Scooter Software

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎