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

Made eq attribute of standard objects int and float to meet the standards (IEEE 754) #2554

Merged
merged 21 commits into from
Oct 31, 2023

Conversation

c71n93
Copy link
Member

@c71n93 c71n93 commented Oct 24, 2023

Closes #2547


PR-Codex overview

Focus of this PR:

This PR focuses on making changes to the int and float classes in the eo-runtime module. It includes modifications to the eq and lt methods in both classes, as well as changes to the test files.

Detailed summary:

  • In eo-runtime/src/main/eo/org/eolang/int.eo:

    • Modifications to the eq method to test if $ = x.
    • Changes to the lt method to test if $ < x.
  • In eo-runtime/src/main/eo/org/eolang/float.eo:

    • Modifications to the eq method to test if $ = x.
    • Changes to the lt method to test if $ < x.
  • In eo-runtime/src/test/eo/org/eolang/int-tests.eo:

    • Changes to the test cases for the eq method.
  • In eo-runtime/src/test/eo/org/eolang/float-tests.eo:

    • Changes to the test cases for the eq and lt methods.
  • In eo-runtime/src/main/eo/org/eolang/float.eo:

    • Modifications to the eq method to test if $ = x.
    • Changes to the lt method to test if $ < x.
  • In eo-runtime/src/test/eo/org/eolang/float-tests.eo:

    • Changes to the test cases for the eq and lt methods.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@c71n93
Copy link
Member Author

c71n93 commented Oct 24, 2023

@mximp could you check this one, please?

@c71n93
Copy link
Member Author

c71n93 commented Oct 25, 2023

@maxonfjvipon could you check this one, please?

Copy link
Member

@maxonfjvipon maxonfjvipon left a comment

Choose a reason for hiding this comment

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

@c71n93 Good one. Just two comments from my side

import org.eolang.XmirObject;

/**
* GT.
Copy link
Member

Choose a reason for hiding this comment

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

@c71n93 I think this description and @since tag are wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

import org.eolang.XmirObject;

/**
* GT.
Copy link
Member

Choose a reason for hiding this comment

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

@c71n93 I think this description and @since tag are wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@maxonfjvipon maxonfjvipon left a comment

Choose a reason for hiding this comment

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

@c71n93 LGTM! Thanks

@c71n93
Copy link
Member Author

c71n93 commented Oct 26, 2023

@yegor256 @maxonfjvipon could you check this one, please? I made eq to reinterpret data as floating point for float and integer for int.

* @param appropriate The appropriate size.
* @return Bytes.
*/
public Bytes asBytesAppropriate(final int appropriate) {
Copy link
Member

Choose a reason for hiding this comment

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

@c71n93

  1. The name of the method seems a bit long and verbose to me. Maybe we can make up with something shorter.
    Maybe something like asStrictBytes, asPreciseBytes?
  2. The word "bytes" should be in the end of the name of the method, and adjective should not. Because we still want to get "bytes".
  3. variable appropriate is an adjective which seems a bit wrong. A believe it should be a noun since it's an integer number.

Copy link
Member Author

Choose a reason for hiding this comment

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

@maxonfjvipon Thanks, but could you provide me an example about the 3rd point? There are two variables with meaning size now: appropriate and size. I would like to name them appropriateSize and actualSize but it's compound naming.

Copy link
Member

Choose a reason for hiding this comment

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

@c71n93 what about length?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@maxonfjvipon maxonfjvipon left a comment

Choose a reason for hiding this comment

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

@c71n93 LGTM! Thanks

@c71n93
Copy link
Member Author

c71n93 commented Oct 27, 2023

@yegor256 could you check, please?

@yegor256
Copy link
Member

@c71n93 why int.eq can't be implemented in EO?

@c71n93
Copy link
Member Author

c71n93 commented Oct 27, 2023

@yegor256 It can, but why do we need to implement it in EO? float.eq is an atom, so why int.eq should not be?

@yegor256
Copy link
Member

@c71n93 good point. let's implement them both in EO

@c71n93
Copy link
Member Author

c71n93 commented Oct 27, 2023

@yegor256 why then int.lt and float.lt should be atoms?

@yegor256
Copy link
Member

@c71n93 they also can be implemented in EO

@c71n93
Copy link
Member Author

c71n93 commented Oct 27, 2023

@yegor256 It's not trivial task, especially for float.lt. Right off the bat I can't tell you how to do it. I think, this already looks like an unnecessary overcomplication.

@yegor256
Copy link
Member

@c71n93 we'll do gt and lt later

.codacy.yml Outdated
- "eo-runtime/src/main/java/EOorg/EOeolang/EOfloat$EOeq.java"
- "eo-runtime/src/main/java/EOorg/EOeolang/EOint$EOeq.java"
Copy link
Member

Choose a reason for hiding this comment

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

@c71n93 I think we don't need these lines here anymore

Copy link
Member Author

Choose a reason for hiding this comment

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

self-as-bytes
nan-as-bytes
FALSE
if.
Copy link
Member

Choose a reason for hiding this comment

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

@c71n93 I think this expression with if can be simplified with just or.

Copy link
Member Author

Choose a reason for hiding this comment

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

@c71n93 c71n93 changed the title Made eq attribute of standard objects int and float to be an atom Made eq attribute of standard objects int and float to meet the standards (IEEE 754) Oct 30, 2023
@c71n93
Copy link
Member Author

c71n93 commented Oct 30, 2023

@maxonfjvipon could you check again, please?

Copy link
Member

@maxonfjvipon maxonfjvipon left a comment

Choose a reason for hiding this comment

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

@c71n93 Looks good to me! Thanks

@c71n93
Copy link
Member Author

c71n93 commented Oct 30, 2023

@yegor256 could you check, please?

@yegor256
Copy link
Member

@rultor merge

@rultor
Copy link
Contributor

rultor commented Oct 31, 2023

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 6545c3f into objectionary:master Oct 31, 2023
11 checks passed
@rultor
Copy link
Contributor

rultor commented Oct 31, 2023

@rultor merge

@yegor256 Done! FYI, the full log is here (took me 21min)

@c71n93 c71n93 deleted the 2547-atom-eq branch March 20, 2024 14:21
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.

Make eq attribute of standard objects (int, float, ...) to be an atom.
4 participants