Skip to content

Handle DBL_DECIMAL_DIG inconsistency - #53

Merged
timj merged 2 commits into
Starlink:masterfrom
embray:worktree-test-failures
Jun 4, 2026
Merged

Handle DBL_DECIMAL_DIG inconsistency#53
timj merged 2 commits into
Starlink:masterfrom
embray:worktree-test-failures

Conversation

@embray

@embray embray commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

This came up at #38: #38 (comment)

But was never handled. I agree that just setting the fallback DBL_DECIMAL_DIG to be consistent between C99 and C11 is least disruptive, and this fixes all the test failure I was having on my machine where the compiler was defaulting to C99.

Also fixed several build warnings that were coming from the Claude-generated tests (warnings that were enabled by default in GCC but maybe not in clang).

embray added 2 commits June 4, 2026 14:56
There were two classes of warnings that I was getting a large number of
with GCC's default warning settings:

- many Mapping constructor calls were passing a `status` argument, but
  this is only valid in the internal API; the public API does not pass a
  status flag (just use astOk to check status), so this was resulting in
  unused printf argument warnings

- other case was an empty string being passed as the `options` argument
  which does take a printf format string; GCC complains on empty printf
  format strings--the convention for this used elsewhere in the code is
  actually to pass a string containing just a single space
This addresses the question in PR Starlink#37:

"One thing I have discovered is that the serialization tests fail by
default because Claude decided that this was a C99-compatible repo and
forces C99 standard. This is fine as such but we then run into a problem
with AST_DBL_DIG being 18 in C99 mode (DBL_DIG [15] + 3) because
DBL_DECIMAL_DIG does not formally exist in the C standard until C11.
With C11 you get 17 digits and we get reproducible numbers in the output
files for string comparisons."

@dsberry's preferred fix (which I also agree is less disruptive) to set
the fallback to 17 digits when compling for C99 resulting in consistency
regardless of which C standard was compiled against; this fixes all the
remaining test failures for me.
@codecov

codecov Bot commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.88%. Comparing base (9124026) to head (d0a0d82).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #53   +/-   ##
=======================================
  Coverage   54.88%   54.88%           
=======================================
  Files         372      372           
  Lines      116841   116841           
  Branches    35679    35679           
=======================================
  Hits        64126    64126           
  Misses      35601    35601           
  Partials    17114    17114           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@timj
timj merged commit 16a2b27 into Starlink:master Jun 4, 2026
11 checks passed
@timj

timj commented Jun 4, 2026

Copy link
Copy Markdown
Member

Thank you for doing this.

@embray
embray deleted the worktree-test-failures branch June 8, 2026 10:04
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