No announcement yet.

numbers - ignore logical unimportant zeros

  • Filter
  • Time
  • Show
Clear All
new posts

  • numbers - ignore logical unimportant zeros

    I have a proprietary ansi-text file format with ending ".tab" which uses decimal, float and hex numbers in standard C-Syntax:

    The files I have to compare are the result of different work flows, so sometimes there are different numbers of leading zeros, sometimes different numbers of trailing zeros after decimal separators.

    I want to compare the logical values of the numbers ignoring the additional zeros. So I need a solution to ignore zeros in the following cases:
    1. zeros after "0x" (0x1 <=> 0x0001)
    2. on floats trailing zeros after decimal separator, before exponent (2.20 <=>2.2)
    3. leading zeros on decimals and floats (0003<=>3 or 03.3<=>3.3)
    4. zeros after [+-] (-4<=>-04 or 4E+04<=>4E+4)

    For case 1 I have the solution to define a comment rule:
    Identical text to: x0*
    This works only, until I define a numbers-rule as for C-Files:
    When the numbers rule is defined 0x3<=>0x03 is always an important error.
    This seemed to be independent from sequence of the rules definitions and may be a BUG.

    In case 2 I had tested the following comment-rule:
    Identical text to: \.\d*0+[\s,Ee])
    The result ignores more than intended, because all from decimal point is now a comment (0.30<=>0.50 result: no important difference). I haven't found a way to define comments (or ignored strings) by limiting literals outside the comment.

    Case 3 may be solved in a similar way like case 1.

    With case 4 I m expecting the same problem as for case 2 (compare -04<=>+04).

    I have already played around with replacement at session settings but without success.

    using BC v3.1.4 - build 10554 - pro edition evaluation - german
    (testing before upgrade from BC2)

  • #2

    Beyond Compare 3 does not support logical equivalence of numbers in the Text Comparison.

    You can use the replacements to match specific pairs (2.2 to 2.20) and use masks for the initial Source side, but not the destination side. Click the little dropdown arrow next to each Textbox to see the available Regular Expressions.

    The Data Compare is capable of Numeric Tolerance, but only for Data that is presented in Tables (rows and columns) with a Key column.

    You can define Grammar Elements for the Text Compare to consider the numbers Unimportant differences, but this will be true for any number pair (3 and 2 would be Unimportant/Blue, instead of Important/Red changes).
    Aaron P Scooter Software