Skip to content

Merge master (1.4.0) into next - #26

Merged
dereuromark merged 3 commits into
nextfrom
next-sync
Oct 11, 2026
Merged

dereuromark merged 3 commits into
nextfrom
next-sync

Conversation

@dereuromark

Copy link
Copy Markdown
Contributor

Brings next level with the released 1.4.0: rounded divide(), divideWithRemainder(), roundToStep(), createFromFloat(), zero() and one() with their tests and documentation.

Conflicts were limited to two documentation tables, resolved with the 2.0 wording (mod() at the larger scale, round() applying every mode at the scale).

One test differs from master on purpose: a value created as new Decimal('1.5', 0) is 1 in 2.0, so splitting it in two gives 1 and 0.

…actory

All additions; the 10,000 call comparison against master shows no
difference for existing calls.

- divide() takes an optional rounding mode as third argument. Without
  it the quotient is cut off as before. With it the rounding is decided
  on whole numbers from the exact remainder, so ties are detected
  exactly at any scale.
- divideWithRemainder() returns the whole number quotient and the
  remainder, with the same sign rule as mod().
- roundToStep() rounds to a multiple of any positive step, such as 0.05.
- createFromFloat() keeps all digits needed to reproduce the float. The
  constructor casts floats through the precision ini setting and drops
  digits beyond the 14th by default. The conversion does not depend on
  LC_NUMERIC.
- zero() and one().

allocate() used the declared scale as its unit. A value created with a
scale of 0 keeps its decimals in 1.x, so its shares did not sum up. It
now uses the decimals actually stored.
Add rounded division, remainder division, step rounding and a float factory
@dereuromark dereuromark added this to the 2.0.0 milestone Oct 11, 2026
@dereuromark dereuromark added the enhancement New feature or request label Oct 11, 2026
@dereuromark
dereuromark merged commit 67e500e into next Oct 11, 2026
5 checks passed
@dereuromark
dereuromark deleted the next-sync branch October 11, 2026 15:11
@codecov

codecov Bot commented Oct 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.00%. Comparing base (0bd7615) to head (613a622).
⚠️ Report is 5 commits behind head on next.

Additional details and impacted files
@@             Coverage Diff              @@
##               next      #26      +/-   ##
============================================
+ Coverage     97.73%   98.00%   +0.27%     
- Complexity      171      190      +19     
============================================
  Files             1        1              
  Lines           353      401      +48     
============================================
+ Hits            345      393      +48     
  Misses            8        8              

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant