Conversation
… remainder, isclose, nextafter, ulp, exp2, cbrt) Add the following Python 3.8-3.12 math functions that were absent from the existing Math.fs bindings: - log(x, base): logarithm with explicit base - ldexp(x, i): x * 2**i - frexp(x): decompose into mantissa and exponent - modf(x): fractional and integer parts - remainder(x, y): IEEE 754 remainder (Python 3.8+) - isclose(a, b) / isclose(a, b, rel_tol, abs_tol): approximate equality - nextafter(x, y): next representable float (Python 3.9+) - ulp(x): value of least significant bit (Python 3.9+) - exp2(x): 2**x (Python 3.11+) - cbrt(x): cube root (Python 3.11+) Also adds tests for each new binding in TestMath.fs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dbrattli
requested changes
Apr 16, 2026
Collaborator
dbrattli
left a comment
There was a problem hiding this comment.
CHANGELOG.md regression
The PR deletes existing unreleased changelog entries from PRs #251 and #253 (bug fixes for factorial, copysign, fmod, etc., and the new constants/functions). The new entry should be appended, not replace the existing content.
Please revert the CHANGELOG.md changes entirely — changelog entries are managed by maintainers during the release process. An instruction has been added to AGENTS.md to prevent this in the future.
Minor suggestions
iscloseoverloads: Two overloads where the first(a, b) -> boolis a subset of the second(a, b, ?rel_tol, ?abs_tol) -> boolmay cause F# overload resolution ambiguity. Consider keeping only the single overload with optional params.modftest: Uses manual range check(frac > 0.699 && frac < 0.701)— could usemath.iscloseinstead since it's being added in the same PR.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dbrattli
approved these changes
Apr 16, 2026
- ldexp's second arg must be a native Python int, not Fable's Int32 - cbrt(27.0) returns 3.0000000000000004, use isclose for comparison Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This was referenced Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist.
Summary
Several Python 3.8–3.12
mathfunctions were absent fromMath.fs. This PR adds bindings for all of them, along with tests.New bindings
log(x, base)ldexp(x, i)x * 2**ifrexp(x)modf(x)remainder(x, y)isclose(a, b)/isclose(a, b, ?rel_tol, ?abs_tol)nextafter(x, y)ulp(x)exp2(x)2**xcbrt(x)All of these are available in Python ≥ 3.12 (the project's minimum), so no compatibility concerns.
Changes
src/stdlib/Math.fs— 10 new abstract members added toIExportstest/TestMath.fs— 12 new test cases covering every new bindingCHANGELOG.md— entry under## UnreleasedTrade-offs
isclosewith tolerances uses[<NamedParams(fromIndex=2)>]to mirror Python's keyword-only optional args.frexpandmodfreturn F# tuples (float * intandfloat * floatrespectively) which Fable emits as Python tuples — matching the Python API exactly.Note
🔒 Integrity filter blocked 10 items
The following items were blocked because they don't meet the GitHub integrity level.
list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: