Skip to content

Add function to restrict a real to the intervale [0 , 1] - #2106

Merged
affeldt-aist merged 4 commits into
math-comp:masterfrom
lyonel2017:feature-clamp
Oct 1, 2026
Merged

affeldt-aist merged 4 commits into
math-comp:masterfrom
lyonel2017:feature-clamp

Conversation

@lyonel2017

@lyonel2017 lyonel2017 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor
Motivation for this change

Add function to restrict a real to the interval [0, 1].

Require for #2064

Checklist
  • added corresponding entries in CHANGELOG_UNRELEASED.md
  • added corresponding documentation in the headers

Reference: How to document

Merge policy

As a rule of thumb:

  • PRs with several commits that make sense individually and that
    all compile are preferentially merged into master.
  • PRs with disorganized commits are very likely to be squash-rebased.
Reminder to reviewers

@affeldt-aist

Copy link
Copy Markdown
Member

What to you about generalizing to realDomainType and any min/max?
Since 0 <= 1 is registered as a Hint, you could use Local Notation clamp01 := (@clamp R 0 1)
and this should be transparent.

@lyonel2017

Copy link
Copy Markdown
Contributor Author

What to you about generalizing to realDomainType and any min/max? Since 0 <= 1 is registered as a Hint, you could use Local Notation clamp01 := (@clamp R 0 1) and this should be transparent.

This works for me.

@affeldt-aist affeldt-aist left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is used in PR #2064 and something to have around for probability theory.
Thanks for the contribution.
Note that ideally this should be PRed to MathComp (fyi: @proux01 @CohenCyril ).

@affeldt-aist affeldt-aist added this to the 1.19.0 milestone Oct 1, 2026
@affeldt-aist affeldt-aist added the enhancement ✨ This issue/PR is about adding new features enhancing the library label Oct 1, 2026
@affeldt-aist
affeldt-aist merged commit 013decd into math-comp:master Oct 1, 2026
70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ This issue/PR is about adding new features enhancing the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants