Skip to content

fix(math): correct type signatures for copysign, fmod and curried bindings#253

Merged
dbrattli merged 2 commits intomainfrom
repo-assist/fix-math-type-errors-2026-04-16-da57b165d04a968f
Apr 16, 2026
Merged

fix(math): correct type signatures for copysign, fmod and curried bindings#253
dbrattli merged 2 commits intomainfrom
repo-assist/fix-math-type-errors-2026-04-16-da57b165d04a968f

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist.

Problem

Three type-signature bugs slipped through in PR #251 (math module expansion):

  1. math.copysign: the y parameter was typed as int, but Python's [math.copysign(x, y)]((docs.python.org/redacted) takes two floats. Passing an int literal won't cause a runtime error (Python coerces), but it breaks F# callers who pass a float value for y.

  2. math.fmod: parameters were typed int * int -> int, but [math.fmod(x, y)]((docs.python.org/redacted) computes the floating-point remainder — it takes and returns float, not int. Callers needing 5.5 % 2.2 would be unable to use the binding.

  3. Curried multi-parameter syntax: comb, pow, atan2, and dist used the F# curried arrow -> form for multi-parameter abstract members (e.g. abstract comb: n: int -> k: int -> int). All other multi-parameter bindings in the codebase use the tupled * form (e.g. abstract comb: n: int * k: int -> int). Consistent tupled syntax avoids potential partial-application surprises and matches the rest of the binding style.

Fix

  • copysign: x: float * y: float -> float (was x: float -> y: int -> float)
  • fmod: x: float * y: float -> float (was x: int -> y: int -> int)
  • comb, pow, atan2, dist: curried → tupled multi-param style

Trade-offs

  • The fmod/copysign changes are technically breaking for anyone using the old (buggy) signatures — but since the old signatures were wrong and this is a pre-release (rc), the fix is appropriate now.
  • No new functions added; pure correctness fix.

Note

🔒 Integrity filter blocked 10 items

The following items were blocked because they don't meet the GitHub integrity level.

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Repo Assist · ● 1.6M ·

…dings

- math.copysign: fix y parameter type from int to float (Python always
  takes two floats)
- math.fmod: fix parameter and return types from int to float (computes
  floating-point remainder, not integer modulo)
- math.comb, math.pow, math.atan2, math.dist: convert curried parameter
  syntax to tupled for consistency with all other multi-parameter
  bindings in the codebase

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dbrattli
Copy link
Copy Markdown
Collaborator

Superseded by the fixes in PR #251 (commit 37c8b3e) which addresses all the same issues: copysign y:int→float, fmod int→float, and curried→tupled conversion for comb/pow/atan2/dist, with updated tests. All 287 tests pass.

@dbrattli dbrattli closed this Apr 16, 2026
@dbrattli dbrattli reopened this Apr 16, 2026
Update tests for comb, copysign, fmod, pow, atan2, dist to use tupled
calling convention matching the corrected type signatures. Restore
PR #251 entries that were dropped from the Unreleased CHANGELOG section.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dbrattli dbrattli marked this pull request as ready for review April 16, 2026 15:18
@dbrattli dbrattli changed the title [Repo Assist] fix(math): correct type signatures for copysign, fmod and curried bindings fix(math): correct type signatures for copysign, fmod and curried bindings Apr 16, 2026
@dbrattli dbrattli merged commit 8f33975 into main Apr 16, 2026
9 of 10 checks passed
@dbrattli dbrattli deleted the repo-assist/fix-math-type-errors-2026-04-16-da57b165d04a968f branch April 16, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant