Skip to content

WEIBULL.DIST density is zero at zero - #3003

Merged
h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
Harrison-Booth:gc-build-g714x
Oct 31, 2026
Merged

h-a-n-a-s-h-i merged 2 commits into
storytold:mainfrom
Harrison-Booth:gc-build-g714x

Conversation

@Harrison-Booth

@Harrison-Booth Harrison-Booth commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Return zero from WEIBULL.DIST at x=0 for both density and cumulative modes, including shapes below one.
  • Preserve invalid negative x and cover positive density and cumulative controls.
  • Update the function parity record.

Validation

  • cargo fmt --all -- --check and git diff --check pass.
  • Rust crate tests and clippy were not run locally on this machine; they ran in CI on the contributor's fork and passed.
  • Excel expected values come from earlier Excel measurements of the same cases; no new Excel run was performed for this change.
  • Windows and Linux GUI checks were not run.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • WEIBULL.DIST now returns zero for both density and cumulative calculations when x is zero, including for shape values below one. This makes the result consistent across supported shape values. Negative x continues to return #NUM!.
  • Documentation

    • Updated the function parity notes to reflect the WEIBULL.DIST behavior at zero and for negative inputs.

@coderabbitai

coderabbitai Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 48c6b57 and 6d5ab57.

Files selected for processing: 2
  • crates/functions/src/stat/distributions.rs
  • docs/function-parity.md
Files skipped from review as they are similar to previous changes: 1
  • docs/function-parity.md

Limit details: You’ve used all 10 included reviews currently available.

Walkthrough

WEIBULL.DIST now returns zero when x is zero, before evaluating the density or cumulative formula. Tests and function parity documentation cover this behavior and the existing negative-input error.

Changes: WEIBULL.DIST zero handling

Layer / File(s) Summary
Handle and verify zero input
crates/functions/src/stat/distributions.rs, crates/functions/src/stat/tests.rs, docs/function-parity.md
weibull_dist returns 0.0 at x=0 in both modes. Tests cover shape values 0.5, 1.0, and 2.0, results at x=1, and #NUM! for negative x. The parity document records these behaviors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: dylanmtaylor, aiongg

Merge Risk: Minimal · up to 6d5ab

The change has no established merge-blocking correctness or availability risk.

Security architecture risk: Minimal · up to 6d5ab

The change is limited to returning zero from existing Weibull calculations. Argument conversion, invalid-input checks, function registrations, and positive-input calculations remain unchanged. No material security risk was identified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure remains numeric worksheet evaluation through the two existing names. The changed function ignores its evaluation context and only converts arguments, checks their numeric domain, performs arithmetic, and returns a value or error; the added branch does not introduce privileged or cross-service operations.

Trust Boundaries and Controls

  • observed — The zero shortcut does not precede argument conversion or the existing rejection of negative x and nonpositive shape or scale. Comparing base and head shows these checks remain in the same order before the new return, so this branch does not bypass them.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "WEIBULL.DIST density is zero at zero" matches the main change. The raw summary says weibull_dist now returns 0.0 when x == 0.0 in both cumulative and density modes, and the PR objectives st…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "WEIBULL.DIST density is zero at zero" matches the main change. The raw summary says weibull_dist now returns 0.0 when x == 0.0 in both cumulative and density modes, and the PR objectives state the same goal, including shapes below one. The title names the function and the behavior, and it is short and specific. It does not mention the cumulative-mode change, but the title does not need to cover every detail.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 1
  • Waived: $0.25 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Comment @coderabbitai help to get the list of available commands.

@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 31d5cc5 into storytold:main Oct 31, 2026
6 checks passed
@echelon

echelon commented Oct 31, 2026

Copy link
Copy Markdown
Member

Landed in main (fb1e59f). Thank you for the contribution, @Harrison-Booth!

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