Skip to content

Conversation

cschuchardt88
Copy link
Member

@cschuchardt88 cschuchardt88 commented Oct 4, 2025

Description

  • Renamed method to DivideCeiling
  • Fixed comments
  • Optimized the method
  • Now work with any number

Fixes # (issue)

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit Tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

/// <exception cref="ArgumentException">Thrown when divisor is zero or negative.</exception>
public static BigInteger CeilingDivide(this BigInteger a, BigInteger b)
public static BigInteger DivideCeiling(this BigInteger dividend, BigInteger divisor)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{
if (divisor == 0)
throw new ArgumentException("Divisor must be nonzero.", nameof(divisor));

Copy link
Member Author

@cschuchardt88 cschuchardt88 Oct 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will automatically throw DivideByZeroException from BigInteger.DivRem

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

Successfully merging this pull request may close these issues.

2 participants