• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stillwater-sc / universal / 26011539088
84%
master: 84%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 18 May 2026 03:37AM UTC
Jobs 1
Files 652
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

18 May 2026 03:14AM UTC coverage: 84.201% (+0.04%) from 84.164%
26011539088

push

github

web-flow
feat(erational): extend parse to p/q, decimal, and scientific notation (#866)

Previously erational::parse only accepted integer literals matching
[+-]*[0-9]+ and left the denominator unset (relying on the prior
state, which defaulted to 1 only on a freshly constructed value).

Replace parse() with a routing function and a static helper
parse_decimal_to_fraction(s, num, den, neg) that uses scan_decimal_float
(the foundation from #838) to tokenize either an integer, a decimal,
or a scientific literal into an exact (numerator, denominator)
edecimal pair:

  "42"          -> num=42,  den=1
  "3.14"        -> num=314, den=100
  "1.5e2"       -> num=150, den=1
  "1.5e-1"      -> num=15,  den=10

For the p/q form, split on '/' and parse each half through the same
helper, then combine as (p_num * q_den) / (p_den * q_num).  Sign is
the XOR of the two sides.  Mixed forms like "3.14/2" and "1e2/2e1"
work because each side is independently a decimal/scientific literal.

  "1/2"        -> 1/2
  "-22/7"      -> -22/7
  "22/-7"      -> -22/7
  "4/8"        -> 1/2     (normalize() reduces via GCD)
  "3.14/2"     -> 157/100

Rejected forms:
  - q == 0 across all flavors: "1/0", "5/0.0", "0/0", "1/0e10"
    (erational has no NaR encoding, and silently representing
     infinity would mask downstream divide-by-zero detection)
  - Two slashes: "1/2/3"
  - Empty side: "1/", "/2", "/"
  - Malformed decimal: "3.14.15", "1e", ".", "42x"

Defensive cap: parse_decimal_to_fraction rejects any input whose
significand or denominator would exceed 2^20 (1,048,576) digits, the
same cap used by edecimal::parse (#854).

operator>> hygiene (failbit + extraction guard) was already shipped in
#858 (Phase E of #835); the test file now also pins it.

Test (elastic/rational/decimal/conversion/string_parse.cpp) extended
to 11 groups: integer, p/q with simplification, decimal-to-rational,
scientific, mixed p/q with decimal sides, q=0 rejection, malformed,
negative-zero collapse, operator>> f... (continued)

56 of 56 new or added lines in 1 file covered. (100.0%)

2 existing lines in 1 file now uncovered.

46751 of 55523 relevant lines covered (84.2%)

6420837.95 hits per line

Coverage Regressions

Lines Coverage ∆ File
2
74.44
8.02% include/sw/universal/number/erational/erational_impl.hpp
Jobs
ID Job ID Ran Files Coverage
1 26011539088.1 18 May 2026 03:37AM UTC 652
84.2
GitHub Action Run
Source Files on build 26011539088
  • Tree
  • List 652
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #26011539088
  • c302eb34 on github
  • Prev Build on main (#26010460064)
  • Next Build on main (#26012810689)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc