Skip to content

Relax offset for floating point numbers assertions#3262

Merged
0xnm merged 1 commit into
developfrom
nogorodnikov/relax-offset-for-floating-point-assertions
Mar 16, 2026
Merged

Relax offset for floating point numbers assertions#3262
0xnm merged 1 commit into
developfrom
nogorodnikov/relax-offset-for-floating-point-assertions

Conversation

@0xnm

@0xnm 0xnm commented Mar 16, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Follow-up for #3247.

We have now more floating pointing properties to assert and current offset makes tests fail in 50% of cases. Relaxing it a bit to have less failures (I didn't have any over 100 test runs).

It is expected to have a difference between number in the original objects vs number in the deserialized one:

Most floating-point numbers (like 0.1) cannot be represented exactly in binary (base-2). When you convert that binary value to a decimal string (base-10), the number is rounded to a human-readable representation. When you parse it back, the computer calculates the closest possible binary value to that string, which may differ from your original bit pattern by a tiny fraction (10^{-16} or smaller).

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@0xnm
0xnm requested review from a team as code owners March 16, 2026 10:54
@datadog-prod-us1-4

This comment has been minimized.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.41%. Comparing base (d31130d) to head (3e90357).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3262      +/-   ##
===========================================
- Coverage    71.45%   71.41%   -0.04%     
===========================================
  Files          940      940              
  Lines        34774    34774              
  Branches      5894     5894              
===========================================
- Hits         24846    24831      -15     
- Misses        8295     8302       +7     
- Partials      1633     1641       +8     

see 37 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@0xnm
0xnm merged commit 4058f87 into develop Mar 16, 2026
27 checks passed
@0xnm
0xnm deleted the nogorodnikov/relax-offset-for-floating-point-assertions branch March 16, 2026 15:34
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.

3 participants