Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce RealNumberQ and refactor #821

Merged
merged 3 commits into from
Mar 22, 2023
Merged

Conversation

rocky
Copy link
Member

@rocky rocky commented Mar 22, 2023

Supersedes #820.

As is common, the changes needed are far too great to do in one programming session. So this is the first part.

This is not a WMA builtin so it should not be protected.
Possibly we should remove this altogether and add ExactNumberQ

Rubi 5 defines RealNumberQ so this is a problem.
* Add slightly better test() annotation for the return type
* create BooleanType and use that
* Reduce use of RealNumberQ by removing it from Range[]
* Move {In,}ExactNumberQ from numbers to numerical_properties which is where
  other tests appear. (it is smaller than numbers).
* add is_number() to mathics.eval.numbers
@rocky rocky force-pushed the reduce-RealNumberQ-and-refactor branch from 687badc to 31770b2 Compare March 22, 2023 11:22
@rocky rocky mentioned this pull request Mar 22, 2023
"Range[imin_, imax_, di_]"

for arg in imin, imax, di:
if not is_number(arg):
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, what we need to check is if they are real numbers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Meaning Real, integer or rational

Copy link
Member Author

@rocky rocky Mar 22, 2023

Choose a reason for hiding this comment

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

The function was poorly (ambiguously or incorrectly) named. That has been corrected. However what it does I think is the correct thing. I compared with WMA.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. The comment was about the name of the internal function

mathics/eval/numbers.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mmatera mmatera left a comment

Choose a reason for hiding this comment

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

LGTM

@rocky
Copy link
Member Author

rocky commented Mar 22, 2023

There will be more PRs to remove RealNumberQ. This is just the first.

@rocky rocky merged commit a18ce0d into master Mar 22, 2023
@rocky rocky deleted the reduce-RealNumberQ-and-refactor branch March 22, 2023 19:07
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.

2 participants